mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-03 18:08:44 +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>
|
||||
pub struct ${hub_type}${ht_params} {
|
||||
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,
|
||||
_base_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} {
|
||||
${hub_type} {
|
||||
client: RefCell::new(client),
|
||||
auth: RefCell::new(authenticator),
|
||||
auth: authenticator,
|
||||
_user_agent: "${default_user_agent}".to_string(),
|
||||
_base_url: "${baseUrl}".to_string(),
|
||||
_root_url: "${rootUrl}".to_string(),
|
||||
|
||||
@@ -451,7 +451,7 @@ match result {
|
||||
|
||||
delegate = 'self.' + property(DELEGATE_PROPERTY_NAME)
|
||||
delegate_finish = 'dlg.finished'
|
||||
auth_call = 'self.hub.auth.borrow_mut()'
|
||||
auth_call = 'self.hub.auth'
|
||||
|
||||
default_scope = method_default_scope(m)
|
||||
|
||||
@@ -700,8 +700,7 @@ else {
|
||||
|
||||
loop {
|
||||
% if default_scope:
|
||||
let authenticator = ${auth_call};
|
||||
let token = match authenticator.token(&self.${api.properties.scopes}.keys().collect::<Vec<_>>()[..]).await {
|
||||
let token = match ${auth_call}.token(&self.${api.properties.scopes}.keys().collect::<Vec<_>>()[..]).await {
|
||||
Ok(token) => token.clone(),
|
||||
Err(err) => {
|
||||
match dlg.token(&err) {
|
||||
@@ -841,12 +840,11 @@ else {
|
||||
dlg.store_upload_url(Some(url_str));
|
||||
}
|
||||
|
||||
drop(authenticator);
|
||||
client::ResumableUploadHelper {
|
||||
client: &mut client.borrow_mut(),
|
||||
delegate: dlg,
|
||||
start_at: if upload_url_from_server { Some(0) } else { None },
|
||||
auth: &mut *${auth_call},
|
||||
auth: &${auth_call},
|
||||
user_agent: &self.hub._user_agent,
|
||||
auth_header: format!("Bearer {}", token.as_str()),
|
||||
url: url_str,
|
||||
|
||||
@@ -613,7 +613,7 @@ pub struct ResumableUploadHelper<'a, A: 'a> {
|
||||
>,
|
||||
pub delegate: &'a mut dyn Delegate,
|
||||
pub start_at: Option<u64>,
|
||||
pub auth: &'a mut A,
|
||||
pub auth: &'a A,
|
||||
pub user_agent: &'a str,
|
||||
pub auth_header: String,
|
||||
pub url: &'a str,
|
||||
|
||||
Reference in New Issue
Block a user