pub struct AuthenticatedClient {
pub client: Client,
pub access_token: String,
pub email: String,
}Expand description
An authenticated reqwest client for a Google service.
Fields§
§client: Client§access_token: String§email: StringImplementations§
Source§impl AuthenticatedClient
impl AuthenticatedClient
Sourcepub async fn new(
service: Service,
email: &str,
oauth_client: &str,
) -> Result<Self, ApiError>
pub async fn new( service: Service, email: &str, oauth_client: &str, ) -> Result<Self, ApiError>
Create an authenticated client for the given service and account.
Steps:
- Read client credentials from config.
- Get refresh token from keyring.
- Exchange refresh token for access token via OAuth2 token endpoint.
- Return client with auth header.
Auto Trait Implementations§
impl Freeze for AuthenticatedClient
impl !RefUnwindSafe for AuthenticatedClient
impl Send for AuthenticatedClient
impl Sync for AuthenticatedClient
impl Unpin for AuthenticatedClient
impl UnsafeUnpin for AuthenticatedClient
impl !UnwindSafe for AuthenticatedClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more