mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-13 21:19:05 +01:00
regen with patch #265, but without version bump
Let's try to avoid spamming crates.io and instead keep publishing everything as is. The patch will be present in some of the more recent crates, and for specific crates like youtube3 and drive3 I will create specific patch releases.
This commit is contained in:
@@ -1457,25 +1457,15 @@ impl<'a, C> ActionResultGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
let (res_parts, res_body) = res.into_parts();
|
||||
let res_body_string: String = String::from_utf8(
|
||||
hyper::body::to_bytes(res_body)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.unwrap();
|
||||
let reconstructed_result =
|
||||
hyper::Response::from_parts(res_parts, res_body_string.clone().into());
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
if !reconstructed_result.status().is_success() {
|
||||
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
||||
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
||||
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&reconstructed_result,
|
||||
if let client::Retry::After(d) = dlg.http_failure(&res,
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
@@ -1483,13 +1473,15 @@ impl<'a, C> ActionResultGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
|
||||
}
|
||||
dlg.finished(false);
|
||||
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
||||
Err(_) => Err(client::Error::Failure(reconstructed_result)),
|
||||
Err(_) => Err(client::Error::Failure(res)),
|
||||
Ok(serr) => Err(client::Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (reconstructed_result, decoded),
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
@@ -1796,25 +1788,15 @@ impl<'a, C> ActionResultUpdateCall<'a, C> where C: BorrowMut<hyper::Client<hyper
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
let (res_parts, res_body) = res.into_parts();
|
||||
let res_body_string: String = String::from_utf8(
|
||||
hyper::body::to_bytes(res_body)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.unwrap();
|
||||
let reconstructed_result =
|
||||
hyper::Response::from_parts(res_parts, res_body_string.clone().into());
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
if !reconstructed_result.status().is_success() {
|
||||
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
||||
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
||||
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&reconstructed_result,
|
||||
if let client::Retry::After(d) = dlg.http_failure(&res,
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
@@ -1822,13 +1804,15 @@ impl<'a, C> ActionResultUpdateCall<'a, C> where C: BorrowMut<hyper::Client<hyper
|
||||
}
|
||||
dlg.finished(false);
|
||||
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
||||
Err(_) => Err(client::Error::Failure(reconstructed_result)),
|
||||
Err(_) => Err(client::Error::Failure(res)),
|
||||
Ok(serr) => Err(client::Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (reconstructed_result, decoded),
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
@@ -2120,25 +2104,15 @@ impl<'a, C> ActionExecuteCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
let (res_parts, res_body) = res.into_parts();
|
||||
let res_body_string: String = String::from_utf8(
|
||||
hyper::body::to_bytes(res_body)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.unwrap();
|
||||
let reconstructed_result =
|
||||
hyper::Response::from_parts(res_parts, res_body_string.clone().into());
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
if !reconstructed_result.status().is_success() {
|
||||
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
||||
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
||||
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&reconstructed_result,
|
||||
if let client::Retry::After(d) = dlg.http_failure(&res,
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
@@ -2146,13 +2120,15 @@ impl<'a, C> ActionExecuteCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
|
||||
}
|
||||
dlg.finished(false);
|
||||
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
||||
Err(_) => Err(client::Error::Failure(reconstructed_result)),
|
||||
Err(_) => Err(client::Error::Failure(res)),
|
||||
Ok(serr) => Err(client::Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (reconstructed_result, decoded),
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
@@ -2417,25 +2393,15 @@ impl<'a, C> BlobBatchReadCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
let (res_parts, res_body) = res.into_parts();
|
||||
let res_body_string: String = String::from_utf8(
|
||||
hyper::body::to_bytes(res_body)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.unwrap();
|
||||
let reconstructed_result =
|
||||
hyper::Response::from_parts(res_parts, res_body_string.clone().into());
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
if !reconstructed_result.status().is_success() {
|
||||
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
||||
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
||||
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&reconstructed_result,
|
||||
if let client::Retry::After(d) = dlg.http_failure(&res,
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
@@ -2443,13 +2409,15 @@ impl<'a, C> BlobBatchReadCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
|
||||
}
|
||||
dlg.finished(false);
|
||||
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
||||
Err(_) => Err(client::Error::Failure(reconstructed_result)),
|
||||
Err(_) => Err(client::Error::Failure(res)),
|
||||
Ok(serr) => Err(client::Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (reconstructed_result, decoded),
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
@@ -2714,25 +2682,15 @@ impl<'a, C> BlobBatchUpdateCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
let (res_parts, res_body) = res.into_parts();
|
||||
let res_body_string: String = String::from_utf8(
|
||||
hyper::body::to_bytes(res_body)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.unwrap();
|
||||
let reconstructed_result =
|
||||
hyper::Response::from_parts(res_parts, res_body_string.clone().into());
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
if !reconstructed_result.status().is_success() {
|
||||
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
||||
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
||||
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&reconstructed_result,
|
||||
if let client::Retry::After(d) = dlg.http_failure(&res,
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
@@ -2740,13 +2698,15 @@ impl<'a, C> BlobBatchUpdateCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
|
||||
}
|
||||
dlg.finished(false);
|
||||
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
||||
Err(_) => Err(client::Error::Failure(reconstructed_result)),
|
||||
Err(_) => Err(client::Error::Failure(res)),
|
||||
Ok(serr) => Err(client::Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (reconstructed_result, decoded),
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
@@ -3011,25 +2971,15 @@ impl<'a, C> BlobFindMissingCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
let (res_parts, res_body) = res.into_parts();
|
||||
let res_body_string: String = String::from_utf8(
|
||||
hyper::body::to_bytes(res_body)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.unwrap();
|
||||
let reconstructed_result =
|
||||
hyper::Response::from_parts(res_parts, res_body_string.clone().into());
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
if !reconstructed_result.status().is_success() {
|
||||
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
||||
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
||||
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&reconstructed_result,
|
||||
if let client::Retry::After(d) = dlg.http_failure(&res,
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
@@ -3037,13 +2987,15 @@ impl<'a, C> BlobFindMissingCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
|
||||
}
|
||||
dlg.finished(false);
|
||||
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
||||
Err(_) => Err(client::Error::Failure(reconstructed_result)),
|
||||
Err(_) => Err(client::Error::Failure(res)),
|
||||
Ok(serr) => Err(client::Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (reconstructed_result, decoded),
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
@@ -3301,25 +3253,15 @@ impl<'a, C> BlobGetTreeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustls
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
let (res_parts, res_body) = res.into_parts();
|
||||
let res_body_string: String = String::from_utf8(
|
||||
hyper::body::to_bytes(res_body)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.unwrap();
|
||||
let reconstructed_result =
|
||||
hyper::Response::from_parts(res_parts, res_body_string.clone().into());
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
if !reconstructed_result.status().is_success() {
|
||||
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
||||
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
||||
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&reconstructed_result,
|
||||
if let client::Retry::After(d) = dlg.http_failure(&res,
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
@@ -3327,13 +3269,15 @@ impl<'a, C> BlobGetTreeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustls
|
||||
}
|
||||
dlg.finished(false);
|
||||
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
||||
Err(_) => Err(client::Error::Failure(reconstructed_result)),
|
||||
Err(_) => Err(client::Error::Failure(res)),
|
||||
Ok(serr) => Err(client::Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (reconstructed_result, decoded),
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
@@ -3623,25 +3567,15 @@ impl<'a, C> OperationWaitExecutionCall<'a, C> where C: BorrowMut<hyper::Client<h
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
let (res_parts, res_body) = res.into_parts();
|
||||
let res_body_string: String = String::from_utf8(
|
||||
hyper::body::to_bytes(res_body)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.unwrap();
|
||||
let reconstructed_result =
|
||||
hyper::Response::from_parts(res_parts, res_body_string.clone().into());
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
if !reconstructed_result.status().is_success() {
|
||||
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
||||
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
||||
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&reconstructed_result,
|
||||
if let client::Retry::After(d) = dlg.http_failure(&res,
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
@@ -3649,13 +3583,15 @@ impl<'a, C> OperationWaitExecutionCall<'a, C> where C: BorrowMut<hyper::Client<h
|
||||
}
|
||||
dlg.finished(false);
|
||||
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
||||
Err(_) => Err(client::Error::Failure(reconstructed_result)),
|
||||
Err(_) => Err(client::Error::Failure(res)),
|
||||
Ok(serr) => Err(client::Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (reconstructed_result, decoded),
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
@@ -3899,25 +3835,15 @@ impl<'a, C> MethodGetCapabilityCall<'a, C> where C: BorrowMut<hyper::Client<hype
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
let (res_parts, res_body) = res.into_parts();
|
||||
let res_body_string: String = String::from_utf8(
|
||||
hyper::body::to_bytes(res_body)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.unwrap();
|
||||
let reconstructed_result =
|
||||
hyper::Response::from_parts(res_parts, res_body_string.clone().into());
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
if !reconstructed_result.status().is_success() {
|
||||
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
||||
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
||||
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&reconstructed_result,
|
||||
if let client::Retry::After(d) = dlg.http_failure(&res,
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
@@ -3925,13 +3851,15 @@ impl<'a, C> MethodGetCapabilityCall<'a, C> where C: BorrowMut<hyper::Client<hype
|
||||
}
|
||||
dlg.finished(false);
|
||||
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
||||
Err(_) => Err(client::Error::Failure(reconstructed_result)),
|
||||
Err(_) => Err(client::Error::Failure(res)),
|
||||
Ok(serr) => Err(client::Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (reconstructed_result, decoded),
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
|
||||
@@ -14,6 +14,7 @@ use hyper;
|
||||
use hyper::header::{HeaderMap, AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, USER_AGENT};
|
||||
use hyper::Method;
|
||||
use hyper::StatusCode;
|
||||
use hyper::body::Buf;
|
||||
|
||||
use mime::{Attr, Mime, SubLevel, TopLevel, Value};
|
||||
use oauth2;
|
||||
@@ -806,3 +807,10 @@ pub fn remove_json_null_values(value: &mut json::value::Value) {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
// Borrowing the body object as mutable and converts it to a string
|
||||
pub async fn get_body_as_string(res_body: &mut hyper::Body) -> String {
|
||||
let res_body_buf = hyper::body::aggregate(res_body).await.unwrap();
|
||||
let res_body_string = String::from_utf8_lossy(res_body_buf.chunk());
|
||||
res_body_string.to_string()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user