summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api-spec/src/client.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-22 17:25:57 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-22 17:25:57 -0700
commite9d7d73339df14ef2fe35815e693f0dbd7d1d244 (patch)
tree78140de79fbc0c3ace5d65808cba251219d438f3 /rust/fatcat-api-spec/src/client.rs
parent3b30465c2faa0b73ac2973f868105caad1a8e745 (diff)
downloadfatcat-e9d7d73339df14ef2fe35815e693f0dbd7d1d244.tar.gz
fatcat-e9d7d73339df14ef2fe35815e693f0dbd7d1d244.zip
codegen fatcat-api-spec
Diffstat (limited to 'rust/fatcat-api-spec/src/client.rs')
-rw-r--r--rust/fatcat-api-spec/src/client.rs1234
1 files changed, 617 insertions, 617 deletions
diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs
index c403515b..aa5feba3 100644
--- a/rust/fatcat-api-spec/src/client.rs
+++ b/rust/fatcat-api-spec/src/client.rs
@@ -166,73 +166,6 @@ impl Client {
}
impl Api for Client {
- fn accept_editgroup(&self, param_id: String, 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();
-
- 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<AcceptEditgroupResponse, 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::Success>(&buf)?;
-
- 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(AcceptEditgroupResponse::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(AcceptEditgroupResponse::NotFound(body))
- }
- 409 => {
- 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(AcceptEditgroupResponse::EditConflict(body))
- }
- 500 => {
- 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(AcceptEditgroupResponse::GenericError(body))
- }
- code => {
- let mut buf = [0; 100];
- let debug_body = match response.read(&mut buf) {
- Ok(len) => match str::from_utf8(&buf[..len]) {
- Ok(body) => Cow::from(body),
- Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
- },
- Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
- };
- Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
- }
- }
- }
-
- let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
- Box::new(futures::done(result))
- }
-
fn create_container(&self, param_entity: models::ContainerEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
@@ -381,55 +314,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_creator(&self, param_entity: models::CreatorEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ fn delete_container(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/creator?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
-
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let url = format!(
+ "{}/v0/container/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- 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<CreateCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteContainerResponse, 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)?;
- Ok(CreateCreatorResponse::CreatedEntity(body))
+ Ok(DeleteContainerResponse::DeletedEntity(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(CreateCreatorResponse::BadRequest(body))
+ Ok(DeleteContainerResponse::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(CreateCreatorResponse::NotFound(body))
+ Ok(DeleteContainerResponse::NotFound(body))
}
500 => {
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(CreateCreatorResponse::GenericError(body))
+ Ok(DeleteContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -449,67 +382,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_creator_batch(
- &self,
- param_entity_list: &Vec<models::CreatorEntity>,
- param_autoaccept: Option<bool>,
- param_editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
+ fn get_container(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
// Query parameters
- let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
let url = format!(
- "{}/v0/creator/batch?{autoaccept}{editgroup}",
+ "{}/v0/container/{id}?{expand}",
self.base_path,
- autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, 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::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::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<CreateCreatorBatchResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetContainerResponse, 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::ContainerEntity>(&buf)?;
- Ok(CreateCreatorBatchResponse::CreatedEntities(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(CreateCreatorBatchResponse::BadRequest(body))
+ 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(CreateCreatorBatchResponse::NotFound(body))
+ Ok(GetContainerResponse::NotFound(body))
}
500 => {
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(CreateCreatorBatchResponse::GenericError(body))
+ Ok(GetContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -529,45 +450,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- 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);
+ fn get_container_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let url = format!(
+ "{}/v0/container/{id}/history?{limit}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, 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::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<CreateEditgroupResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetContainerHistoryResponse, 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::Editgroup>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityHistoryEntry>>(&buf)?;
- Ok(CreateEditgroupResponse::SuccessfullyCreated(body))
+ Ok(GetContainerHistoryResponse::FoundEntityHistory(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(CreateEditgroupResponse::BadRequest(body))
+ Ok(GetContainerHistoryResponse::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(GetContainerHistoryResponse::NotFound(body))
}
500 => {
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(CreateEditgroupResponse::GenericError(body))
+ Ok(GetContainerHistoryResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -587,55 +518,50 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_file(&self, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ fn lookup_container(&self, param_issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
// Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
-
- let url = format!("{}/v0/file?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+ let 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::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<CreateFileResponse, 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(CreateFileResponse::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(CreateFileResponse::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(CreateFileResponse::NotFound(body))
+ Ok(LookupContainerResponse::NotFound(body))
}
500 => {
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(CreateFileResponse::GenericError(body))
+ Ok(LookupContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -655,67 +581,66 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_file_batch(
+ fn update_container(
&self,
- param_entity_list: &Vec<models::FileEntity>,
- param_autoaccept: Option<bool>,
+ param_id: String,
+ param_entity: models::ContainerEntity,
param_editgroup: Option<String>,
context: &Context,
- ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
// Query parameters
- let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/file/batch?{autoaccept}{editgroup}",
+ "{}/v0/container/{id}?{editgroup}",
self.base_path,
- autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Put, &url);
let mut custom_headers = hyper::header::Headers::new();
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATE_FILE_BATCH.clone()));
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_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<CreateFileBatchResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateContainerResponse, 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::EntityEdit>(&buf)?;
- Ok(CreateFileBatchResponse::CreatedEntities(body))
+ Ok(UpdateContainerResponse::UpdatedEntity(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(CreateFileBatchResponse::BadRequest(body))
+ Ok(UpdateContainerResponse::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(CreateFileBatchResponse::NotFound(body))
+ Ok(UpdateContainerResponse::NotFound(body))
}
500 => {
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(CreateFileBatchResponse::GenericError(body))
+ Ok(UpdateContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -735,11 +660,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ fn create_creator(&self, param_entity: models::CreatorEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/release?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+ let url = format!("{}/v0/creator?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -749,41 +674,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE.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<CreateReleaseResponse, 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(CreateReleaseResponse::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(CreateReleaseResponse::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(CreateReleaseResponse::NotFound(body))
+ Ok(CreateCreatorResponse::NotFound(body))
}
500 => {
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(CreateReleaseResponse::GenericError(body))
+ Ok(CreateCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -803,19 +728,19 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_release_batch(
+ fn create_creator_batch(
&self,
- param_entity_list: &Vec<models::ReleaseEntity>,
+ param_entity_list: &Vec<models::CreatorEntity>,
param_autoaccept: Option<bool>,
param_editgroup: Option<String>,
context: &Context,
- ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
// Query parameters
let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/release/batch?{autoaccept}{editgroup}",
+ "{}/v0/creator/batch?{autoaccept}{editgroup}",
self.base_path,
autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
@@ -829,41 +754,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE_BATCH.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<CreateReleaseBatchResponse, 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(CreateReleaseBatchResponse::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(CreateReleaseBatchResponse::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(CreateReleaseBatchResponse::NotFound(body))
+ Ok(CreateCreatorBatchResponse::NotFound(body))
}
500 => {
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(CreateReleaseBatchResponse::GenericError(body))
+ Ok(CreateCreatorBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -883,55 +808,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_work(&self, param_entity: models::WorkEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ fn delete_creator(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/work?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
-
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let url = format!(
+ "{}/v0/creator/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- 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<CreateWorkResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteCreatorResponse, 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)?;
- Ok(CreateWorkResponse::CreatedEntity(body))
+ Ok(DeleteCreatorResponse::DeletedEntity(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(CreateWorkResponse::BadRequest(body))
+ Ok(DeleteCreatorResponse::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))
+ Ok(DeleteCreatorResponse::NotFound(body))
}
500 => {
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::GenericError(body))
+ Ok(DeleteCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -951,67 +876,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_work_batch(
- &self,
- param_entity_list: &Vec<models::WorkEntity>,
- param_autoaccept: Option<bool>,
- param_editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
+ fn get_creator(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
// Query parameters
- let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
let url = format!(
- "{}/v0/work/batch?{autoaccept}{editgroup}",
+ "{}/v0/creator/{id}?{expand}",
self.base_path,
- autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, 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::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::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<CreateWorkBatchResponse, 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(CreateWorkBatchResponse::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(CreateWorkBatchResponse::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(CreateWorkBatchResponse::NotFound(body))
+ Ok(GetCreatorResponse::NotFound(body))
}
500 => {
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(CreateWorkBatchResponse::GenericError(body))
+ Ok(GetCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1031,19 +944,19 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_container(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> {
+ fn get_creator_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> {
// Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
let url = format!(
- "{}/v0/container/{id}?{editgroup}",
+ "{}/v0/creator/{id}/history?{limit}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
);
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
@@ -1051,35 +964,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<DeleteContainerResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetCreatorHistoryResponse, 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::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityHistoryEntry>>(&buf)?;
- Ok(DeleteContainerResponse::DeletedEntity(body))
+ Ok(GetCreatorHistoryResponse::FoundEntityHistory(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(DeleteContainerResponse::BadRequest(body))
+ Ok(GetCreatorHistoryResponse::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(DeleteContainerResponse::NotFound(body))
+ Ok(GetCreatorHistoryResponse::NotFound(body))
}
500 => {
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(DeleteContainerResponse::GenericError(body))
+ Ok(GetCreatorHistoryResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1099,19 +1012,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_creator(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
-
- let url = format!(
- "{}/v0/creator/{id}?{editgroup}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
- );
+ fn get_creator_releases(&self, param_id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/creator/{id}/releases", 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::Delete, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
@@ -1119,35 +1024,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<DeleteCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetCreatorReleasesResponse, 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::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::ReleaseEntity>>(&buf)?;
- Ok(DeleteCreatorResponse::DeletedEntity(body))
+ Ok(GetCreatorReleasesResponse::Found(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(DeleteCreatorResponse::BadRequest(body))
+ Ok(GetCreatorReleasesResponse::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(DeleteCreatorResponse::NotFound(body))
+ Ok(GetCreatorReleasesResponse::NotFound(body))
}
500 => {
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(DeleteCreatorResponse::GenericError(body))
+ Ok(GetCreatorReleasesResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1167,19 +1072,14 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_file(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> {
+ fn lookup_creator(&self, param_orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
// Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.to_string());
- let url = format!(
- "{}/v0/file/{id}?{editgroup}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
- );
+ let 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::Delete, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
@@ -1187,35 +1087,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<DeleteFileResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupCreatorResponse, 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::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<models::CreatorEntity>(&buf)?;
- Ok(DeleteFileResponse::DeletedEntity(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(DeleteFileResponse::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(DeleteFileResponse::NotFound(body))
+ Ok(LookupCreatorResponse::NotFound(body))
}
500 => {
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(DeleteFileResponse::GenericError(body))
+ Ok(LookupCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1235,55 +1135,66 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_release(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
+ fn update_creator(
+ &self,
+ param_id: String,
+ param_entity: models::CreatorEntity,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/release/{id}?{editgroup}",
+ "{}/v0/creator/{id}?{editgroup}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ let request = hyper_client.request(hyper::method::Method::Put, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_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<DeleteReleaseResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateCreatorResponse, 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::EntityEdit>(&buf)?;
- Ok(DeleteReleaseResponse::DeletedEntity(body))
+ Ok(UpdateCreatorResponse::UpdatedEntity(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(DeleteReleaseResponse::BadRequest(body))
+ Ok(UpdateCreatorResponse::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(DeleteReleaseResponse::NotFound(body))
+ Ok(UpdateCreatorResponse::NotFound(body))
}
500 => {
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(DeleteReleaseResponse::GenericError(body))
+ Ok(UpdateCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1303,19 +1214,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_work(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
-
- let url = format!(
- "{}/v0/work/{id}?{editgroup}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
- );
+ fn get_editor(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editor/{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::Delete, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
@@ -1323,35 +1226,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<DeleteWorkResponse, 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::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<models::Editor>(&buf)?;
- Ok(DeleteWorkResponse::DeletedEntity(body))
+ Ok(GetEditorResponse::Found(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(DeleteWorkResponse::BadRequest(body))
+ Ok(GetEditorResponse::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(DeleteWorkResponse::NotFound(body))
+ Ok(GetEditorResponse::NotFound(body))
}
500 => {
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(DeleteWorkResponse::GenericError(body))
+ Ok(GetEditorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1371,11 +1274,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_changelog(&self, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
-
- let url = format!("{}/v0/changelog?{limit}", self.base_path, limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET));
+ fn get_editor_changelog(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editor/{id}/changelog", 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);
@@ -1386,21 +1286,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<GetChangelogResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorChangelogResponse, 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::<Vec<models::ChangelogEntry>>(&buf)?;
- Ok(GetChangelogResponse::Success(body))
+ Ok(GetEditorChangelogResponse::Found(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(GetEditorChangelogResponse::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(GetEditorChangelogResponse::NotFound(body))
}
500 => {
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(GetChangelogResponse::GenericError(body))
+ Ok(GetEditorChangelogResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1420,8 +1334,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_changelog_entry(&self, param_id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/changelog/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn get_stats(&self, param_more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_more = param_more.map_or_else(String::new, |query| format!("more={more}&", more = query.to_string()));
+
+ let url = format!("{}/v0/stats?{more}", self.base_path, more = utf8_percent_encode(&query_more, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -1432,28 +1349,21 @@ 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<GetChangelogEntryResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetStatsResponse, 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::ChangelogEntry>(&buf)?;
-
- Ok(GetChangelogEntryResponse::FoundChangelogEntry(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)?;
+ let body = serde_json::from_str::<models::StatsResponse>(&buf)?;
- Ok(GetChangelogEntryResponse::NotFound(body))
+ Ok(GetStatsResponse::Success(body))
}
500 => {
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(GetChangelogEntryResponse::GenericError(body))
+ Ok(GetStatsResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1473,19 +1383,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_container(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
-
- let url = format!(
- "{}/v0/container/{id}?{expand}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
- );
+ fn accept_editgroup(&self, param_id: String, 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::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
@@ -1493,35 +1395,42 @@ 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<GetContainerResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<AcceptEditgroupResponse, 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::ContainerEntity>(&buf)?;
+ let body = serde_json::from_str::<models::Success>(&buf)?;
- Ok(GetContainerResponse::FoundEntity(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(GetContainerResponse::BadRequest(body))
+ Ok(AcceptEditgroupResponse::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(GetContainerResponse::NotFound(body))
+ Ok(AcceptEditgroupResponse::NotFound(body))
+ }
+ 409 => {
+ 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(AcceptEditgroupResponse::EditConflict(body))
}
500 => {
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::GenericError(body))
+ Ok(AcceptEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1541,55 +1450,45 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_container_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
+ fn create_editgroup(&self, param_editgroup: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editgroup", self.base_path);
- let url = format!(
- "{}/v0/container/{id}/history?{limit}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
- );
+ let body = serde_json::to_string(&param_editgroup).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<GetContainerHistoryResponse, 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::<Vec<models::EntityHistoryEntry>>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(GetContainerHistoryResponse::FoundEntityHistory(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(GetContainerHistoryResponse::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(GetContainerHistoryResponse::NotFound(body))
+ Ok(CreateEditgroupResponse::BadRequest(body))
}
500 => {
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(GetContainerHistoryResponse::GenericError(body))
+ Ok(CreateEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1609,16 +1508,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_creator(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
+ fn get_changelog(&self, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
// Query parameters
- let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
- let url = format!(
- "{}/v0/creator/{id}?{expand}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
- );
+ let url = format!("{}/v0/changelog?{limit}", self.base_path, limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -1629,35 +1523,21 @@ 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<GetCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetChangelogResponse, 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::CreatorEntity>(&buf)?;
-
- 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(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)?;
+ let body = serde_json::from_str::<Vec<models::ChangelogEntry>>(&buf)?;
- Ok(GetCreatorResponse::NotFound(body))
+ Ok(GetChangelogResponse::Success(body))
}
500 => {
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(GetCreatorResponse::GenericError(body))
+ Ok(GetChangelogResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1677,16 +1557,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_creator_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
-
- let url = format!(
- "{}/v0/creator/{id}/history?{limit}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
- );
+ fn get_changelog_entry(&self, param_id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/changelog/{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);
@@ -1697,35 +1569,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<GetCreatorHistoryResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetChangelogEntryResponse, 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::<Vec<models::EntityHistoryEntry>>(&buf)?;
-
- Ok(GetCreatorHistoryResponse::FoundEntityHistory(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::ChangelogEntry>(&buf)?;
- Ok(GetCreatorHistoryResponse::BadRequest(body))
+ Ok(GetChangelogEntryResponse::FoundChangelogEntry(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(GetCreatorHistoryResponse::NotFound(body))
+ Ok(GetChangelogEntryResponse::NotFound(body))
}
500 => {
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(GetCreatorHistoryResponse::GenericError(body))
+ Ok(GetChangelogEntryResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1745,8 +1610,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_creator_releases(&self, param_id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/creator/{id}/releases", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn get_editgroup(&self, param_id: String, 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);
@@ -1757,35 +1622,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<GetCreatorReleasesResponse, 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::<Vec<models::ReleaseEntity>>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(GetCreatorReleasesResponse::Found(body))
+ Ok(GetEditgroupResponse::Found(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(GetCreatorReleasesResponse::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(GetCreatorReleasesResponse::NotFound(body))
+ Ok(GetEditgroupResponse::NotFound(body))
}
500 => {
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(GetCreatorReleasesResponse::GenericError(body))
+ Ok(GetEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1805,47 +1670,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editgroup(&self, param_id: String, 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));
+ fn create_file(&self, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!("{}/v0/file?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
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<GetEditgroupResponse, 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::Editgroup>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetEditgroupResponse::Found(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(GetEditgroupResponse::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(GetEditgroupResponse::NotFound(body))
+ Ok(CreateFileResponse::NotFound(body))
}
500 => {
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(GetEditgroupResponse::GenericError(body))
+ Ok(CreateFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1865,47 +1738,67 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editor(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editor/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn create_file_batch(
+ &self,
+ param_entity_list: &Vec<models::FileEntity>,
+ param_autoaccept: Option<bool>,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/file/batch?{autoaccept}{editgroup}",
+ self.base_path,
+ autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, 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_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<GetEditorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateFileBatchResponse, 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::Editor>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(GetEditorResponse::Found(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(GetEditorResponse::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(GetEditorResponse::NotFound(body))
+ Ok(CreateFileBatchResponse::NotFound(body))
}
500 => {
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(GetEditorResponse::GenericError(body))
+ Ok(CreateFileBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1925,11 +1818,19 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editor_changelog(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editor/{id}/changelog", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn delete_file(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/file/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
let mut custom_headers = hyper::header::Headers::new();
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
@@ -1937,35 +1838,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<GetEditorChangelogResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteFileResponse, 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::<Vec<models::ChangelogEntry>>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetEditorChangelogResponse::Found(body))
+ Ok(DeleteFileResponse::DeletedEntity(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(GetEditorChangelogResponse::BadRequest(body))
+ Ok(DeleteFileResponse::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(GetEditorChangelogResponse::NotFound(body))
+ Ok(DeleteFileResponse::NotFound(body))
}
500 => {
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(GetEditorChangelogResponse::GenericError(body))
+ Ok(DeleteFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2121,16 +2022,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_release(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
+ fn lookup_file(&self, param_sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
// Query parameters
- let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
+ let query_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.to_string());
- let url = format!(
- "{}/v0/release/{id}?{expand}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
- );
+ 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);
@@ -2141,35 +2037,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<GetReleaseResponse, 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::ReleaseEntity>(&buf)?;
+ let body = serde_json::from_str::<models::FileEntity>(&buf)?;
- Ok(GetReleaseResponse::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(GetReleaseResponse::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(GetReleaseResponse::NotFound(body))
+ Ok(LookupFileResponse::NotFound(body))
}
500 => {
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(GetReleaseResponse::GenericError(body))
+ Ok(LookupFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2189,47 +2085,60 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_release_files(&self, param_id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/release/{id}/files", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn update_file(&self, param_id: String, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/file/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Put, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_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<GetReleaseFilesResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateFileResponse, 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::<Vec<models::FileEntity>>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetReleaseFilesResponse::Found(body))
+ Ok(UpdateFileResponse::UpdatedEntity(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(GetReleaseFilesResponse::BadRequest(body))
+ Ok(UpdateFileResponse::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(GetReleaseFilesResponse::NotFound(body))
+ Ok(UpdateFileResponse::NotFound(body))
}
500 => {
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(GetReleaseFilesResponse::GenericError(body))
+ Ok(UpdateFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2249,55 +2158,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_release_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> {
+ fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
// Query parameters
- let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!(
- "{}/v0/release/{id}/history?{limit}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
- );
+ let url = format!("{}/v0/release?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
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.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<GetReleaseHistoryResponse, 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::<Vec<models::EntityHistoryEntry>>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetReleaseHistoryResponse::FoundEntityHistory(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(GetReleaseHistoryResponse::BadRequest(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(GetReleaseHistoryResponse::NotFound(body))
+ Ok(CreateReleaseResponse::NotFound(body))
}
500 => {
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(GetReleaseHistoryResponse::GenericError(body))
+ Ok(CreateReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2317,36 +2226,67 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_stats(&self, param_more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
+ fn create_release_batch(
+ &self,
+ param_entity_list: &Vec<models::ReleaseEntity>,
+ param_autoaccept: Option<bool>,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
// Query parameters
- let query_more = param_more.map_or_else(String::new, |query| format!("more={more}&", more = query.to_string()));
+ let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/stats?{more}", self.base_path, more = utf8_percent_encode(&query_more, QUERY_ENCODE_SET));
+ let url = format!(
+ "{}/v0/release/batch?{autoaccept}{editgroup}",
+ self.base_path,
+ autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, 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_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<GetStatsResponse, 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::StatsResponse>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(GetStatsResponse::Success(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(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(CreateReleaseBatchResponse::NotFound(body))
}
500 => {
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(GetStatsResponse::GenericError(body))
+ Ok(CreateReleaseBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2366,55 +2306,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_work(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
+ fn create_work(&self, param_entity: models::WorkEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
// Query parameters
- let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!(
- "{}/v0/work/{id}?{expand}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
- );
+ let url = format!("{}/v0/work?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
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.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<GetWorkResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateWorkResponse, 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::WorkEntity>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetWorkResponse::FoundEntity(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(GetWorkResponse::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(GetWorkResponse::NotFound(body))
+ Ok(CreateWorkResponse::NotFound(body))
}
500 => {
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(GetWorkResponse::GenericError(body))
+ Ok(CreateWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2434,19 +2374,19 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_work_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> {
+ fn delete_release(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
// Query parameters
- let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/work/{id}/history?{limit}",
+ "{}/v0/release/{id}?{editgroup}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
let mut custom_headers = hyper::header::Headers::new();
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
@@ -2454,35 +2394,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<GetWorkHistoryResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteReleaseResponse, 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::<Vec<models::EntityHistoryEntry>>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetWorkHistoryResponse::FoundEntityHistory(body))
+ Ok(DeleteReleaseResponse::DeletedEntity(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(GetWorkHistoryResponse::BadRequest(body))
+ Ok(DeleteReleaseResponse::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(GetWorkHistoryResponse::NotFound(body))
+ Ok(DeleteReleaseResponse::NotFound(body))
}
500 => {
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(GetWorkHistoryResponse::GenericError(body))
+ Ok(DeleteReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2502,8 +2442,16 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_work_releases(&self, param_id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/work/{id}/releases", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn get_release(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
+
+ let url = format!(
+ "{}/v0/release/{id}?{expand}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -2514,35 +2462,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<GetWorkReleasesResponse, 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::<Vec<models::ReleaseEntity>>(&buf)?;
+ let body = serde_json::from_str::<models::ReleaseEntity>(&buf)?;
- Ok(GetWorkReleasesResponse::Found(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(GetWorkReleasesResponse::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(GetWorkReleasesResponse::NotFound(body))
+ Ok(GetReleaseResponse::NotFound(body))
}
500 => {
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(GetWorkReleasesResponse::GenericError(body))
+ Ok(GetReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2562,11 +2510,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- 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 url = format!("{}/v0/container/lookup?{issnl}", self.base_path, issnl = utf8_percent_encode(&query_issnl, QUERY_ENCODE_SET));
+ fn get_release_files(&self, param_id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/release/{id}/files", 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);
@@ -2577,35 +2522,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<LookupContainerResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetReleaseFilesResponse, 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::ContainerEntity>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::FileEntity>>(&buf)?;
- Ok(LookupContainerResponse::FoundEntity(body))
+ Ok(GetReleaseFilesResponse::Found(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(LookupContainerResponse::BadRequest(body))
+ Ok(GetReleaseFilesResponse::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(LookupContainerResponse::NotFound(body))
+ Ok(GetReleaseFilesResponse::NotFound(body))
}
500 => {
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(LookupContainerResponse::GenericError(body))
+ Ok(GetReleaseFilesResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2625,11 +2570,16 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_creator(&self, param_orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ fn get_release_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> {
// Query parameters
- let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.to_string());
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
- let url = format!("{}/v0/creator/lookup?{orcid}", self.base_path, orcid = utf8_percent_encode(&query_orcid, QUERY_ENCODE_SET));
+ let url = format!(
+ "{}/v0/release/{id}/history?{limit}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -2640,35 +2590,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<LookupCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetReleaseHistoryResponse, 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::CreatorEntity>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityHistoryEntry>>(&buf)?;
- Ok(LookupCreatorResponse::FoundEntity(body))
+ Ok(GetReleaseHistoryResponse::FoundEntityHistory(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(LookupCreatorResponse::BadRequest(body))
+ Ok(GetReleaseHistoryResponse::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(LookupCreatorResponse::NotFound(body))
+ Ok(GetReleaseHistoryResponse::NotFound(body))
}
500 => {
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(LookupCreatorResponse::GenericError(body))
+ Ok(GetReleaseHistoryResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2688,11 +2638,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_file(&self, param_sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ fn lookup_release(&self, param_doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
// Query parameters
- let query_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.to_string());
+ let query_doi = format!("doi={doi}&", doi = param_doi.to_string());
- let url = format!("{}/v0/file/lookup?{sha1}", self.base_path, sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET));
+ 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::Get, &url);
@@ -2703,35 +2653,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<LookupFileResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupReleaseResponse, 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::ReleaseEntity>(&buf)?;
- Ok(LookupFileResponse::FoundEntity(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(LookupFileResponse::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(LookupFileResponse::NotFound(body))
+ Ok(LookupReleaseResponse::NotFound(body))
}
500 => {
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(LookupFileResponse::GenericError(body))
+ Ok(LookupReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2751,50 +2701,66 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_release(&self, param_doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ fn update_release(
+ &self,
+ param_id: String,
+ param_entity: models::ReleaseEntity,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
// Query parameters
- let query_doi = format!("doi={doi}&", doi = param_doi.to_string());
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/release/lookup?{doi}", self.base_path, doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET));
+ let url = format!(
+ "{}/v0/release/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Put, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_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<LookupReleaseResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateReleaseResponse, 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::EntityEdit>(&buf)?;
- Ok(LookupReleaseResponse::FoundEntity(body))
+ Ok(UpdateReleaseResponse::UpdatedEntity(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(LookupReleaseResponse::BadRequest(body))
+ Ok(UpdateReleaseResponse::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(LookupReleaseResponse::NotFound(body))
+ Ok(UpdateReleaseResponse::NotFound(body))
}
500 => {
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(LookupReleaseResponse::GenericError(body))
+ Ok(UpdateReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2814,66 +2780,67 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_container(
+ fn create_work_batch(
&self,
- param_id: String,
- param_entity: models::ContainerEntity,
+ param_entity_list: &Vec<models::WorkEntity>,
+ param_autoaccept: Option<bool>,
param_editgroup: Option<String>,
context: &Context,
- ) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
// Query parameters
+ let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/container/{id}?{editgroup}",
+ "{}/v0/work/batch?{autoaccept}{editgroup}",
self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ 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::Put, &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::UPDATE_CONTAINER.clone()));
+ 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<UpdateContainerResponse, 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::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(UpdateContainerResponse::UpdatedEntity(body))
+ 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(UpdateContainerResponse::BadRequest(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(UpdateContainerResponse::NotFound(body))
+ Ok(CreateWorkBatchResponse::NotFound(body))
}
500 => {
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(UpdateContainerResponse::GenericError(body))
+ Ok(CreateWorkBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2893,66 +2860,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_creator(
- &self,
- param_id: String,
- param_entity: models::CreatorEntity,
- param_editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
+ fn delete_work(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/creator/{id}?{editgroup}",
+ "{}/v0/work/{id}?{editgroup}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
-
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Put, &url);
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::UPDATE_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<UpdateCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteWorkResponse, 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::EntityEdit>(&buf)?;
- Ok(UpdateCreatorResponse::UpdatedEntity(body))
+ Ok(DeleteWorkResponse::DeletedEntity(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(UpdateCreatorResponse::BadRequest(body))
+ Ok(DeleteWorkResponse::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(UpdateCreatorResponse::NotFound(body))
+ Ok(DeleteWorkResponse::NotFound(body))
}
500 => {
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(UpdateCreatorResponse::GenericError(body))
+ Ok(DeleteWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2972,60 +2928,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_file(&self, param_id: String, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
+ fn get_work(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
// Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
let url = format!(
- "{}/v0/file/{id}?{editgroup}",
+ "{}/v0/work/{id}?{expand}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ expand = utf8_percent_encode(&query_expand, 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::Put, &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::UPDATE_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<UpdateFileResponse, 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::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<models::WorkEntity>(&buf)?;
- Ok(UpdateFileResponse::UpdatedEntity(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(UpdateFileResponse::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(UpdateFileResponse::NotFound(body))
+ Ok(GetWorkResponse::NotFound(body))
}
500 => {
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(UpdateFileResponse::GenericError(body))
+ Ok(GetWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -3045,66 +2996,115 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_release(
- &self,
- param_id: String,
- param_entity: models::ReleaseEntity,
- param_editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
+ fn get_work_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> {
// Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
let url = format!(
- "{}/v0/release/{id}?{editgroup}",
+ "{}/v0/work/{id}/history?{limit}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ limit = utf8_percent_encode(&query_limit, 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::Put, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
+ 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<GetWorkHistoryResponse, 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::<Vec<models::EntityHistoryEntry>>(&buf)?;
+
+ Ok(GetWorkHistoryResponse::FoundEntityHistory(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(GetWorkHistoryResponse::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(GetWorkHistoryResponse::NotFound(body))
+ }
+ 500 => {
+ 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(GetWorkHistoryResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
+ fn get_work_releases(&self, param_id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/work/{id}/releases", 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);
+ let mut custom_headers = hyper::header::Headers::new();
- custom_headers.set(ContentType(mimetypes::requests::UPDATE_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<UpdateReleaseResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetWorkReleasesResponse, 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::EntityEdit>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::ReleaseEntity>>(&buf)?;
- Ok(UpdateReleaseResponse::UpdatedEntity(body))
+ Ok(GetWorkReleasesResponse::Found(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(UpdateReleaseResponse::BadRequest(body))
+ Ok(GetWorkReleasesResponse::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(UpdateReleaseResponse::NotFound(body))
+ Ok(GetWorkReleasesResponse::NotFound(body))
}
500 => {
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(UpdateReleaseResponse::GenericError(body))
+ Ok(GetWorkReleasesResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];