summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-api/src')
-rw-r--r--rust/fatcat-api/src/client.rs573
-rw-r--r--rust/fatcat-api/src/lib.rs338
-rw-r--r--rust/fatcat-api/src/mimetypes.rs416
-rw-r--r--rust/fatcat-api/src/server.rs1399
4 files changed, 1362 insertions, 1364 deletions
diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs
index e9f8bf0e..978ce597 100644
--- a/rust/fatcat-api/src/client.rs
+++ b/rust/fatcat-api/src/client.rs
@@ -34,10 +34,9 @@ use swagger;
use swagger::{ApiError, Context, XSpanId};
use models;
-use {Api, ContainerBatchPostResponse, ContainerIdGetResponse, ContainerLookupGetResponse, ContainerPostResponse, CreatorBatchPostResponse, CreatorIdGetResponse, CreatorLookupGetResponse,
- CreatorPostResponse, EditgroupIdAcceptPostResponse, EditgroupIdGetResponse, EditgroupPostResponse, EditorUsernameChangelogGetResponse, EditorUsernameGetResponse, FileBatchPostResponse,
- FileIdGetResponse, FileLookupGetResponse, FilePostResponse, ReleaseBatchPostResponse, ReleaseIdGetResponse, ReleaseLookupGetResponse, ReleasePostResponse, WorkBatchPostResponse,
- WorkIdGetResponse, WorkPostResponse};
+use {AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse,
+ CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, GetContainerResponse, GetCreatorResponse, GetEditgroupResponse,
+ GetEditorChangelogResponse, GetEditorResponse, GetFileResponse, GetReleaseResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse};
/// Convert input into a base path, e.g. "http://example:123". Also checks the scheme as it goes.
fn into_base_path<T: IntoUrl>(input: T, correct_scheme: Option<&'static str>) -> Result<String, ClientInitError> {
@@ -162,52 +161,47 @@ impl Client {
}
impl Api for Client {
- fn container_batch_post(&self, param_entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = ContainerBatchPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/container/batch", self.base_path);
-
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ fn accept_editgroup(&self, param_id: i64, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editgroup/{id}/accept", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::CONTAINER_BATCH_POST.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<ContainerBatchPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<AcceptEditgroupResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
+ let body = serde_json::from_str::<models::Success>(&buf)?;
- Ok(ContainerBatchPostResponse::CreatedEntities(body))
+ Ok(AcceptEditgroupResponse::MergedSuccessfully(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerBatchPostResponse::BadRequest(body))
+ Ok(AcceptEditgroupResponse::Unmergable(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerBatchPostResponse::NotFound(body))
+ Ok(AcceptEditgroupResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerBatchPostResponse::GenericError(body))
+ Ok(AcceptEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -227,47 +221,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn container_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = ContainerIdGetResponse, 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 create_container(&self, param_entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/container", self.base_path);
+
+ 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::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_CONTAINER.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<ContainerIdGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateContainerResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::ContainerEntity>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(ContainerIdGetResponse::FoundEntity(body))
+ Ok(CreateContainerResponse::CreatedEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerIdGetResponse::BadRequest(body))
+ Ok(CreateContainerResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerIdGetResponse::NotFound(body))
+ Ok(CreateContainerResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerIdGetResponse::GenericError(body))
+ Ok(CreateContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -287,50 +286,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn container_lookup_get(&self, param_issnl: String, context: &Context) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_issnl = format!("issnl={issnl}&", issnl = param_issnl.to_string());
+ fn create_container_batch(&self, param_entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/container/batch", self.base_path);
- let url = format!("{}/v0/container/lookup?{issnl}", self.base_path, issnl = utf8_percent_encode(&query_issnl, QUERY_ENCODE_SET));
+ let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_CONTAINER_BATCH.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<ContainerLookupGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateContainerBatchResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::ContainerEntity>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(ContainerLookupGetResponse::FoundEntity(body))
+ Ok(CreateContainerBatchResponse::CreatedEntities(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerLookupGetResponse::BadRequest(body))
+ Ok(CreateContainerBatchResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerLookupGetResponse::NotFound(body))
+ Ok(CreateContainerBatchResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerLookupGetResponse::GenericError(body))
+ Ok(CreateContainerBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -350,8 +351,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- 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);
+ 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);
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -361,41 +362,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CONTAINER_POST.clone()));
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_CREATOR.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<ContainerPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateCreatorResponse, ApiError> {
match response.status.to_u16() {
201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(ContainerPostResponse::CreatedEntity(body))
+ Ok(CreateCreatorResponse::CreatedEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerPostResponse::BadRequest(body))
+ Ok(CreateCreatorResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerPostResponse::NotFound(body))
+ Ok(CreateCreatorResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ContainerPostResponse::GenericError(body))
+ Ok(CreateCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -415,7 +416,7 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn creator_batch_post(&self, param_entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreatorBatchPostResponse, Error = ApiError> + Send> {
+ fn create_creator_batch(&self, param_entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/creator/batch", self.base_path);
let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
@@ -426,41 +427,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATOR_BATCH_POST.clone()));
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_CREATOR_BATCH.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<CreatorBatchPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateCreatorBatchResponse, ApiError> {
match response.status.to_u16() {
201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(CreatorBatchPostResponse::CreatedEntities(body))
+ Ok(CreateCreatorBatchResponse::CreatedEntities(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorBatchPostResponse::BadRequest(body))
+ Ok(CreateCreatorBatchResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorBatchPostResponse::NotFound(body))
+ Ok(CreateCreatorBatchResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorBatchPostResponse::GenericError(body))
+ Ok(CreateCreatorBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -480,47 +481,45 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn creator_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = CreatorIdGetResponse, 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 create_editgroup(&self, param_entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editgroup", self.base_path);
+
+ 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::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_EDITGROUP.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<CreatorIdGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateEditgroupResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::CreatorEntity>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(CreatorIdGetResponse::FoundEntity(body))
+ Ok(CreateEditgroupResponse::SuccessfullyCreated(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorIdGetResponse::BadRequest(body))
- }
- 404 => {
- let mut buf = String::new();
- response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
-
- Ok(CreatorIdGetResponse::NotFound(body))
+ Ok(CreateEditgroupResponse::BadRequest(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorIdGetResponse::GenericError(body))
+ Ok(CreateEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -540,50 +539,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn creator_lookup_get(&self, param_orcid: String, context: &Context) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.to_string());
+ 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);
- let url = format!("{}/v0/creator/lookup?{orcid}", self.base_path, orcid = utf8_percent_encode(&query_orcid, QUERY_ENCODE_SET));
+ 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::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_FILE.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<CreatorLookupGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateFileResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::CreatorEntity>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(CreatorLookupGetResponse::FoundEntity(body))
+ Ok(CreateFileResponse::CreatedEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorLookupGetResponse::BadRequest(body))
+ Ok(CreateFileResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorLookupGetResponse::NotFound(body))
+ Ok(CreateFileResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorLookupGetResponse::GenericError(body))
+ Ok(CreateFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -603,10 +604,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- 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);
+ fn create_file_batch(&self, param_entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/file/batch", self.base_path);
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -614,41 +615,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATOR_POST.clone()));
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_FILE_BATCH.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<CreatorPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateFileBatchResponse, ApiError> {
match response.status.to_u16() {
201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(CreatorPostResponse::CreatedEntity(body))
+ Ok(CreateFileBatchResponse::CreatedEntities(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorPostResponse::BadRequest(body))
+ Ok(CreateFileBatchResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorPostResponse::NotFound(body))
+ Ok(CreateFileBatchResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(CreatorPostResponse::GenericError(body))
+ Ok(CreateFileBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -668,47 +669,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editgroup_id_accept_post(&self, param_id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editgroup/{id}/accept", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ 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);
+
+ 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);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<EditgroupIdAcceptPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateReleaseResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::Success>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(EditgroupIdAcceptPostResponse::MergedSuccessfully(body))
+ Ok(CreateReleaseResponse::CreatedEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditgroupIdAcceptPostResponse::Unmergable(body))
+ Ok(CreateReleaseResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditgroupIdAcceptPostResponse::NotFound(body))
+ Ok(CreateReleaseResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditgroupIdAcceptPostResponse::GenericError(body))
+ Ok(CreateReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -728,47 +734,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editgroup_id_get(&self, param_id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editgroup/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn create_release_batch(&self, param_entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/release/batch", self.base_path);
+
+ let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE_BATCH.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<EditgroupIdGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateReleaseBatchResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::Editgroup>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(EditgroupIdGetResponse::FoundEntity(body))
+ Ok(CreateReleaseBatchResponse::CreatedEntities(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditgroupIdGetResponse::BadRequest(body))
+ Ok(CreateReleaseBatchResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditgroupIdGetResponse::NotFound(body))
+ Ok(CreateReleaseBatchResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditgroupIdGetResponse::GenericError(body))
+ Ok(CreateReleaseBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -788,8 +799,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- 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);
+ 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);
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -799,34 +810,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::EDITGROUP_POST.clone()));
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<EditgroupPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateWorkResponse, ApiError> {
match response.status.to_u16() {
201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::Editgroup>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(EditgroupPostResponse::SuccessfullyCreated(body))
+ Ok(CreateWorkResponse::CreatedEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditgroupPostResponse::BadRequest(body))
+ Ok(CreateWorkResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(CreateWorkResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditgroupPostResponse::GenericError(body))
+ Ok(CreateWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -846,44 +864,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editor_username_changelog_get(&self, param_username: String, context: &Context) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send> {
- let url = format!(
- "{}/v0/editor/{username}/changelog",
- self.base_path,
- username = utf8_percent_encode(&param_username.to_string(), PATH_SEGMENT_ENCODE_SET)
- );
+ fn create_work_batch(&self, param_entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/work/batch", self.base_path);
+
+ let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK_BATCH.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<EditorUsernameChangelogGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateWorkBatchResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::Changelogentries>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
+
+ Ok(CreateWorkBatchResponse::CreatedEntities(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditorUsernameChangelogGetResponse::FoundMergedChanges(body))
+ Ok(CreateWorkBatchResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditorUsernameChangelogGetResponse::NotFound(body))
+ Ok(CreateWorkBatchResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditorUsernameChangelogGetResponse::GenericError(body))
+ Ok(CreateWorkBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -903,12 +929,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editor_username_get(&self, param_username: String, context: &Context) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send> {
- let url = format!(
- "{}/v0/editor/{username}",
- self.base_path,
- username = utf8_percent_encode(&param_username.to_string(), PATH_SEGMENT_ENCODE_SET)
- );
+ fn get_container(&self, param_id: String, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/container/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -919,28 +941,35 @@ impl Api for Client {
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<EditorUsernameGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetContainerResponse, ApiError> {
match response.status.to_u16() {
200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::Editor>(&buf)?;
+ let body = serde_json::from_str::<models::ContainerEntity>(&buf)?;
- Ok(EditorUsernameGetResponse::FoundEditor(body))
+ Ok(GetContainerResponse::FoundEntity(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditorUsernameGetResponse::NotFound(body))
+ Ok(GetContainerResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(EditorUsernameGetResponse::GenericError(body))
+ Ok(GetContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -960,52 +989,47 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn file_batch_post(&self, param_entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = FileBatchPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/file/batch", self.base_path);
-
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ fn get_creator(&self, param_id: String, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/creator/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::FILE_BATCH_POST.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<FileBatchPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetCreatorResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
+ let body = serde_json::from_str::<models::CreatorEntity>(&buf)?;
- Ok(FileBatchPostResponse::CreatedEntities(body))
+ Ok(GetCreatorResponse::FoundEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FileBatchPostResponse::BadRequest(body))
+ Ok(GetCreatorResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FileBatchPostResponse::NotFound(body))
+ Ok(GetCreatorResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FileBatchPostResponse::GenericError(body))
+ Ok(GetCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1025,8 +1049,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn file_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = FileIdGetResponse, 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 get_editgroup(&self, param_id: i64, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editgroup/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -1037,35 +1061,35 @@ impl Api for Client {
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<FileIdGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditgroupResponse, ApiError> {
match response.status.to_u16() {
200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::FileEntity>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(FileIdGetResponse::FoundEntity(body))
+ Ok(GetEditgroupResponse::FoundEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FileIdGetResponse::BadRequest(body))
+ Ok(GetEditgroupResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FileIdGetResponse::NotFound(body))
+ Ok(GetEditgroupResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FileIdGetResponse::GenericError(body))
+ Ok(GetEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1085,11 +1109,12 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn file_lookup_get(&self, param_sha1: String, context: &Context) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.to_string());
-
- let url = format!("{}/v0/file/lookup?{sha1}", self.base_path, sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET));
+ fn get_editor(&self, param_username: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/editor/{username}",
+ self.base_path,
+ username = utf8_percent_encode(&param_username.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -1100,35 +1125,28 @@ impl Api for Client {
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<FileLookupGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorResponse, ApiError> {
match response.status.to_u16() {
200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::FileEntity>(&buf)?;
-
- Ok(FileLookupGetResponse::FoundEntity(body))
- }
- 400 => {
- let mut buf = String::new();
- response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+ let body = serde_json::from_str::<models::Editor>(&buf)?;
- Ok(FileLookupGetResponse::BadRequest(body))
+ Ok(GetEditorResponse::FoundEditor(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FileLookupGetResponse::NotFound(body))
+ Ok(GetEditorResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FileLookupGetResponse::GenericError(body))
+ Ok(GetEditorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1148,52 +1166,44 @@ impl Api for Client {
Box::new(futures::done(result))
}
- 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_entity).expect("impossible to fail to serialize");
+ fn get_editor_changelog(&self, param_username: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/editor/{username}/changelog",
+ self.base_path,
+ username = utf8_percent_encode(&param_username.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::FILE_POST.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<FilePostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorChangelogResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
- let mut buf = String::new();
- response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
-
- Ok(FilePostResponse::CreatedEntity(body))
- }
- 400 => {
+ 200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+ let body = serde_json::from_str::<models::Changelogentries>(&buf)?;
- Ok(FilePostResponse::BadRequest(body))
+ Ok(GetEditorChangelogResponse::FoundMergedChanges(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FilePostResponse::NotFound(body))
+ Ok(GetEditorChangelogResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(FilePostResponse::GenericError(body))
+ Ok(GetEditorChangelogResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1213,52 +1223,47 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn release_batch_post(&self, param_entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = ReleaseBatchPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/release/batch", self.base_path);
-
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ fn get_file(&self, param_id: String, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/file/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::RELEASE_BATCH_POST.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<ReleaseBatchPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetFileResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
+ let body = serde_json::from_str::<models::FileEntity>(&buf)?;
- Ok(ReleaseBatchPostResponse::CreatedEntities(body))
+ Ok(GetFileResponse::FoundEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleaseBatchPostResponse::BadRequest(body))
+ Ok(GetFileResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleaseBatchPostResponse::NotFound(body))
+ Ok(GetFileResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleaseBatchPostResponse::GenericError(body))
+ Ok(GetFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1278,7 +1283,7 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn release_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send> {
+ fn get_release(&self, param_id: String, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/release/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
let hyper_client = (self.hyper_client)();
@@ -1290,35 +1295,35 @@ impl Api for Client {
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<ReleaseIdGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetReleaseResponse, ApiError> {
match response.status.to_u16() {
200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ReleaseEntity>(&buf)?;
- Ok(ReleaseIdGetResponse::FoundEntity(body))
+ Ok(GetReleaseResponse::FoundEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleaseIdGetResponse::BadRequest(body))
+ Ok(GetReleaseResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleaseIdGetResponse::NotFound(body))
+ Ok(GetReleaseResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleaseIdGetResponse::GenericError(body))
+ Ok(GetReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1338,11 +1343,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn release_lookup_get(&self, param_doi: String, context: &Context) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_doi = format!("doi={doi}&", doi = param_doi.to_string());
-
- let url = format!("{}/v0/release/lookup?{doi}", self.base_path, doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET));
+ fn get_work(&self, param_id: String, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/work/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -1353,35 +1355,35 @@ impl Api for Client {
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<ReleaseLookupGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetWorkResponse, ApiError> {
match response.status.to_u16() {
200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::ReleaseEntity>(&buf)?;
+ let body = serde_json::from_str::<models::WorkEntity>(&buf)?;
- Ok(ReleaseLookupGetResponse::FoundEntity(body))
+ Ok(GetWorkResponse::FoundEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleaseLookupGetResponse::BadRequest(body))
+ Ok(GetWorkResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleaseLookupGetResponse::NotFound(body))
+ Ok(GetWorkResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleaseLookupGetResponse::GenericError(body))
+ Ok(GetWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1401,52 +1403,50 @@ impl Api for Client {
Box::new(futures::done(result))
}
- 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);
+ fn lookup_container(&self, param_issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_issnl = format!("issnl={issnl}&", issnl = param_issnl.to_string());
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let url = format!("{}/v0/container/lookup?{issnl}", self.base_path, issnl = utf8_percent_encode(&query_issnl, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::RELEASE_POST.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<ReleasePostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupContainerResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<models::ContainerEntity>(&buf)?;
- Ok(ReleasePostResponse::CreatedEntity(body))
+ Ok(LookupContainerResponse::FoundEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleasePostResponse::BadRequest(body))
+ Ok(LookupContainerResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleasePostResponse::NotFound(body))
+ Ok(LookupContainerResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(ReleasePostResponse::GenericError(body))
+ Ok(LookupContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1466,52 +1466,50 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn work_batch_post(&self, param_entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = WorkBatchPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/work/batch", self.base_path);
+ fn lookup_creator(&self, param_orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.to_string());
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ let url = format!("{}/v0/creator/lookup?{orcid}", self.base_path, orcid = utf8_percent_encode(&query_orcid, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::WORK_BATCH_POST.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<WorkBatchPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupCreatorResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
+ let body = serde_json::from_str::<models::CreatorEntity>(&buf)?;
- Ok(WorkBatchPostResponse::CreatedEntities(body))
+ Ok(LookupCreatorResponse::FoundEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(WorkBatchPostResponse::BadRequest(body))
+ Ok(LookupCreatorResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(WorkBatchPostResponse::NotFound(body))
+ Ok(LookupCreatorResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(WorkBatchPostResponse::GenericError(body))
+ Ok(LookupCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1531,8 +1529,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn work_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = WorkIdGetResponse, 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 lookup_file(&self, param_sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.to_string());
+
+ let url = format!("{}/v0/file/lookup?{sha1}", self.base_path, sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -1543,35 +1544,35 @@ impl Api for Client {
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<WorkIdGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupFileResponse, ApiError> {
match response.status.to_u16() {
200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::WorkEntity>(&buf)?;
+ let body = serde_json::from_str::<models::FileEntity>(&buf)?;
- Ok(WorkIdGetResponse::FoundEntity(body))
+ Ok(LookupFileResponse::FoundEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(WorkIdGetResponse::BadRequest(body))
+ Ok(LookupFileResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(WorkIdGetResponse::NotFound(body))
+ Ok(LookupFileResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(WorkIdGetResponse::GenericError(body))
+ Ok(LookupFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1591,52 +1592,50 @@ impl Api for Client {
Box::new(futures::done(result))
}
- 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);
+ fn lookup_release(&self, param_doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_doi = format!("doi={doi}&", doi = param_doi.to_string());
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let url = format!("{}/v0/release/lookup?{doi}", self.base_path, doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::WORK_POST.clone()));
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<WorkPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupReleaseResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<models::ReleaseEntity>(&buf)?;
- Ok(WorkPostResponse::CreatedEntity(body))
+ Ok(LookupReleaseResponse::FoundEntity(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(WorkPostResponse::BadRequest(body))
+ Ok(LookupReleaseResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(WorkPostResponse::NotFound(body))
+ Ok(LookupReleaseResponse::NotFound(body))
}
0 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(WorkPostResponse::GenericError(body))
+ Ok(LookupReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs
index 1a46fbeb..d16644ab 100644
--- a/rust/fatcat-api/src/lib.rs
+++ b/rust/fatcat-api/src/lib.rs
@@ -33,11 +33,11 @@ mod mimetypes;
pub use swagger::{ApiError, Context, ContextWrapper};
#[derive(Debug, PartialEq)]
-pub enum ContainerBatchPostResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
- /// Bad Request
- BadRequest(models::ErrorResponse),
+pub enum AcceptEditgroupResponse {
+ /// Merged Successfully
+ MergedSuccessfully(models::Success),
+ /// Unmergable
+ Unmergable(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -45,9 +45,9 @@ pub enum ContainerBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ContainerIdGetResponse {
- /// Found Entity
- FoundEntity(models::ContainerEntity),
+pub enum CreateContainerResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -57,9 +57,9 @@ pub enum ContainerIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ContainerLookupGetResponse {
- /// Found Entity
- FoundEntity(models::ContainerEntity),
+pub enum CreateContainerBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -69,7 +69,7 @@ pub enum ContainerLookupGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ContainerPostResponse {
+pub enum CreateCreatorResponse {
/// Created Entity
CreatedEntity(models::EntityEdit),
/// Bad Request
@@ -81,7 +81,7 @@ pub enum ContainerPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreatorBatchPostResponse {
+pub enum CreateCreatorBatchResponse {
/// Created Entities
CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
@@ -93,21 +93,19 @@ pub enum CreatorBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreatorIdGetResponse {
- /// Found Entity
- FoundEntity(models::CreatorEntity),
+pub enum CreateEditgroupResponse {
+ /// Successfully Created
+ SuccessfullyCreated(models::Editgroup),
/// Bad Request
BadRequest(models::ErrorResponse),
- /// Not Found
- NotFound(models::ErrorResponse),
/// Generic Error
GenericError(models::ErrorResponse),
}
#[derive(Debug, PartialEq)]
-pub enum CreatorLookupGetResponse {
- /// Found Entity
- FoundEntity(models::CreatorEntity),
+pub enum CreateFileResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -117,9 +115,9 @@ pub enum CreatorLookupGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreatorPostResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
+pub enum CreateFileBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -129,11 +127,11 @@ pub enum CreatorPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum EditgroupIdAcceptPostResponse {
- /// Merged Successfully
- MergedSuccessfully(models::Success),
- /// Unmergable
- Unmergable(models::ErrorResponse),
+pub enum CreateReleaseResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -141,9 +139,9 @@ pub enum EditgroupIdAcceptPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum EditgroupIdGetResponse {
- /// Found Entity
- FoundEntity(models::Editgroup),
+pub enum CreateReleaseBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -153,19 +151,23 @@ pub enum EditgroupIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum EditgroupPostResponse {
- /// Successfully Created
- SuccessfullyCreated(models::Editgroup),
+pub enum CreateWorkResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
/// Generic Error
GenericError(models::ErrorResponse),
}
#[derive(Debug, PartialEq)]
-pub enum EditorUsernameChangelogGetResponse {
- /// Found Merged Changes
- FoundMergedChanges(models::Changelogentries),
+pub enum CreateWorkBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -173,9 +175,11 @@ pub enum EditorUsernameChangelogGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum EditorUsernameGetResponse {
- /// Found Editor
- FoundEditor(models::Editor),
+pub enum GetContainerResponse {
+ /// Found Entity
+ FoundEntity(models::ContainerEntity),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -183,9 +187,9 @@ pub enum EditorUsernameGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum FileBatchPostResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
+pub enum GetCreatorResponse {
+ /// Found Entity
+ FoundEntity(models::CreatorEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -195,9 +199,9 @@ pub enum FileBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum FileIdGetResponse {
+pub enum GetEditgroupResponse {
/// Found Entity
- FoundEntity(models::FileEntity),
+ FoundEntity(models::Editgroup),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -207,11 +211,9 @@ pub enum FileIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum FileLookupGetResponse {
- /// Found Entity
- FoundEntity(models::FileEntity),
- /// Bad Request
- BadRequest(models::ErrorResponse),
+pub enum GetEditorResponse {
+ /// Found Editor
+ FoundEditor(models::Editor),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -219,11 +221,9 @@ pub enum FileLookupGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum FilePostResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
- /// Bad Request
- BadRequest(models::ErrorResponse),
+pub enum GetEditorChangelogResponse {
+ /// Found Merged Changes
+ FoundMergedChanges(models::Changelogentries),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -231,9 +231,9 @@ pub enum FilePostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ReleaseBatchPostResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
+pub enum GetFileResponse {
+ /// Found Entity
+ FoundEntity(models::FileEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -243,7 +243,7 @@ pub enum ReleaseBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ReleaseIdGetResponse {
+pub enum GetReleaseResponse {
/// Found Entity
FoundEntity(models::ReleaseEntity),
/// Bad Request
@@ -255,9 +255,9 @@ pub enum ReleaseIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ReleaseLookupGetResponse {
+pub enum GetWorkResponse {
/// Found Entity
- FoundEntity(models::ReleaseEntity),
+ FoundEntity(models::WorkEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -267,9 +267,9 @@ pub enum ReleaseLookupGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ReleasePostResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
+pub enum LookupContainerResponse {
+ /// Found Entity
+ FoundEntity(models::ContainerEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -279,9 +279,9 @@ pub enum ReleasePostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum WorkBatchPostResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
+pub enum LookupCreatorResponse {
+ /// Found Entity
+ FoundEntity(models::CreatorEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -291,9 +291,9 @@ pub enum WorkBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum WorkIdGetResponse {
+pub enum LookupFileResponse {
/// Found Entity
- FoundEntity(models::WorkEntity),
+ FoundEntity(models::FileEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -303,9 +303,9 @@ pub enum WorkIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum WorkPostResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
+pub enum LookupReleaseResponse {
+ /// Found Entity
+ FoundEntity(models::ReleaseEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -316,104 +316,104 @@ pub enum WorkPostResponse {
/// API
pub trait Api {
- fn container_batch_post(&self, entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = ContainerBatchPostResponse, Error = ApiError> + Send>;
+ fn accept_editgroup(&self, id: i64, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
- fn container_id_get(&self, id: String, context: &Context) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send>;
+ fn create_container(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
- fn container_lookup_get(&self, issnl: String, context: &Context) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
+ fn create_container_batch(&self, entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>;
- fn container_post(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+ fn create_creator(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
- fn creator_batch_post(&self, entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreatorBatchPostResponse, Error = ApiError> + Send>;
+ fn create_creator_batch(&self, entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send>;
- fn creator_id_get(&self, id: String, context: &Context) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
+ fn create_editgroup(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
- fn creator_lookup_get(&self, orcid: String, context: &Context) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
+ fn create_file(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
- fn creator_post(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
- fn editgroup_id_accept_post(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
+ fn create_release(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
- fn editgroup_id_get(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
+ fn create_release_batch(&self, entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>;
- fn editgroup_post(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
+ fn create_work(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
- fn editor_username_changelog_get(&self, username: String, context: &Context) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>;
- fn editor_username_get(&self, username: String, context: &Context) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send>;
+ fn get_container(&self, id: String, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>;
- fn file_batch_post(&self, entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = FileBatchPostResponse, Error = ApiError> + Send>;
+ fn get_creator(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>;
- fn file_id_get(&self, id: String, context: &Context) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send>;
+ fn get_editgroup(&self, id: i64, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>;
- fn file_lookup_get(&self, sha1: String, context: &Context) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
+ fn get_editor(&self, username: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
- fn file_post(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+ fn get_editor_changelog(&self, username: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
- fn release_batch_post(&self, entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = ReleaseBatchPostResponse, Error = ApiError> + Send>;
+ fn get_file(&self, id: String, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>;
- fn release_id_get(&self, id: String, context: &Context) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
+ fn get_release(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
- fn release_lookup_get(&self, doi: String, context: &Context) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
+ fn get_work(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>;
- fn release_post(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+ fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
- fn work_batch_post(&self, entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = WorkBatchPostResponse, Error = ApiError> + Send>;
+ fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
- fn work_id_get(&self, id: String, context: &Context) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
+ fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
- fn work_post(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn lookup_release(&self, doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
}
/// API without a `Context`
pub trait ApiNoContext {
- fn container_batch_post(&self, entity_list: &Vec<models::ContainerEntity>) -> Box<Future<Item = ContainerBatchPostResponse, Error = ApiError> + Send>;
+ fn accept_editgroup(&self, id: i64) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
- fn container_id_get(&self, id: String) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send>;
+ fn create_container(&self, entity: models::ContainerEntity) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
- fn container_lookup_get(&self, issnl: String) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
+ fn create_container_batch(&self, entity_list: &Vec<models::ContainerEntity>) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>;
- fn container_post(&self, entity: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+ fn create_creator(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
- fn creator_batch_post(&self, entity_list: &Vec<models::CreatorEntity>) -> Box<Future<Item = CreatorBatchPostResponse, Error = ApiError> + Send>;
+ fn create_creator_batch(&self, entity_list: &Vec<models::CreatorEntity>) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send>;
- fn creator_id_get(&self, id: String) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
+ fn create_editgroup(&self, entity: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
- fn creator_lookup_get(&self, orcid: String) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
+ fn create_file(&self, entity: models::FileEntity) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
- fn creator_post(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
- fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
+ fn create_release(&self, entity: models::ReleaseEntity) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
- fn editgroup_id_get(&self, id: i64) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
+ fn create_release_batch(&self, entity_list: &Vec<models::ReleaseEntity>) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>;
- fn editgroup_post(&self, entity: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
+ fn create_work(&self, entity: models::WorkEntity) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
- fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>;
- fn editor_username_get(&self, username: String) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send>;
+ fn get_container(&self, id: String) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>;
- fn file_batch_post(&self, entity_list: &Vec<models::FileEntity>) -> Box<Future<Item = FileBatchPostResponse, Error = ApiError> + Send>;
+ fn get_creator(&self, id: String) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>;
- fn file_id_get(&self, id: String) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send>;
+ fn get_editgroup(&self, id: i64) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>;
- fn file_lookup_get(&self, sha1: String) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
+ fn get_editor(&self, username: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
- fn file_post(&self, entity: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+ fn get_editor_changelog(&self, username: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
- fn release_batch_post(&self, entity_list: &Vec<models::ReleaseEntity>) -> Box<Future<Item = ReleaseBatchPostResponse, Error = ApiError> + Send>;
+ fn get_file(&self, id: String) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>;
- fn release_id_get(&self, id: String) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
+ fn get_release(&self, id: String) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
- fn release_lookup_get(&self, doi: String) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
+ fn get_work(&self, id: String) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>;
- fn release_post(&self, entity: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+ fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
- fn work_batch_post(&self, entity_list: &Vec<models::WorkEntity>) -> Box<Future<Item = WorkBatchPostResponse, Error = ApiError> + Send>;
+ fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
- fn work_id_get(&self, id: String) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
+ fn lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
- fn work_post(&self, entity: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn lookup_release(&self, doi: String) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
}
/// Trait to extend an API to make it easy to bind it to a context.
@@ -432,100 +432,100 @@ impl<'a, T: Api + Sized> ContextWrapperExt<'a> for T {
}
impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
- fn container_batch_post(&self, entity_list: &Vec<models::ContainerEntity>) -> Box<Future<Item = ContainerBatchPostResponse, Error = ApiError> + Send> {
- self.api().container_batch_post(entity_list, &self.context())
+ fn accept_editgroup(&self, id: i64) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
+ self.api().accept_editgroup(id, &self.context())
}
- fn container_id_get(&self, id: String) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send> {
- self.api().container_id_get(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 container_lookup_get(&self, issnl: String) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send> {
- self.api().container_lookup_get(issnl, &self.context())
+ fn create_container_batch(&self, entity_list: &Vec<models::ContainerEntity>) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send> {
+ self.api().create_container_batch(entity_list, &self.context())
}
- fn container_post(&self, entity: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
- self.api().container_post(entity, &self.context())
+ fn create_creator(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ self.api().create_creator(entity, &self.context())
}
- fn creator_batch_post(&self, entity_list: &Vec<models::CreatorEntity>) -> Box<Future<Item = CreatorBatchPostResponse, Error = ApiError> + Send> {
- self.api().creator_batch_post(entity_list, &self.context())
+ fn create_creator_batch(&self, entity_list: &Vec<models::CreatorEntity>) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
+ self.api().create_creator_batch(entity_list, &self.context())
}
- fn creator_id_get(&self, id: String) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send> {
- self.api().creator_id_get(id, &self.context())
+ fn create_editgroup(&self, entity: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
+ self.api().create_editgroup(entity, &self.context())
}
- fn creator_lookup_get(&self, orcid: String) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send> {
- self.api().creator_lookup_get(orcid, &self.context())
+ fn create_file(&self, entity: models::FileEntity) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ self.api().create_file(entity, &self.context())
}
- fn creator_post(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
- self.api().creator_post(entity, &self.context())
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ self.api().create_file_batch(entity_list, &self.context())
}
- fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> {
- self.api().editgroup_id_accept_post(id, &self.context())
+ fn create_release(&self, entity: models::ReleaseEntity) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ self.api().create_release(entity, &self.context())
}
- fn editgroup_id_get(&self, id: i64) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> {
- self.api().editgroup_id_get(id, &self.context())
+ fn create_release_batch(&self, entity_list: &Vec<models::ReleaseEntity>) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
+ self.api().create_release_batch(entity_list, &self.context())
}
- fn editgroup_post(&self, entity: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
- self.api().editgroup_post(entity, &self.context())
+ fn create_work(&self, entity: models::WorkEntity) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ self.api().create_work(entity, &self.context())
}
- fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send> {
- self.api().editor_username_changelog_get(username, &self.context())
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
+ self.api().create_work_batch(entity_list, &self.context())
}
- fn editor_username_get(&self, username: String) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send> {
- self.api().editor_username_get(username, &self.context())
+ fn get_container(&self, id: String) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
+ self.api().get_container(id, &self.context())
}
- fn file_batch_post(&self, entity_list: &Vec<models::FileEntity>) -> Box<Future<Item = FileBatchPostResponse, Error = ApiError> + Send> {
- self.api().file_batch_post(entity_list, &self.context())
+ fn get_creator(&self, id: String) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
+ self.api().get_creator(id, &self.context())
}
- fn file_id_get(&self, id: String) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send> {
- self.api().file_id_get(id, &self.context())
+ fn get_editgroup(&self, id: i64) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
+ self.api().get_editgroup(id, &self.context())
}
- fn file_lookup_get(&self, sha1: String) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send> {
- self.api().file_lookup_get(sha1, &self.context())
+ fn get_editor(&self, username: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ self.api().get_editor(username, &self.context())
}
- fn file_post(&self, entity: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
- self.api().file_post(entity, &self.context())
+ fn get_editor_changelog(&self, username: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ self.api().get_editor_changelog(username, &self.context())
}
- fn release_batch_post(&self, entity_list: &Vec<models::ReleaseEntity>) -> Box<Future<Item = ReleaseBatchPostResponse, Error = ApiError> + Send> {
- self.api().release_batch_post(entity_list, &self.context())
+ fn get_file(&self, id: String) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
+ self.api().get_file(id, &self.context())
}
- fn release_id_get(&self, id: String) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send> {
- self.api().release_id_get(id, &self.context())
+ fn get_release(&self, id: String) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
+ self.api().get_release(id, &self.context())
}
- fn release_lookup_get(&self, doi: String) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send> {
- self.api().release_lookup_get(doi, &self.context())
+ fn get_work(&self, id: String) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
+ self.api().get_work(id, &self.context())
}
- fn release_post(&self, entity: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
- self.api().release_post(entity, &self.context())
+ fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ self.api().lookup_container(issnl, &self.context())
}
- fn work_batch_post(&self, entity_list: &Vec<models::WorkEntity>) -> Box<Future<Item = WorkBatchPostResponse, Error = ApiError> + Send> {
- self.api().work_batch_post(entity_list, &self.context())
+ fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ self.api().lookup_creator(orcid, &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 lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ self.api().lookup_file(sha1, &self.context())
}
- fn work_post(&self, entity: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
- self.api().work_post(entity, &self.context())
+ fn lookup_release(&self, doi: String) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ self.api().lookup_release(doi, &self.context())
}
}
diff --git a/rust/fatcat-api/src/mimetypes.rs b/rust/fatcat-api/src/mimetypes.rs
index 7b85cac5..323f28f0 100644
--- a/rust/fatcat-api/src/mimetypes.rs
+++ b/rust/fatcat-api/src/mimetypes.rs
@@ -4,426 +4,426 @@ pub mod responses {
use hyper::mime::*;
// The macro is called per-operation to beat the recursion limit
- /// Create Mime objects for the response content types for ContainerBatchPost
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref CONTAINER_BATCH_POST_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_MERGED_SUCCESSFULLY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerBatchPost
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref CONTAINER_BATCH_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_UNMERGABLE: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerBatchPost
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref CONTAINER_BATCH_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerBatchPost
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref CONTAINER_BATCH_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerIdGet
+ /// Create Mime objects for the response content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerIdGet
+ /// Create Mime objects for the response content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_ID_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerIdGet
+ /// Create Mime objects for the response content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_ID_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerIdGet
+ /// Create Mime objects for the response content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerLookupGet
+ /// Create Mime objects for the response content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerLookupGet
+ /// Create Mime objects for the response content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_LOOKUP_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerLookupGet
+ /// Create Mime objects for the response content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerLookupGet
+ /// Create Mime objects for the response content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerPost
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CONTAINER_POST_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerPost
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CONTAINER_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerPost
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CONTAINER_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerPost
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CONTAINER_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorBatchPost
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_BATCH_POST_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorBatchPost
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_BATCH_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorBatchPost
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_BATCH_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorBatchPost
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_BATCH_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorIdGet
+ /// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
- pub static ref CREATOR_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_EDITGROUP_SUCCESSFULLY_CREATED: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorIdGet
+ /// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
- pub static ref CREATOR_ID_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorIdGet
+ /// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
- pub static ref CREATOR_ID_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorIdGet
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref CREATOR_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorLookupGet
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref CREATOR_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorLookupGet
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref CREATOR_LOOKUP_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorLookupGet
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref CREATOR_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorLookupGet
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref CREATOR_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorPost
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref CREATOR_POST_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorPost
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref CREATOR_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorPost
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref CREATOR_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorPost
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref CREATOR_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdAcceptPost
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref EDITGROUP_ID_ACCEPT_POST_MERGED_SUCCESSFULLY: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdAcceptPost
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref EDITGROUP_ID_ACCEPT_POST_UNMERGABLE: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdAcceptPost
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref EDITGROUP_ID_ACCEPT_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdAcceptPost
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdGet
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref EDITGROUP_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdGet
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref EDITGROUP_ID_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdGet
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref EDITGROUP_ID_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdGet
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref EDITGROUP_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupPost
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref EDITGROUP_POST_SUCCESSFULLY_CREATED: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupPost
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref EDITGROUP_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupPost
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref EDITGROUP_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditorUsernameChangelogGet
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref EDITOR_USERNAME_CHANGELOG_GET_FOUND_MERGED_CHANGES: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditorUsernameChangelogGet
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref EDITOR_USERNAME_CHANGELOG_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditorUsernameChangelogGet
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditorUsernameGet
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref EDITOR_USERNAME_GET_FOUND_EDITOR: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditorUsernameGet
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref EDITOR_USERNAME_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditorUsernameGet
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref EDITOR_USERNAME_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileBatchPost
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref FILE_BATCH_POST_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileBatchPost
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref FILE_BATCH_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileBatchPost
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref FILE_BATCH_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileBatchPost
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref FILE_BATCH_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileIdGet
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref FILE_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileIdGet
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref FILE_ID_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileIdGet
+ /// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
- pub static ref FILE_ID_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_EDITGROUP_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileIdGet
+ /// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
- pub static ref FILE_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileLookupGet
+ /// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
- pub static ref FILE_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileLookupGet
+ /// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
- pub static ref FILE_LOOKUP_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileLookupGet
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref FILE_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_FOUND_EDITOR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileLookupGet
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref FILE_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FilePost
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref FILE_POST_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FilePost
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref FILE_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_CHANGELOG_FOUND_MERGED_CHANGES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FilePost
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref FILE_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_CHANGELOG_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FilePost
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref FILE_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_CHANGELOG_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseBatchPost
+ /// Create Mime objects for the response content types for GetFile
lazy_static! {
- pub static ref RELEASE_BATCH_POST_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref GET_FILE_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseBatchPost
+ /// Create Mime objects for the response content types for GetFile
lazy_static! {
- pub static ref RELEASE_BATCH_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseBatchPost
+ /// Create Mime objects for the response content types for GetFile
lazy_static! {
- pub static ref RELEASE_BATCH_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_FILE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseBatchPost
+ /// Create Mime objects for the response content types for GetFile
lazy_static! {
- pub static ref RELEASE_BATCH_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseIdGet
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref RELEASE_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseIdGet
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref RELEASE_ID_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseIdGet
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref RELEASE_ID_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseIdGet
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref RELEASE_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseLookupGet
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref RELEASE_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_WORK_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseLookupGet
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref RELEASE_LOOKUP_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_WORK_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseLookupGet
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref RELEASE_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_WORK_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseLookupGet
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref RELEASE_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_WORK_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleasePost
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref RELEASE_POST_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleasePost
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref RELEASE_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleasePost
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref RELEASE_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleasePost
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref RELEASE_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkBatchPost
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref WORK_BATCH_POST_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkBatchPost
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref WORK_BATCH_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkBatchPost
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref WORK_BATCH_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkBatchPost
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref WORK_BATCH_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkIdGet
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref WORK_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkIdGet
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref WORK_ID_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkIdGet
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref WORK_ID_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkIdGet
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref WORK_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkPost
+ /// Create Mime objects for the response content types for LookupRelease
lazy_static! {
- pub static ref WORK_POST_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_RELEASE_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkPost
+ /// Create Mime objects for the response content types for LookupRelease
lazy_static! {
- pub static ref WORK_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkPost
+ /// Create Mime objects for the response content types for LookupRelease
lazy_static! {
- pub static ref WORK_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkPost
+ /// Create Mime objects for the response content types for LookupRelease
lazy_static! {
- pub static ref WORK_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
}
pub mod requests {
use hyper::mime::*;
- /// Create Mime objects for the request content types for ContainerBatchPost
+ /// Create Mime objects for the request content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for ContainerPost
+ /// Create Mime objects for the request content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for CreatorBatchPost
+ /// Create Mime objects for the request content types for CreateCreator
lazy_static! {
- pub static ref CREATOR_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for CreatorPost
+ /// Create Mime objects for the request content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for EditgroupPost
+ /// Create Mime objects for the request content types for CreateEditgroup
lazy_static! {
- pub static ref EDITGROUP_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_EDITGROUP: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for FileBatchPost
+ /// Create Mime objects for the request content types for CreateFile
lazy_static! {
- pub static ref FILE_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for FilePost
+ /// Create Mime objects for the request content types for CreateFileBatch
lazy_static! {
- pub static ref FILE_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for ReleaseBatchPost
+ /// Create Mime objects for the request content types for CreateRelease
lazy_static! {
- pub static ref RELEASE_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for ReleasePost
+ /// Create Mime objects for the request content types for CreateReleaseBatch
lazy_static! {
- pub static ref RELEASE_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for WorkBatchPost
+ /// Create Mime objects for the request content types for CreateWork
lazy_static! {
- pub static ref WORK_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for WorkPost
+ /// Create Mime objects for the request content types for CreateWorkBatch
lazy_static! {
- pub static ref WORK_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH: Mime = mime!(Application / Json);
}
}
diff --git a/rust/fatcat-api/src/server.rs b/rust/fatcat-api/src/server.rs
index 0db2c445..3e003783 100644
--- a/rust/fatcat-api/src/server.rs
+++ b/rust/fatcat-api/src/server.rs
@@ -36,10 +36,9 @@ use swagger::{ApiError, Context, XSpanId};
#[allow(unused_imports)]
use models;
-use {Api, ContainerBatchPostResponse, ContainerIdGetResponse, ContainerLookupGetResponse, ContainerPostResponse, CreatorBatchPostResponse, CreatorIdGetResponse, CreatorLookupGetResponse,
- CreatorPostResponse, EditgroupIdAcceptPostResponse, EditgroupIdGetResponse, EditgroupPostResponse, EditorUsernameChangelogGetResponse, EditorUsernameGetResponse, FileBatchPostResponse,
- FileIdGetResponse, FileLookupGetResponse, FilePostResponse, ReleaseBatchPostResponse, ReleaseIdGetResponse, ReleaseLookupGetResponse, ReleasePostResponse, WorkBatchPostResponse,
- WorkIdGetResponse, WorkPostResponse};
+use {AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse,
+ CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, GetContainerResponse, GetCreatorResponse, GetEditgroupResponse,
+ GetEditorChangelogResponse, GetEditorResponse, GetFileResponse, GetReleaseResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse};
header! { (Warning, "Warning") => [String] }
@@ -88,7 +87,7 @@ where
{
let api_clone = api.clone();
router.post(
- "/v0/container/batch",
+ "/v0/editgroup/:id/accept",
move |req: &mut Request| {
let mut context = Context::default();
@@ -101,78 +100,60 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // 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.
-
- let param_entity_list = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
-
- let mut unused_elements = Vec::new();
-
- let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
-
- let param_entity_list: Option<Vec<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 entity_list - doesn't match schema: {}", e))))?;
-
- param_entity_list
- } else {
- None
+ // Path parameters
+ let param_id = {
+ let param = req.extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.container_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.accept_editgroup(param_id, context).wait() {
Ok(rsp) => match rsp {
- ContainerBatchPostResponse::CreatedEntities(body) => {
+ AcceptEditgroupResponse::MergedSuccessfully(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_BATCH_POST_CREATED_ENTITIES.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_MERGED_SUCCESSFULLY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ContainerBatchPostResponse::BadRequest(body) => {
+ AcceptEditgroupResponse::Unmergable(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_BATCH_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_UNMERGABLE.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ContainerBatchPostResponse::NotFound(body) => {
+ AcceptEditgroupResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_BATCH_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ContainerBatchPostResponse::GenericError(body) => {
+ AcceptEditgroupResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_BATCH_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -189,12 +170,12 @@ where
Ok(response)
})
},
- "ContainerBatchPost",
+ "AcceptEditgroup",
);
let api_clone = api.clone();
- router.get(
- "/v0/container/:id",
+ router.post(
+ "/v0/container",
move |req: &mut Request| {
let mut context = Context::default();
@@ -207,60 +188,78 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // Path parameters
- let param_id = {
- let param = req.extensions
- .get::<Router>()
- .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
- .find("id")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
- percent_decode(param.as_bytes())
- .decode_utf8()
- .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
- .parse()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ // 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.
+
+ 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_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+
+ 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 entity - doesn't match schema: {}", e))))?;
+
+ param_entity
+ } else {
+ None
};
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.container_id_get(param_id, context).wait() {
+ match api.create_container(param_entity, context).wait() {
Ok(rsp) => match rsp {
- ContainerIdGetResponse::FoundEntity(body) => {
+ CreateContainerResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_FOUND_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_CREATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- ContainerIdGetResponse::BadRequest(body) => {
+ CreateContainerResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- ContainerIdGetResponse::NotFound(body) => {
+ CreateContainerResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- ContainerIdGetResponse::GenericError(body) => {
+ CreateContainerResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -277,12 +276,12 @@ where
Ok(response)
})
},
- "ContainerIdGet",
+ "CreateContainer",
);
let api_clone = api.clone();
- router.get(
- "/v0/container/lookup",
+ router.post(
+ "/v0/container/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -295,56 +294,78 @@ 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_issnl = query_params
- .get("issnl")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter issnl".to_string())))?
- .first()
- .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter issnl was empty".to_string())))?
- .parse::<String>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter issnl - doesn't match schema: {}", e))))?;
+ // 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.
+
+ let param_entity_list = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
+
+ let param_entity_list: Option<Vec<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 entity_list - doesn't match schema: {}", e))))?;
+
+ param_entity_list
+ } else {
+ None
+ };
+ let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.container_lookup_get(param_issnl, context).wait() {
+ match api.create_container_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- ContainerLookupGetResponse::FoundEntity(body) => {
+ CreateContainerBatchResponse::CreatedEntities(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_FOUND_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_CREATED_ENTITIES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- ContainerLookupGetResponse::BadRequest(body) => {
+ CreateContainerBatchResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- ContainerLookupGetResponse::NotFound(body) => {
+ CreateContainerBatchResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- ContainerLookupGetResponse::GenericError(body) => {
+ CreateContainerBatchResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -361,12 +382,12 @@ where
Ok(response)
})
},
- "ContainerLookupGet",
+ "CreateContainerBatch",
);
let api_clone = api.clone();
router.post(
- "/v0/container",
+ "/v0/creator",
move |req: &mut Request| {
let mut context = Context::default();
@@ -391,7 +412,7 @@ where
let param_entity = if let Some(param_entity_raw) = param_entity {
let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_entity: Option<models::ContainerEntity> =
+ let param_entity: Option<models::CreatorEntity> =
serde_ignored::deserialize(deserializer, |path| {
warn!("Ignoring unknown field in body: {}", path);
unused_elements.push(path.to_string());
@@ -403,13 +424,13 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.container_post(param_entity, context).wait() {
+ match api.create_creator(param_entity, context).wait() {
Ok(rsp) => match rsp {
- ContainerPostResponse::CreatedEntity(body) => {
+ CreateCreatorResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_CREATED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_CREATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -417,11 +438,11 @@ where
}
Ok(response)
}
- ContainerPostResponse::BadRequest(body) => {
+ CreateCreatorResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -429,11 +450,11 @@ where
}
Ok(response)
}
- ContainerPostResponse::NotFound(body) => {
+ CreateCreatorResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -441,11 +462,11 @@ where
}
Ok(response)
}
- ContainerPostResponse::GenericError(body) => {
+ CreateCreatorResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -467,7 +488,7 @@ where
Ok(response)
})
},
- "ContainerPost",
+ "CreateCreator",
);
let api_clone = api.clone();
@@ -509,13 +530,13 @@ where
};
let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.creator_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.create_creator_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- CreatorBatchPostResponse::CreatedEntities(body) => {
+ CreateCreatorBatchResponse::CreatedEntities(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_BATCH_POST_CREATED_ENTITIES.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_CREATED_ENTITIES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -523,11 +544,11 @@ where
}
Ok(response)
}
- CreatorBatchPostResponse::BadRequest(body) => {
+ CreateCreatorBatchResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_BATCH_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -535,11 +556,11 @@ where
}
Ok(response)
}
- CreatorBatchPostResponse::NotFound(body) => {
+ CreateCreatorBatchResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_BATCH_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -547,11 +568,11 @@ where
}
Ok(response)
}
- CreatorBatchPostResponse::GenericError(body) => {
+ CreateCreatorBatchResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_BATCH_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -573,12 +594,12 @@ where
Ok(response)
})
},
- "CreatorBatchPost",
+ "CreateCreatorBatch",
);
let api_clone = api.clone();
- router.get(
- "/v0/creator/:id",
+ router.post(
+ "/v0/editgroup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -591,60 +612,65 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // Path parameters
- let param_id = {
- let param = req.extensions
- .get::<Router>()
- .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
- .find("id")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
- percent_decode(param.as_bytes())
- .decode_utf8()
- .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
- .parse()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
- };
+ // 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.
- match api.creator_id_get(param_id, context).wait() {
- Ok(rsp) => match rsp {
- CreatorIdGetResponse::FoundEntity(body) => {
- let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+ 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 response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_FOUND_ENTITY.clone()));
+ let mut unused_elements = Vec::new();
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- Ok(response)
- }
- CreatorIdGetResponse::BadRequest(body) => {
+ 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 entity - doesn't match schema: {}", e))))?;
+
+ param_entity
+ } else {
+ None
+ };
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+
+ match api.create_editgroup(param_entity, context).wait() {
+ Ok(rsp) => match rsp {
+ CreateEditgroupResponse::SuccessfullyCreated(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_BAD_REQUEST.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_SUCCESSFULLY_CREATED.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- CreatorIdGetResponse::NotFound(body) => {
+ CreateEditgroupResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_NOT_FOUND.clone()));
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- CreatorIdGetResponse::GenericError(body) => {
+ CreateEditgroupResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -661,12 +687,12 @@ where
Ok(response)
})
},
- "CreatorIdGet",
+ "CreateEditgroup",
);
let api_clone = api.clone();
- router.get(
- "/v0/creator/lookup",
+ router.post(
+ "/v0/file",
move |req: &mut Request| {
let mut context = Context::default();
@@ -679,56 +705,78 @@ 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_orcid = query_params
- .get("orcid")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter orcid".to_string())))?
- .first()
- .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter orcid was empty".to_string())))?
- .parse::<String>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter orcid - doesn't match schema: {}", e))))?;
+ // 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.
+
+ 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_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+
+ 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_entity
+ } else {
+ None
+ };
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.creator_lookup_get(param_orcid, context).wait() {
+ match api.create_file(param_entity, context).wait() {
Ok(rsp) => match rsp {
- CreatorLookupGetResponse::FoundEntity(body) => {
+ CreateFileResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_FOUND_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_CREATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- CreatorLookupGetResponse::BadRequest(body) => {
+ CreateFileResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- CreatorLookupGetResponse::NotFound(body) => {
+ CreateFileResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- CreatorLookupGetResponse::GenericError(body) => {
+ CreateFileResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -745,12 +793,12 @@ where
Ok(response)
})
},
- "CreatorLookupGet",
+ "CreateFile",
);
let api_clone = api.clone();
router.post(
- "/v0/creator",
+ "/v0/file/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -767,33 +815,33 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- 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 param_entity_list = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+ let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
- let param_entity: Option<models::CreatorEntity> =
+ let param_entity_list: Option<Vec<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))))?;
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
- param_entity
+ param_entity_list
} else {
None
};
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+ let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.creator_post(param_entity, context).wait() {
+ match api.create_file_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- CreatorPostResponse::CreatedEntity(body) => {
+ CreateFileBatchResponse::CreatedEntities(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_CREATED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_CREATED_ENTITIES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -801,11 +849,11 @@ where
}
Ok(response)
}
- CreatorPostResponse::BadRequest(body) => {
+ CreateFileBatchResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -813,11 +861,11 @@ where
}
Ok(response)
}
- CreatorPostResponse::NotFound(body) => {
+ CreateFileBatchResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -825,11 +873,11 @@ where
}
Ok(response)
}
- CreatorPostResponse::GenericError(body) => {
+ CreateFileBatchResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -851,12 +899,12 @@ where
Ok(response)
})
},
- "CreatorPost",
+ "CreateFileBatch",
);
let api_clone = api.clone();
router.post(
- "/v0/editgroup/:id/accept",
+ "/v0/release",
move |req: &mut Request| {
let mut context = Context::default();
@@ -869,60 +917,78 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // Path parameters
- let param_id = {
- let param = req.extensions
- .get::<Router>()
- .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
- .find("id")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
- percent_decode(param.as_bytes())
- .decode_utf8()
- .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
- .parse()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ // 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.
+
+ 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_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+
+ 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_entity
+ } else {
+ None
};
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.editgroup_id_accept_post(param_id, context).wait() {
+ match api.create_release(param_entity, context).wait() {
Ok(rsp) => match rsp {
- EditgroupIdAcceptPostResponse::MergedSuccessfully(body) => {
+ CreateReleaseResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_MERGED_SUCCESSFULLY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_CREATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditgroupIdAcceptPostResponse::Unmergable(body) => {
+ CreateReleaseResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_UNMERGABLE.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditgroupIdAcceptPostResponse::NotFound(body) => {
+ CreateReleaseResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditgroupIdAcceptPostResponse::GenericError(body) => {
+ CreateReleaseResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -939,12 +1005,12 @@ where
Ok(response)
})
},
- "EditgroupIdAcceptPost",
+ "CreateRelease",
);
let api_clone = api.clone();
- router.get(
- "/v0/editgroup/:id",
+ router.post(
+ "/v0/release/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -957,60 +1023,78 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // Path parameters
- let param_id = {
- let param = req.extensions
- .get::<Router>()
- .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
- .find("id")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
- percent_decode(param.as_bytes())
- .decode_utf8()
- .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
- .parse()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ // 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.
+
+ let param_entity_list = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
+
+ let param_entity_list: Option<Vec<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_list - doesn't match schema: {}", e))))?;
+
+ param_entity_list
+ } else {
+ None
};
+ let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.editgroup_id_get(param_id, context).wait() {
+ match api.create_release_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- EditgroupIdGetResponse::FoundEntity(body) => {
+ CreateReleaseBatchResponse::CreatedEntities(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_FOUND_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_CREATED_ENTITIES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditgroupIdGetResponse::BadRequest(body) => {
+ CreateReleaseBatchResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditgroupIdGetResponse::NotFound(body) => {
+ CreateReleaseBatchResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditgroupIdGetResponse::GenericError(body) => {
+ CreateReleaseBatchResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -1027,12 +1111,12 @@ where
Ok(response)
})
},
- "EditgroupIdGet",
+ "CreateReleaseBatch",
);
let api_clone = api.clone();
router.post(
- "/v0/editgroup",
+ "/v0/work",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1057,10 +1141,11 @@ where
let param_entity = if let Some(param_entity_raw) = param_entity {
let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- 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 entity - 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_entity
} else {
@@ -1068,13 +1153,13 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.editgroup_post(param_entity, context).wait() {
+ match api.create_work(param_entity, context).wait() {
Ok(rsp) => match rsp {
- EditgroupPostResponse::SuccessfullyCreated(body) => {
+ CreateWorkResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_SUCCESSFULLY_CREATED.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_CREATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1082,11 +1167,11 @@ where
}
Ok(response)
}
- EditgroupPostResponse::BadRequest(body) => {
+ CreateWorkResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1094,11 +1179,23 @@ where
}
Ok(response)
}
- EditgroupPostResponse::GenericError(body) => {
+ CreateWorkResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
+ Ok(response)
+ }
+ CreateWorkResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1120,12 +1217,12 @@ where
Ok(response)
})
},
- "EditgroupPost",
+ "CreateWork",
);
let api_clone = api.clone();
- router.get(
- "/v0/editor/:username/changelog",
+ router.post(
+ "/v0/work/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1138,50 +1235,78 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // Path parameters
- let param_username = {
- let param = req.extensions
- .get::<Router>()
- .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
- .find("username")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter username".to_string())))?;
- percent_decode(param.as_bytes())
- .decode_utf8()
- .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
- .parse()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter username: {}", e))))?
+ // 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.
+
+ let param_entity_list = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
+
+ let param_entity_list: Option<Vec<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_list - doesn't match schema: {}", e))))?;
+
+ param_entity_list
+ } else {
+ None
};
+ let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.editor_username_changelog_get(param_username, context).wait() {
+ match api.create_work_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- EditorUsernameChangelogGetResponse::FoundMergedChanges(body) => {
+ CreateWorkBatchResponse::CreatedEntities(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_FOUND_MERGED_CHANGES.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_CREATED_ENTITIES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
+ Ok(response)
+ }
+ CreateWorkBatchResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditorUsernameChangelogGetResponse::NotFound(body) => {
+ CreateWorkBatchResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditorUsernameChangelogGetResponse::GenericError(body) => {
+ CreateWorkBatchResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -1198,12 +1323,12 @@ where
Ok(response)
})
},
- "EditorUsernameChangelogGet",
+ "CreateWorkBatch",
);
let api_clone = api.clone();
router.get(
- "/v0/editor/:username",
+ "/v0/container/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1217,46 +1342,56 @@ where
context.authorization = req.extensions.remove::<Authorization>();
// Path parameters
- let param_username = {
+ let param_id = {
let param = req.extensions
.get::<Router>()
.ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
- .find("username")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter username".to_string())))?;
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
percent_decode(param.as_bytes())
.decode_utf8()
.map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
.parse()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter username: {}", e))))?
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.editor_username_get(param_username, context).wait() {
+ match api.get_container(param_id, context).wait() {
Ok(rsp) => match rsp {
- EditorUsernameGetResponse::FoundEditor(body) => {
+ GetContainerResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_FOUND_EDITOR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- EditorUsernameGetResponse::NotFound(body) => {
+ GetContainerResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- EditorUsernameGetResponse::GenericError(body) => {
+ GetContainerResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1276,12 +1411,12 @@ where
Ok(response)
})
},
- "EditorUsernameGet",
+ "GetContainer",
);
let api_clone = api.clone();
- router.post(
- "/v0/file/batch",
+ router.get(
+ "/v0/creator/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1294,78 +1429,60 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // 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.
-
- let param_entity_list = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
-
- let mut unused_elements = Vec::new();
-
- let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
-
- let param_entity_list: Option<Vec<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_list - doesn't match schema: {}", e))))?;
-
- param_entity_list
- } else {
- None
+ // Path parameters
+ let param_id = {
+ let param = req.extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.file_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.get_creator(param_id, context).wait() {
Ok(rsp) => match rsp {
- FileBatchPostResponse::CreatedEntities(body) => {
+ GetCreatorResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_BATCH_POST_CREATED_ENTITIES.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- FileBatchPostResponse::BadRequest(body) => {
+ GetCreatorResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_BATCH_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- FileBatchPostResponse::NotFound(body) => {
+ GetCreatorResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_BATCH_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- FileBatchPostResponse::GenericError(body) => {
+ GetCreatorResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_BATCH_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -1382,12 +1499,12 @@ where
Ok(response)
})
},
- "FileBatchPost",
+ "GetCreator",
);
let api_clone = api.clone();
router.get(
- "/v0/file/:id",
+ "/v0/editgroup/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1414,43 +1531,43 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.file_id_get(param_id, context).wait() {
+ match api.get_editgroup(param_id, context).wait() {
Ok(rsp) => match rsp {
- FileIdGetResponse::FoundEntity(body) => {
+ GetEditgroupResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- FileIdGetResponse::BadRequest(body) => {
+ GetEditgroupResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- FileIdGetResponse::NotFound(body) => {
+ GetEditgroupResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- FileIdGetResponse::GenericError(body) => {
+ GetEditgroupResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1470,12 +1587,12 @@ where
Ok(response)
})
},
- "FileIdGet",
+ "GetEditgroup",
);
let api_clone = api.clone();
router.get(
- "/v0/file/lookup",
+ "/v0/editor/:username",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1488,53 +1605,47 @@ 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_sha1 = query_params
- .get("sha1")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter sha1".to_string())))?
- .first()
- .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter sha1 was empty".to_string())))?
- .parse::<String>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter sha1 - doesn't match schema: {}", e))))?;
+ // Path parameters
+ let param_username = {
+ let param = req.extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("username")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter username".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter username: {}", e))))?
+ };
- match api.file_lookup_get(param_sha1, context).wait() {
+ match api.get_editor(param_username, context).wait() {
Ok(rsp) => match rsp {
- FileLookupGetResponse::FoundEntity(body) => {
+ GetEditorResponse::FoundEditor(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_FOUND_EDITOR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- FileLookupGetResponse::BadRequest(body) => {
- let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
-
- let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_BAD_REQUEST.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- FileLookupGetResponse::NotFound(body) => {
+ GetEditorResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- FileLookupGetResponse::GenericError(body) => {
+ GetEditorResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1554,12 +1665,12 @@ where
Ok(response)
})
},
- "FileLookupGet",
+ "GetEditor",
);
let api_clone = api.clone();
- router.post(
- "/v0/file",
+ router.get(
+ "/v0/editor/:username/changelog",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1572,78 +1683,50 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // 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.
-
- 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_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
-
- 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_entity
- } else {
- None
+ // Path parameters
+ let param_username = {
+ let param = req.extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("username")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter username".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter username: {}", e))))?
};
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.file_post(param_entity, context).wait() {
+ match api.get_editor_changelog(param_username, context).wait() {
Ok(rsp) => match rsp {
- FilePostResponse::CreatedEntity(body) => {
+ GetEditorChangelogResponse::FoundMergedChanges(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_POST_CREATED_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_FOUND_MERGED_CHANGES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
- Ok(response)
- }
- FilePostResponse::BadRequest(body) => {
- let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_POST_BAD_REQUEST.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
Ok(response)
}
- FilePostResponse::NotFound(body) => {
+ GetEditorChangelogResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- FilePostResponse::GenericError(body) => {
+ GetEditorChangelogResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -1660,12 +1743,12 @@ where
Ok(response)
})
},
- "FilePost",
+ "GetEditorChangelog",
);
let api_clone = api.clone();
- router.post(
- "/v0/release/batch",
+ router.get(
+ "/v0/file/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1678,78 +1761,60 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // 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.
-
- let param_entity_list = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
-
- let mut unused_elements = Vec::new();
-
- let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
-
- let param_entity_list: Option<Vec<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_list - doesn't match schema: {}", e))))?;
-
- param_entity_list
- } else {
- None
+ // Path parameters
+ let param_id = {
+ let param = req.extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.release_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.get_file(param_id, context).wait() {
Ok(rsp) => match rsp {
- ReleaseBatchPostResponse::CreatedEntities(body) => {
+ GetFileResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_BATCH_POST_CREATED_ENTITIES.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ReleaseBatchPostResponse::BadRequest(body) => {
+ GetFileResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_BATCH_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ReleaseBatchPostResponse::NotFound(body) => {
+ GetFileResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_BATCH_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ReleaseBatchPostResponse::GenericError(body) => {
+ GetFileResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_BATCH_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -1766,7 +1831,7 @@ where
Ok(response)
})
},
- "ReleaseBatchPost",
+ "GetFile",
);
let api_clone = api.clone();
@@ -1798,43 +1863,43 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.release_id_get(param_id, context).wait() {
+ match api.get_release(param_id, context).wait() {
Ok(rsp) => match rsp {
- ReleaseIdGetResponse::FoundEntity(body) => {
+ GetReleaseResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- ReleaseIdGetResponse::BadRequest(body) => {
+ GetReleaseResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- ReleaseIdGetResponse::NotFound(body) => {
+ GetReleaseResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- ReleaseIdGetResponse::GenericError(body) => {
+ GetReleaseResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1854,12 +1919,12 @@ where
Ok(response)
})
},
- "ReleaseIdGet",
+ "GetRelease",
);
let api_clone = api.clone();
router.get(
- "/v0/release/lookup",
+ "/v0/work/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1872,53 +1937,57 @@ 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_doi = query_params
- .get("doi")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter doi".to_string())))?
- .first()
- .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter doi was empty".to_string())))?
- .parse::<String>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter doi - doesn't match schema: {}", e))))?;
+ // Path parameters
+ let param_id = {
+ let param = req.extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
- match api.release_lookup_get(param_doi, context).wait() {
+ match api.get_work(param_id, context).wait() {
Ok(rsp) => match rsp {
- ReleaseLookupGetResponse::FoundEntity(body) => {
+ GetWorkResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- ReleaseLookupGetResponse::BadRequest(body) => {
+ GetWorkResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- ReleaseLookupGetResponse::NotFound(body) => {
+ GetWorkResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- ReleaseLookupGetResponse::GenericError(body) => {
+ GetWorkResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1938,12 +2007,12 @@ where
Ok(response)
})
},
- "ReleaseLookupGet",
+ "GetWork",
);
let api_clone = api.clone();
- router.post(
- "/v0/release",
+ router.get(
+ "/v0/container/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1956,78 +2025,56 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // 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.
-
- 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_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
-
- 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_entity
- } else {
- None
- };
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+ // 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_issnl = query_params
+ .get("issnl")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter issnl".to_string())))?
+ .first()
+ .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter issnl was empty".to_string())))?
+ .parse::<String>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter issnl - doesn't match schema: {}", e))))?;
- match api.release_post(param_entity, context).wait() {
+ match api.lookup_container(param_issnl, context).wait() {
Ok(rsp) => match rsp {
- ReleasePostResponse::CreatedEntity(body) => {
+ LookupContainerResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_CREATED_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CONTAINER_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ReleasePostResponse::BadRequest(body) => {
+ LookupContainerResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CONTAINER_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ReleasePostResponse::NotFound(body) => {
+ LookupContainerResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CONTAINER_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ReleasePostResponse::GenericError(body) => {
+ LookupContainerResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CONTAINER_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -2044,12 +2091,12 @@ where
Ok(response)
})
},
- "ReleasePost",
+ "LookupContainer",
);
let api_clone = api.clone();
- router.post(
- "/v0/work/batch",
+ router.get(
+ "/v0/creator/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2062,78 +2109,56 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // 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.
-
- let param_entity_list = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
-
- let mut unused_elements = Vec::new();
-
- let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
-
- let param_entity_list: Option<Vec<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_list - doesn't match schema: {}", e))))?;
-
- param_entity_list
- } else {
- None
- };
- let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
+ // 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_orcid = query_params
+ .get("orcid")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter orcid".to_string())))?
+ .first()
+ .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter orcid was empty".to_string())))?
+ .parse::<String>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter orcid - doesn't match schema: {}", e))))?;
- match api.work_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.lookup_creator(param_orcid, context).wait() {
Ok(rsp) => match rsp {
- WorkBatchPostResponse::CreatedEntities(body) => {
+ LookupCreatorResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_BATCH_POST_CREATED_ENTITIES.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CREATOR_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- WorkBatchPostResponse::BadRequest(body) => {
+ LookupCreatorResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_BATCH_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CREATOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- WorkBatchPostResponse::NotFound(body) => {
+ LookupCreatorResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_BATCH_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CREATOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- WorkBatchPostResponse::GenericError(body) => {
+ LookupCreatorResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_BATCH_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CREATOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -2150,12 +2175,12 @@ where
Ok(response)
})
},
- "WorkBatchPost",
+ "LookupCreator",
);
let api_clone = api.clone();
router.get(
- "/v0/work/:id",
+ "/v0/file/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2168,57 +2193,53 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // Path parameters
- let param_id = {
- let param = req.extensions
- .get::<Router>()
- .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
- .find("id")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
- percent_decode(param.as_bytes())
- .decode_utf8()
- .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
- .parse()
- .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_sha1 = query_params
+ .get("sha1")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter sha1".to_string())))?
+ .first()
+ .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter sha1 was empty".to_string())))?
+ .parse::<String>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter sha1 - doesn't match schema: {}", e))))?;
- match api.work_id_get(param_id, context).wait() {
+ match api.lookup_file(param_sha1, context).wait() {
Ok(rsp) => match rsp {
- WorkIdGetResponse::FoundEntity(body) => {
+ LookupFileResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_FILE_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- WorkIdGetResponse::BadRequest(body) => {
+ LookupFileResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_FILE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- WorkIdGetResponse::NotFound(body) => {
+ LookupFileResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_FILE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- WorkIdGetResponse::GenericError(body) => {
+ LookupFileResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_FILE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2238,12 +2259,12 @@ where
Ok(response)
})
},
- "WorkIdGet",
+ "LookupFile",
);
let api_clone = api.clone();
- router.post(
- "/v0/work",
+ router.get(
+ "/v0/release/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2256,78 +2277,56 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // 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.
-
- 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_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
-
- 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_entity
- } else {
- None
- };
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+ // 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_doi = query_params
+ .get("doi")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter doi".to_string())))?
+ .first()
+ .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter doi was empty".to_string())))?
+ .parse::<String>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter doi - doesn't match schema: {}", e))))?;
- match api.work_post(param_entity, context).wait() {
+ match api.lookup_release(param_doi, context).wait() {
Ok(rsp) => match rsp {
- WorkPostResponse::CreatedEntity(body) => {
+ LookupReleaseResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_POST_CREATED_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- WorkPostResponse::BadRequest(body) => {
+ LookupReleaseResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- WorkPostResponse::NotFound(body) => {
+ LookupReleaseResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- WorkPostResponse::GenericError(body) => {
+ LookupReleaseResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -2344,7 +2343,7 @@ where
Ok(response)
})
},
- "WorkPost",
+ "LookupRelease",
);
}