mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
Remove RefCell around autenticator - they are sync now
This commit is contained in:
@@ -50,7 +50,7 @@ ${lib.hub_usage_example(c)}\
|
|||||||
</%block>
|
</%block>
|
||||||
pub struct ${hub_type}${ht_params} {
|
pub struct ${hub_type}${ht_params} {
|
||||||
client: RefCell<C>,
|
client: RefCell<C>,
|
||||||
auth: RefCell<oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>>,
|
auth: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>,
|
||||||
_user_agent: String,
|
_user_agent: String,
|
||||||
_base_url: String,
|
_base_url: String,
|
||||||
_root_url: String,
|
_root_url: String,
|
||||||
@@ -64,7 +64,7 @@ impl<'a, ${', '.join(HUB_TYPE_PARAMETERS)}> ${hub_type}${ht_params}
|
|||||||
pub fn new(client: C, authenticator: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>) -> ${hub_type}${ht_params} {
|
pub fn new(client: C, authenticator: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>) -> ${hub_type}${ht_params} {
|
||||||
${hub_type} {
|
${hub_type} {
|
||||||
client: RefCell::new(client),
|
client: RefCell::new(client),
|
||||||
auth: RefCell::new(authenticator),
|
auth: authenticator,
|
||||||
_user_agent: "${default_user_agent}".to_string(),
|
_user_agent: "${default_user_agent}".to_string(),
|
||||||
_base_url: "${baseUrl}".to_string(),
|
_base_url: "${baseUrl}".to_string(),
|
||||||
_root_url: "${rootUrl}".to_string(),
|
_root_url: "${rootUrl}".to_string(),
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ match result {
|
|||||||
|
|
||||||
delegate = 'self.' + property(DELEGATE_PROPERTY_NAME)
|
delegate = 'self.' + property(DELEGATE_PROPERTY_NAME)
|
||||||
delegate_finish = 'dlg.finished'
|
delegate_finish = 'dlg.finished'
|
||||||
auth_call = 'self.hub.auth.borrow_mut()'
|
auth_call = 'self.hub.auth'
|
||||||
|
|
||||||
default_scope = method_default_scope(m)
|
default_scope = method_default_scope(m)
|
||||||
|
|
||||||
@@ -700,8 +700,7 @@ else {
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
% if default_scope:
|
% if default_scope:
|
||||||
let authenticator = ${auth_call};
|
let token = match ${auth_call}.token(&self.${api.properties.scopes}.keys().collect::<Vec<_>>()[..]).await {
|
||||||
let token = match authenticator.token(&self.${api.properties.scopes}.keys().collect::<Vec<_>>()[..]).await {
|
|
||||||
Ok(token) => token.clone(),
|
Ok(token) => token.clone(),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
match dlg.token(&err) {
|
match dlg.token(&err) {
|
||||||
@@ -841,12 +840,11 @@ else {
|
|||||||
dlg.store_upload_url(Some(url_str));
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
drop(authenticator);
|
|
||||||
client::ResumableUploadHelper {
|
client::ResumableUploadHelper {
|
||||||
client: &mut client.borrow_mut(),
|
client: &mut client.borrow_mut(),
|
||||||
delegate: dlg,
|
delegate: dlg,
|
||||||
start_at: if upload_url_from_server { Some(0) } else { None },
|
start_at: if upload_url_from_server { Some(0) } else { None },
|
||||||
auth: &mut *${auth_call},
|
auth: &${auth_call},
|
||||||
user_agent: &self.hub._user_agent,
|
user_agent: &self.hub._user_agent,
|
||||||
auth_header: format!("Bearer {}", token.as_str()),
|
auth_header: format!("Bearer {}", token.as_str()),
|
||||||
url: url_str,
|
url: url_str,
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ pub struct ResumableUploadHelper<'a, A: 'a> {
|
|||||||
>,
|
>,
|
||||||
pub delegate: &'a mut dyn Delegate,
|
pub delegate: &'a mut dyn Delegate,
|
||||||
pub start_at: Option<u64>,
|
pub start_at: Option<u64>,
|
||||||
pub auth: &'a mut A,
|
pub auth: &'a A,
|
||||||
pub user_agent: &'a str,
|
pub user_agent: &'a str,
|
||||||
pub auth_header: String,
|
pub auth_header: String,
|
||||||
pub url: &'a str,
|
pub url: &'a str,
|
||||||
|
|||||||
Reference in New Issue
Block a user