summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-openapi/src/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-openapi/src/client.rs')
-rw-r--r--rust/fatcat-openapi/src/client.rs1210
1 files changed, 605 insertions, 605 deletions
diff --git a/rust/fatcat-openapi/src/client.rs b/rust/fatcat-openapi/src/client.rs
index 378c546f..65bf67a5 100644
--- a/rust/fatcat-openapi/src/client.rs
+++ b/rust/fatcat-openapi/src/client.rs
@@ -173,6 +173,298 @@ impl Client {
}
impl Api for Client {
+ fn auth_check(&self, param_role: Option<String>, context: &Context) -> Box<Future<Item = AuthCheckResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_role = param_role.map_or_else(String::new, |query| format!("role={role}&", role = query.to_string()));
+
+ let url = format!("{}/v0/auth/check?{role}", self.base_path, role = utf8_percent_encode(&query_role, QUERY_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();
+
+ 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<AuthCheckResponse, 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(AuthCheckResponse::Success(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(AuthCheckResponse::BadRequest(body))
+ }
+ 401 => {
+ let mut buf = String::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)?;
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ let response_www_authenticate = response
+ .headers
+ .get::<ResponseWwwAuthenticate>()
+ .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
+
+ Ok(AuthCheckResponse::NotAuthorized {
+ body: body,
+ www_authenticate: response_www_authenticate.0.clone(),
+ })
+ }
+ 403 => {
+ let mut buf = String::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(AuthCheckResponse::Forbidden(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(AuthCheckResponse::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 auth_oidc(&self, param_oidc_params: models::AuthOidc, context: &Context) -> Box<Future<Item = AuthOidcResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/auth/oidc", self.base_path);
+
+ let body = serde_json::to_string(&param_oidc_params).expect("impossible to fail to serialize");
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::AUTH_OIDC.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<AuthOidcResponse, 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::AuthOidcResult>(&buf)?;
+
+ Ok(AuthOidcResponse::Found(body))
+ }
+ 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::AuthOidcResult>(&buf)?;
+
+ Ok(AuthOidcResponse::Created(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(AuthOidcResponse::BadRequest(body))
+ }
+ 401 => {
+ let mut buf = String::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)?;
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ let response_www_authenticate = response
+ .headers
+ .get::<ResponseWwwAuthenticate>()
+ .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
+
+ Ok(AuthOidcResponse::NotAuthorized {
+ body: body,
+ www_authenticate: response_www_authenticate.0.clone(),
+ })
+ }
+ 403 => {
+ let mut buf = String::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(AuthOidcResponse::Forbidden(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(AuthOidcResponse::Conflict(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(AuthOidcResponse::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_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));
+
+ let hyper_client = (self.hyper_client)();
+ 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())));
+
+ 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> {
+ 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))
+ }
+ 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(GetChangelogResponse::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(GetChangelogResponse::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_changelog_entry(&self, param_index: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/changelog/{index}",
+ self.base_path,
+ index = utf8_percent_encode(&param_index.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();
+
+ 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<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::<models::ChangelogEntry>(&buf)?;
+
+ Ok(GetChangelogEntryResponse::FoundChangelogEntry(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(GetChangelogEntryResponse::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(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(GetChangelogEntryResponse::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_editgroup_id: String, param_entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
let url = format!(
"{}/v0/editgroup/{editgroup_id}/container",
@@ -1985,14 +2277,15 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn auth_check(&self, param_role: Option<String>, context: &Context) -> Box<Future<Item = AuthCheckResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_role = param_role.map_or_else(String::new, |query| format!("role={role}&", role = query.to_string()));
-
- let url = format!("{}/v0/auth/check?{role}", self.base_path, role = utf8_percent_encode(&query_role, QUERY_ENCODE_SET));
+ fn accept_editgroup(&self, param_editgroup_id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/editgroup/{editgroup_id}/accept",
+ self.base_path,
+ editgroup_id = utf8_percent_encode(&param_editgroup_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())));
@@ -2000,21 +2293,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<AuthCheckResponse, 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::Success>(&buf)?;
- Ok(AuthCheckResponse::Success(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(AuthCheckResponse::BadRequest(body))
+ Ok(AcceptEditgroupResponse::BadRequest(body))
}
401 => {
let mut buf = String::new();
@@ -2026,7 +2319,7 @@ impl Api for Client {
.get::<ResponseWwwAuthenticate>()
.ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
- Ok(AuthCheckResponse::NotAuthorized {
+ Ok(AcceptEditgroupResponse::NotAuthorized {
body: body,
www_authenticate: response_www_authenticate.0.clone(),
})
@@ -2036,14 +2329,28 @@ impl Api for Client {
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(AuthCheckResponse::Forbidden(body))
+ Ok(AcceptEditgroupResponse::Forbidden(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(AuthCheckResponse::GenericError(body))
+ Ok(AcceptEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2063,10 +2370,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn auth_oidc(&self, param_oidc_params: models::AuthOidc, context: &Context) -> Box<Future<Item = AuthOidcResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/auth/oidc", self.base_path);
+ 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 body = serde_json::to_string(&param_oidc_params).expect("impossible to fail to serialize");
+ 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::Post, &url);
@@ -2074,34 +2381,27 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::AUTH_OIDC.clone()));
+ 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<AuthOidcResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateEditgroupResponse, 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::AuthOidcResult>(&buf)?;
-
- Ok(AuthOidcResponse::Found(body))
- }
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::AuthOidcResult>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(AuthOidcResponse::Created(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(AuthOidcResponse::BadRequest(body))
+ Ok(CreateEditgroupResponse::BadRequest(body))
}
401 => {
let mut buf = String::new();
@@ -2113,7 +2413,7 @@ impl Api for Client {
.get::<ResponseWwwAuthenticate>()
.ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
- Ok(AuthOidcResponse::NotAuthorized {
+ Ok(CreateEditgroupResponse::NotAuthorized {
body: body,
www_authenticate: response_www_authenticate.0.clone(),
})
@@ -2123,21 +2423,21 @@ impl Api for Client {
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(AuthOidcResponse::Forbidden(body))
+ Ok(CreateEditgroupResponse::Forbidden(body))
}
- 409 => {
+ 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(AuthOidcResponse::Conflict(body))
+ Ok(CreateEditgroupResponse::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(AuthOidcResponse::GenericError(body))
+ Ok(CreateEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2157,131 +2457,83 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editgroups_reviewable(
+ fn create_editgroup_annotation(
&self,
- param_expand: Option<String>,
- param_limit: Option<i64>,
- param_before: Option<chrono::DateTime<chrono::Utc>>,
- param_since: Option<chrono::DateTime<chrono::Utc>>,
+ param_editgroup_id: String,
+ param_annotation: models::EditgroupAnnotation,
context: &Context,
- ) -> Box<Future<Item = GetEditgroupsReviewableResponse, 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 query_before = param_before.map_or_else(String::new, |query| format!("before={before}&", before = query.to_string()));
- let query_since = param_since.map_or_else(String::new, |query| format!("since={since}&", since = query.to_string()));
-
+ ) -> Box<Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send> {
let url = format!(
- "{}/v0/editgroup/reviewable?{expand}{limit}{before}{since}",
+ "{}/v0/editgroup/{editgroup_id}/annotation",
self.base_path,
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET),
- before = utf8_percent_encode(&query_before, QUERY_ENCODE_SET),
- since = utf8_percent_encode(&query_since, QUERY_ENCODE_SET)
+ editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET)
);
+ let body = serde_json::to_string(&param_annotation).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_ANNOTATION.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<GetEditgroupsReviewableResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateEditgroupAnnotationResponse, 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::Editgroup>>(&buf)?;
+ let body = serde_json::from_str::<models::EditgroupAnnotation>(&buf)?;
- Ok(GetEditgroupsReviewableResponse::Found(body))
+ Ok(CreateEditgroupAnnotationResponse::Created(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(GetEditgroupsReviewableResponse::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(GetEditgroupsReviewableResponse::NotFound(body))
+ Ok(CreateEditgroupAnnotationResponse::BadRequest(body))
}
- 500 => {
+ 401 => {
let mut buf = String::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)?;
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ let response_www_authenticate = response
+ .headers
+ .get::<ResponseWwwAuthenticate>()
+ .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
- Ok(GetEditgroupsReviewableResponse::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_editor(&self, param_editor_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
- let url = format!(
- "{}/v0/editor/{editor_id}",
- self.base_path,
- editor_id = utf8_percent_encode(&param_editor_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();
-
- 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> {
- match response.status.to_u16() {
- 200 => {
- let mut buf = String::new();
- response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::Editor>(&buf)?;
-
- Ok(GetEditorResponse::Found(body))
+ Ok(CreateEditgroupAnnotationResponse::NotAuthorized {
+ body: body,
+ www_authenticate: response_www_authenticate.0.clone(),
+ })
}
- 400 => {
+ 403 => {
let mut buf = String::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(CreateEditgroupAnnotationResponse::Forbidden(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(CreateEditgroupAnnotationResponse::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(CreateEditgroupAnnotationResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2301,26 +2553,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editor_editgroups(
- &self,
- param_editor_id: String,
- param_limit: Option<i64>,
- param_before: Option<chrono::DateTime<chrono::Utc>>,
- param_since: Option<chrono::DateTime<chrono::Utc>>,
- context: &Context,
- ) -> Box<Future<Item = GetEditorEditgroupsResponse, 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_before = param_before.map_or_else(String::new, |query| format!("before={before}&", before = query.to_string()));
- let query_since = param_since.map_or_else(String::new, |query| format!("since={since}&", since = query.to_string()));
-
+ fn get_editgroup(&self, param_editgroup_id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
let url = format!(
- "{}/v0/editor/{editor_id}/editgroups?{limit}{before}{since}",
+ "{}/v0/editgroup/{editgroup_id}",
self.base_path,
- editor_id = utf8_percent_encode(&param_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET),
- before = utf8_percent_encode(&query_before, QUERY_ENCODE_SET),
- since = utf8_percent_encode(&query_since, QUERY_ENCODE_SET)
+ editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET)
);
let hyper_client = (self.hyper_client)();
@@ -2332,35 +2569,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<GetEditorEditgroupsResponse, 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::Editgroup>>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(GetEditorEditgroupsResponse::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(GetEditorEditgroupsResponse::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(GetEditorEditgroupsResponse::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(GetEditorEditgroupsResponse::GenericError(body))
+ Ok(GetEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2380,52 +2617,41 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_editgroup(
- &self,
- param_editgroup_id: String,
- param_editgroup: models::Editgroup,
- param_submit: Option<bool>,
- context: &Context,
- ) -> Box<Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send> {
+ fn get_editgroup_annotations(&self, param_editgroup_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send> {
// Query parameters
- let query_submit = param_submit.map_or_else(String::new, |query| format!("submit={submit}&", submit = 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/editgroup/{editgroup_id}?{submit}",
+ "{}/v0/editgroup/{editgroup_id}/annotations?{expand}",
self.base_path,
editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- submit = utf8_percent_encode(&query_submit, QUERY_ENCODE_SET)
+ expand = utf8_percent_encode(&query_expand, 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::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_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<UpdateEditgroupResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditgroupAnnotationsResponse, 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::Editgroup>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EditgroupAnnotation>>(&buf)?;
- Ok(UpdateEditgroupResponse::UpdatedEditgroup(body))
+ Ok(GetEditgroupAnnotationsResponse::Success(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(UpdateEditgroupResponse::BadRequest(body))
+ Ok(GetEditgroupAnnotationsResponse::BadRequest(body))
}
401 => {
let mut buf = String::new();
@@ -2437,7 +2663,7 @@ impl Api for Client {
.get::<ResponseWwwAuthenticate>()
.ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
- Ok(UpdateEditgroupResponse::NotAuthorized {
+ Ok(GetEditgroupAnnotationsResponse::NotAuthorized {
body: body,
www_authenticate: response_www_authenticate.0.clone(),
})
@@ -2447,21 +2673,21 @@ impl Api for Client {
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(UpdateEditgroupResponse::Forbidden(body))
+ Ok(GetEditgroupAnnotationsResponse::Forbidden(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(UpdateEditgroupResponse::NotFound(body))
+ Ok(GetEditgroupAnnotationsResponse::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(UpdateEditgroupResponse::GenericError(body))
+ Ok(GetEditgroupAnnotationsResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2481,78 +2707,67 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_editor(&self, param_editor_id: String, param_editor: models::Editor, context: &Context) -> Box<Future<Item = UpdateEditorResponse, Error = ApiError> + Send> {
+ fn get_editgroups_reviewable(
+ &self,
+ param_expand: Option<String>,
+ param_limit: Option<i64>,
+ param_before: Option<chrono::DateTime<chrono::Utc>>,
+ param_since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditgroupsReviewableResponse, 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 query_before = param_before.map_or_else(String::new, |query| format!("before={before}&", before = query.to_string()));
+ let query_since = param_since.map_or_else(String::new, |query| format!("since={since}&", since = query.to_string()));
+
let url = format!(
- "{}/v0/editor/{editor_id}",
+ "{}/v0/editgroup/reviewable?{expand}{limit}{before}{since}",
self.base_path,
- editor_id = utf8_percent_encode(&param_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET),
+ before = utf8_percent_encode(&query_before, QUERY_ENCODE_SET),
+ since = utf8_percent_encode(&query_since, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_editor).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_EDITOR.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<UpdateEditorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditgroupsReviewableResponse, ApiError> {
match response.status.to_u16() {
200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::Editor>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::Editgroup>>(&buf)?;
- Ok(UpdateEditorResponse::UpdatedEditor(body))
+ Ok(GetEditgroupsReviewableResponse::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(UpdateEditorResponse::BadRequest(body))
- }
- 401 => {
- let mut buf = String::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)?;
- header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
- let response_www_authenticate = response
- .headers
- .get::<ResponseWwwAuthenticate>()
- .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
-
- Ok(UpdateEditorResponse::NotAuthorized {
- body: body,
- www_authenticate: response_www_authenticate.0.clone(),
- })
- }
- 403 => {
- let mut buf = String::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(UpdateEditorResponse::Forbidden(body))
+ Ok(GetEditgroupsReviewableResponse::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(UpdateEditorResponse::NotFound(body))
+ Ok(GetEditgroupsReviewableResponse::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(UpdateEditorResponse::GenericError(body))
+ Ok(GetEditgroupsReviewableResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2572,37 +2787,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn accept_editgroup(&self, param_editgroup_id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
+ fn update_editgroup(
+ &self,
+ param_editgroup_id: String,
+ param_editgroup: models::Editgroup,
+ param_submit: Option<bool>,
+ context: &Context,
+ ) -> Box<Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_submit = param_submit.map_or_else(String::new, |query| format!("submit={submit}&", submit = query.to_string()));
+
let url = format!(
- "{}/v0/editgroup/{editgroup_id}/accept",
+ "{}/v0/editgroup/{editgroup_id}?{submit}",
self.base_path,
- editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ submit = utf8_percent_encode(&query_submit, 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::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::UPDATE_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<AcceptEditgroupResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateEditgroupResponse, 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)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(AcceptEditgroupResponse::MergedSuccessfully(body))
+ Ok(UpdateEditgroupResponse::UpdatedEditgroup(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))
+ Ok(UpdateEditgroupResponse::BadRequest(body))
}
401 => {
let mut buf = String::new();
@@ -2614,7 +2844,7 @@ impl Api for Client {
.get::<ResponseWwwAuthenticate>()
.ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
- Ok(AcceptEditgroupResponse::NotAuthorized {
+ Ok(UpdateEditgroupResponse::NotAuthorized {
body: body,
www_authenticate: response_www_authenticate.0.clone(),
})
@@ -2624,28 +2854,21 @@ impl Api for Client {
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::Forbidden(body))
+ Ok(UpdateEditgroupResponse::Forbidden(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))
+ Ok(UpdateEditgroupResponse::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(AcceptEditgroupResponse::GenericError(body))
+ Ok(UpdateEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2665,74 +2888,51 @@ impl Api for Client {
Box::new(futures::done(result))
}
- 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 body = serde_json::to_string(&param_editgroup).expect("impossible to fail to serialize");
+ fn get_editor(&self, param_editor_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/editor/{editor_id}",
+ self.base_path,
+ editor_id = utf8_percent_encode(&param_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::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<GetEditorResponse, 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::<models::Editor>(&buf)?;
- Ok(CreateEditgroupResponse::SuccessfullyCreated(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(CreateEditgroupResponse::BadRequest(body))
- }
- 401 => {
- let mut buf = String::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)?;
- header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
- let response_www_authenticate = response
- .headers
- .get::<ResponseWwwAuthenticate>()
- .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
-
- Ok(CreateEditgroupResponse::NotAuthorized {
- body: body,
- www_authenticate: response_www_authenticate.0.clone(),
- })
- }
- 403 => {
- let mut buf = String::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::Forbidden(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(CreateEditgroupResponse::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(CreateEditgroupResponse::GenericError(body))
+ Ok(GetEditorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2752,47 +2952,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_editgroup_annotation(
+ fn get_editor_annotations(
&self,
- param_editgroup_id: String,
- param_annotation: models::EditgroupAnnotation,
+ param_editor_id: String,
+ param_limit: Option<i64>,
+ param_before: Option<chrono::DateTime<chrono::Utc>>,
+ param_since: Option<chrono::DateTime<chrono::Utc>>,
context: &Context,
- ) -> Box<Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = GetEditorAnnotationsResponse, 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_before = param_before.map_or_else(String::new, |query| format!("before={before}&", before = query.to_string()));
+ let query_since = param_since.map_or_else(String::new, |query| format!("since={since}&", since = query.to_string()));
+
let url = format!(
- "{}/v0/editgroup/{editgroup_id}/annotation",
+ "{}/v0/editor/{editor_id}/annotations?{limit}{before}{since}",
self.base_path,
- editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ editor_id = utf8_percent_encode(&param_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET),
+ before = utf8_percent_encode(&query_before, QUERY_ENCODE_SET),
+ since = utf8_percent_encode(&query_since, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_annotation).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_EDITGROUP_ANNOTATION.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<CreateEditgroupAnnotationResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorAnnotationsResponse, 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::EditgroupAnnotation>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EditgroupAnnotation>>(&buf)?;
- Ok(CreateEditgroupAnnotationResponse::Created(body))
+ Ok(GetEditorAnnotationsResponse::Success(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(CreateEditgroupAnnotationResponse::BadRequest(body))
+ Ok(GetEditorAnnotationsResponse::BadRequest(body))
}
401 => {
let mut buf = String::new();
@@ -2804,7 +3009,7 @@ impl Api for Client {
.get::<ResponseWwwAuthenticate>()
.ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
- Ok(CreateEditgroupAnnotationResponse::NotAuthorized {
+ Ok(GetEditorAnnotationsResponse::NotAuthorized {
body: body,
www_authenticate: response_www_authenticate.0.clone(),
})
@@ -2814,21 +3019,21 @@ impl Api for Client {
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(CreateEditgroupAnnotationResponse::Forbidden(body))
+ Ok(GetEditorAnnotationsResponse::Forbidden(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(CreateEditgroupAnnotationResponse::NotFound(body))
+ Ok(GetEditorAnnotationsResponse::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(CreateEditgroupAnnotationResponse::GenericError(body))
+ Ok(GetEditorAnnotationsResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2848,67 +3053,26 @@ 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> {
+ fn get_editor_editgroups(
+ &self,
+ param_editor_id: String,
+ param_limit: Option<i64>,
+ param_before: Option<chrono::DateTime<chrono::Utc>>,
+ param_since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditorEditgroupsResponse, 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_before = param_before.map_or_else(String::new, |query| format!("before={before}&", before = query.to_string()));
+ let query_since = param_since.map_or_else(String::new, |query| format!("since={since}&", since = query.to_string()));
- 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);
- 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<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::<Vec<models::ChangelogEntry>>(&buf)?;
-
- Ok(GetChangelogResponse::Success(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(GetChangelogResponse::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(GetChangelogResponse::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_changelog_entry(&self, param_index: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
let url = format!(
- "{}/v0/changelog/{index}",
+ "{}/v0/editor/{editor_id}/editgroups?{limit}{before}{since}",
self.base_path,
- index = utf8_percent_encode(&param_index.to_string(), PATH_SEGMENT_ENCODE_SET)
+ editor_id = utf8_percent_encode(&param_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET),
+ before = utf8_percent_encode(&query_before, QUERY_ENCODE_SET),
+ since = utf8_percent_encode(&query_since, QUERY_ENCODE_SET)
);
let hyper_client = (self.hyper_client)();
@@ -2920,35 +3084,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<GetChangelogEntryResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorEditgroupsResponse, 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)?;
+ let body = serde_json::from_str::<Vec<models::Editgroup>>(&buf)?;
- Ok(GetChangelogEntryResponse::FoundChangelogEntry(body))
+ Ok(GetEditorEditgroupsResponse::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(GetChangelogEntryResponse::BadRequest(body))
+ Ok(GetEditorEditgroupsResponse::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(GetChangelogEntryResponse::NotFound(body))
+ Ok(GetEditorEditgroupsResponse::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(GetChangelogEntryResponse::GenericError(body))
+ Ok(GetEditorEditgroupsResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2968,206 +3132,42 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editgroup(&self, param_editgroup_id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
+ fn update_editor(&self, param_editor_id: String, param_editor: models::Editor, context: &Context) -> Box<Future<Item = UpdateEditorResponse, Error = ApiError> + Send> {
let url = format!(
- "{}/v0/editgroup/{editgroup_id}",
+ "{}/v0/editor/{editor_id}",
self.base_path,
- editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ editor_id = utf8_percent_encode(&param_editor_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();
-
- 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> {
- 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::Editgroup>(&buf)?;
-
- 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(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(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(GetEditgroupResponse::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_editgroup_annotations(&self, param_editgroup_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetEditgroupAnnotationsResponse, 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/editgroup/{editgroup_id}/annotations?{expand}",
- self.base_path,
- editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
- );
+ let body = serde_json::to_string(&param_editor).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();
- 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<GetEditgroupAnnotationsResponse, 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::EditgroupAnnotation>>(&buf)?;
-
- Ok(GetEditgroupAnnotationsResponse::Success(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(GetEditgroupAnnotationsResponse::BadRequest(body))
- }
- 401 => {
- let mut buf = String::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)?;
- header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
- let response_www_authenticate = response
- .headers
- .get::<ResponseWwwAuthenticate>()
- .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
-
- Ok(GetEditgroupAnnotationsResponse::NotAuthorized {
- body: body,
- www_authenticate: response_www_authenticate.0.clone(),
- })
- }
- 403 => {
- let mut buf = String::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(GetEditgroupAnnotationsResponse::Forbidden(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(GetEditgroupAnnotationsResponse::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(GetEditgroupAnnotationsResponse::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_editor_annotations(
- &self,
- param_editor_id: String,
- param_limit: Option<i64>,
- param_before: Option<chrono::DateTime<chrono::Utc>>,
- param_since: Option<chrono::DateTime<chrono::Utc>>,
- context: &Context,
- ) -> Box<Future<Item = GetEditorAnnotationsResponse, 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_before = param_before.map_or_else(String::new, |query| format!("before={before}&", before = query.to_string()));
- let query_since = param_since.map_or_else(String::new, |query| format!("since={since}&", since = query.to_string()));
-
- let url = format!(
- "{}/v0/editor/{editor_id}/annotations?{limit}{before}{since}",
- self.base_path,
- editor_id = utf8_percent_encode(&param_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET),
- before = utf8_percent_encode(&query_before, QUERY_ENCODE_SET),
- since = utf8_percent_encode(&query_since, QUERY_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();
+ let request = request.body(&body);
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_EDITOR.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<GetEditorAnnotationsResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateEditorResponse, 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::EditgroupAnnotation>>(&buf)?;
+ let body = serde_json::from_str::<models::Editor>(&buf)?;
- Ok(GetEditorAnnotationsResponse::Success(body))
+ Ok(UpdateEditorResponse::UpdatedEditor(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(GetEditorAnnotationsResponse::BadRequest(body))
+ Ok(UpdateEditorResponse::BadRequest(body))
}
401 => {
let mut buf = String::new();
@@ -3179,7 +3179,7 @@ impl Api for Client {
.get::<ResponseWwwAuthenticate>()
.ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
- Ok(GetEditorAnnotationsResponse::NotAuthorized {
+ Ok(UpdateEditorResponse::NotAuthorized {
body: body,
www_authenticate: response_www_authenticate.0.clone(),
})
@@ -3189,21 +3189,21 @@ impl Api for Client {
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(GetEditorAnnotationsResponse::Forbidden(body))
+ Ok(UpdateEditorResponse::Forbidden(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(GetEditorAnnotationsResponse::NotFound(body))
+ Ok(UpdateEditorResponse::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(GetEditorAnnotationsResponse::GenericError(body))
+ Ok(UpdateEditorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -5062,97 +5062,6 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_work(&self, param_editgroup_id: String, param_entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
- let url = format!(
- "{}/v0/editgroup/{editgroup_id}/work",
- self.base_path,
- editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_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::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<CreateWorkResponse, ApiError> {
- match response.status.to_u16() {
- 201 => {
- let mut buf = String::new();
- response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
-
- 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(CreateWorkResponse::BadRequest(body))
- }
- 401 => {
- let mut buf = String::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)?;
- header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
- let response_www_authenticate = response
- .headers
- .get::<ResponseWwwAuthenticate>()
- .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
-
- Ok(CreateWorkResponse::NotAuthorized {
- body: body,
- www_authenticate: response_www_authenticate.0.clone(),
- })
- }
- 403 => {
- let mut buf = String::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::Forbidden(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))
- }
- 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))
- }
- 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 delete_release(&self, param_editgroup_id: String, param_ident: String, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
let url = format!(
"{}/v0/editgroup/{editgroup_id}/release/{ident}",
@@ -6867,6 +6776,97 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn create_work(&self, param_editgroup_id: String, param_entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/editgroup/{editgroup_id}/work",
+ self.base_path,
+ editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_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::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<CreateWorkResponse, ApiError> {
+ match response.status.to_u16() {
+ 201 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
+
+ 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(CreateWorkResponse::BadRequest(body))
+ }
+ 401 => {
+ let mut buf = String::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)?;
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ let response_www_authenticate = response
+ .headers
+ .get::<ResponseWwwAuthenticate>()
+ .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
+
+ Ok(CreateWorkResponse::NotAuthorized {
+ body: body,
+ www_authenticate: response_www_authenticate.0.clone(),
+ })
+ }
+ 403 => {
+ let mut buf = String::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::Forbidden(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))
+ }
+ 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))
+ }
+ 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_work_auto_batch(&self, param_auto_batch: models::WorkAutoBatch, context: &Context) -> Box<Future<Item = CreateWorkAutoBatchResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/editgroup/auto/work/batch", self.base_path);