firebase-client
A firebase HTTP v1 client implementation in Rust using the google_authz library.
Example
There are two ways to send notifications, one using a notification builder:
// Get env vars from .env file
let credentials_file_path = var.unwrap;
let project_id = var.unwrap;
let test_token = var.unwrap;
// Instantiate our client
let https = with_native_roots;
let client = builder.;
let firebase_client =
new_default.unwrap;
// Build a notification
let mut firebase_notification = new
.message
.data
.android_channel_id
.build;
// Send a notification
firebase_notification.send_notification.await.unwrap;
And another sending a raw string:
// Get env vars from .env file
let credentials_file_path = var.unwrap;
let project_id = var.unwrap;
let test_token = var.unwrap;
// Instantiate our client
let https = with_native_roots;
let client = builder.;
let mut firebase_client =
new_default.unwrap;
// Send notification directly
let _result = firebase_client
.send_notification_raw
.await;