Skip to content

Commit ce8b6d0

Browse files
authored
Merge pull request #16 from jutuon/update-dependencies
Update dependencies and other improvements
2 parents 8eb7ced + 1788092 commit ce8b6d0

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ edition = "2018"
1818
[features]
1919
default = ["native-tls"]
2020

21-
native-tls = ["reqwest/native-tls"]
22-
rustls = ["reqwest/rustls-tls"]
23-
vendored-tls = ["reqwest/native-tls-vendored"]
21+
native-tls = ["reqwest/native-tls", "yup-oauth2/hyper-tls"]
22+
native-tls-vendored = ["reqwest/native-tls-vendored", "yup-oauth2/hyper-tls"]
23+
rustls-tls = ["reqwest/rustls-tls", "yup-oauth2/hyper-rustls"]
2424

2525
[dependencies]
2626
serde = { version = "1", features = ["derive"] }
2727
serde_json = { version = "1", features = ["preserve_order"] }
2828
tokio = { version = "1", features = ["fs"] }
29-
reqwest = { version = "0.11", features = ["json"], default-features = false }
29+
reqwest = { version = "0.12", features = ["json", "charset", "http2", "macos-system-configuration"], default-features = false }
3030
chrono = "0.4"
3131
thiserror = "1"
3232
dotenvy = "0.15"
33-
yup-oauth2 = "9"
33+
yup-oauth2 = { version = "11", features = ["service-account", "ring"], default-features = false }
3434

3535
[dev-dependencies]
3636
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }

src/client/oauth.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::path::PathBuf;
22

33
use yup_oauth2::authenticator::{Authenticator, DefaultHyperClient, HyperClientBuilder};
4-
use yup_oauth2::hyper::client::HttpConnector;
5-
use yup_oauth2::hyper_rustls::HttpsConnector;
64
use yup_oauth2::ServiceAccountAuthenticator;
75

86
const FIREBASE_OAUTH_SCOPE: &str = "https://www.googleapis.com/auth/firebase.messaging";
@@ -34,7 +32,7 @@ impl OauthError {
3432
}
3533

3634
pub(crate) struct OauthClient {
37-
authenticator: Authenticator<HttpsConnector<HttpConnector>>,
35+
authenticator: Authenticator<<DefaultHyperClient as HyperClientBuilder>::Connector>,
3836
project_id: String,
3937
}
4038

@@ -55,8 +53,7 @@ impl OauthClient {
5553
) -> Result<Self, OauthError> {
5654
let key = yup_oauth2::parse_service_account_key(service_account_key_json_string)
5755
.map_err(OauthError::ServiceAccountKeyReadingFailed)?;
58-
let oauth_client = DefaultHyperClient.build_hyper_client().map_err(OauthError::Oauth)?;
59-
let builder = ServiceAccountAuthenticator::with_client(key.clone(), oauth_client);
56+
let builder = ServiceAccountAuthenticator::builder(key.clone());
6057
let builder = if let Some(path) = token_cache_json_path {
6158
builder.persist_tokens_to_disk(path)
6259
} else {

src/message/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ impl AsRef<Message> for Message {
8181
}
8282
}
8383

84-
/// Wrap the message in a "message" field
84+
#[allow(clippy::bool_comparison)]
8585
fn is_validate_only_default(b: &bool) -> bool {
8686
*b == false
8787
}
8888

89+
/// Data for FCM send API request body JSON
90+
/// <https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send?authuser=0#request-body>
8991
#[derive(Serialize)]
9092
pub(crate) struct MessageWrapper<'a> {
9193
#[serde(skip_serializing_if = "is_validate_only_default")]

0 commit comments

Comments
 (0)