mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-02-23 15:50:00 +01:00
chore(deps): Move pubsub example to hyper 0.10.
This commit is contained in:
@@ -12,3 +12,4 @@ base64 = "0.2"
|
||||
yup-oauth2 = "^ 1.0"
|
||||
google-pubsub1 = "^ 1.0"
|
||||
hyper = "0.10"
|
||||
hyper-rustls = "^ 0.3"
|
||||
|
||||
@@ -24,11 +24,13 @@ extern crate base64;
|
||||
extern crate yup_oauth2 as oauth;
|
||||
extern crate google_pubsub1 as pubsub;
|
||||
extern crate hyper;
|
||||
extern crate hyper_rustls;
|
||||
|
||||
use std::env;
|
||||
use std::time;
|
||||
use std::thread;
|
||||
|
||||
use hyper::net::HttpsConnector;
|
||||
use pubsub::{Topic, Subscription};
|
||||
|
||||
// The prefixes are important!
|
||||
@@ -158,13 +160,15 @@ fn publish_stuff(methods: &PubsubMethods, message: &str) {
|
||||
fn main() {
|
||||
let client_secret = oauth::service_account_key_from_file(&"pubsub-auth.json".to_string())
|
||||
.unwrap();
|
||||
let mut access = oauth::ServiceAccountAccess::new(client_secret, hyper::Client::new());
|
||||
let client = hyper::Client::with_connector(HttpsConnector::new(hyper_rustls::TlsClient::new()));
|
||||
let mut access = oauth::ServiceAccountAccess::new(client_secret, client);
|
||||
|
||||
use oauth::GetToken;
|
||||
println!("{:?}",
|
||||
access.token(&vec!["https://www.googleapis.com/auth/pubsub"]).unwrap());
|
||||
|
||||
let hub = pubsub::Pubsub::new(hyper::Client::new(), access);
|
||||
let client = hyper::Client::with_connector(HttpsConnector::new(hyper_rustls::TlsClient::new()));
|
||||
let hub = pubsub::Pubsub::new(client, access);
|
||||
let methods = hub.projects();
|
||||
|
||||
let mode = env::args().nth(1).unwrap_or(String::new());
|
||||
|
||||
Reference in New Issue
Block a user