- Server-Sent Events (a.k.a stream) (https://github.com/emreyalvac/firebase-rs#read-data-as-stream)
- Generic Payload
use firebase_rs::*;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap();
let firebase = Firebase::auth("https://myfirebase.firebaseio.com", "AUTH_KEY").unwrap();
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID").at(...);
let firebase = Firebase::new("https://myfirebase.firebaseio.com").at("users").unwrap();
let stream = firebase.with_realtime_events().unwrap();
stream
.listen( | event_type, data| {
println ! ("Type: {:?} Data: {:?}", event_type, data);
}, | err| println!("{:?}", err), false).await;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
let users = firebase.get_as_string().await;
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
let user = firebase.get::<HashMap<String, User>> ().await;
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID");
let user = firebase.get::<User>().await;
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let user = User { name: String::default () };
let mut firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
firebase.set_with_key("myKey", &user).await;
Output
{
"users": {
"myKey": {
"name": ""
}
}
}
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let user = User { name: String::default () };
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
firebase.set(&user).await;
Output
{
"users": {
"-OC9mYIUIdY3JygkmsFQ": {
"name": ""
}
}
}
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let user = User { name: String::default () };
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID");
firebase.update( &user).await;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().with_params().start_at(1).order_by("name").equal_to(5).finish();
let result = firebase.get().await;
Thanks goes to these wonderful people ✨