mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-01-03 18:05:04 +01:00
chore(deps): Update drive example to hyper 0.10 + rustls.
This commit is contained in:
@@ -7,11 +7,14 @@
|
||||
//! Copyright (c) 2016 Google, Inc. (Lewin Bormann <lbo@spheniscida.de>)
|
||||
|
||||
extern crate hyper;
|
||||
extern crate hyper_rustls;
|
||||
extern crate yup_oauth2;
|
||||
extern crate google_drive3;
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use hyper::net::HttpsConnector;
|
||||
|
||||
use yup_oauth2::{Authenticator, FlowType, ApplicationSecret, DiskTokenStorage,
|
||||
DefaultAuthenticatorDelegate, read_application_secret};
|
||||
use google_drive3::Drive;
|
||||
@@ -25,13 +28,17 @@ fn read_client_secret(file: String) -> ApplicationSecret {
|
||||
|
||||
fn main() {
|
||||
let secret = read_client_secret(CLIENT_SECRET_FILE.to_string());
|
||||
let client = hyper::Client::with_connector(
|
||||
HttpsConnector::new(hyper_rustls::TlsClient::new()));
|
||||
let authenticator = Authenticator::new(&secret,
|
||||
DefaultAuthenticatorDelegate,
|
||||
hyper::Client::new(),
|
||||
client,
|
||||
DiskTokenStorage::new(&"token_store.json".to_string())
|
||||
.unwrap(),
|
||||
Some(FlowType::InstalledInteractive));
|
||||
let hub = Drive::new(hyper::Client::new(), authenticator);
|
||||
let client = hyper::Client::with_connector(
|
||||
HttpsConnector::new(hyper_rustls::TlsClient::new()));
|
||||
let hub = Drive::new(client, authenticator);
|
||||
|
||||
let (_resp, list_result) = hub.files().list().q("'root' in parents and trashed = false").doit().unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user