RestfulFirebase 1.5.1
See the version list below for details.
dotnet add package RestfulFirebase --version 1.5.1
NuGet\Install-Package RestfulFirebase -Version 1.5.1
<PackageReference Include="RestfulFirebase" Version="1.5.1" />
paket add RestfulFirebase --version 1.5.1
#r "nuget: RestfulFirebase, 1.5.1"
// Install RestfulFirebase as a Cake Addin #addin nuget:?package=RestfulFirebase&version=1.5.1 // Install RestfulFirebase as a Cake Tool #tool nuget:?package=RestfulFirebase&version=1.5.1
RestfulFirebase
Firebase REST API wrapper with streaming API wired with MVVM observers.
NuGets
Name | Info |
---|---|
RestfulFirebase |
Installation
// Install release version
Install-Package RestfulFirebase
// Install pre-release version
Install-Package RestfulFirebase -pre
Supported frameworks
.NET Standard 2.0 - see https://github.com/dotnet/standard/blob/master/docs/versions.md for compatibility matrix
Get Started
- All firebase observable events are executed on the thread that is used to create the object instance. To use in UI safe updates, create the firebase object instances at the UI thread or manually configure the ISyncObject.SyncOperation to use UI thread.
- If ILocalDatabase is provided and implemented with a specific device database persistency implementation, app authentication and the database will be persisted even if the app closes and reopens.
Usage
App Module Sample
using RestfulFirebase;
namespace YourNamespace
{
public static class Program
{
private static FirebaseConfig config;
private static RestfulFirebaseApp app;
public static void Main(string[] args)
{
config = new FirebaseConfig()
{
ApiKey = "<Your API key>",
DatabaseURL = "<Your realtime database URL>", // Ends with firebaseio.com
StorageBucket = "<Your storage bucket>", // Ends with appspot.com
LocalDatabase = "<Your implementation of RestfulFirebase.Local.ILocalDatabase>" // For optional offline persistency
};
app = new RestfulFirebaseApp(config);
}
}
}
Authentication
using RestfulFirebase;
namespace YourNamespace
{
public static class Program
{
public static async void Authenticate()
{
await app.Auth.SignInWithEmailAndPassword("t@st.com", "123123");
}
}
}
Realtime
The RealtimeWire holds a database subscription for real-time online and local data updates; Also manages offline persistency and caching for the specified reference node. Persistent data from the app launch will continue to sync if its real-time node or its parent`s real-time node is created and started.
FirebaseObject Sample
using RestfulFirebase.Database.Models;
namespace YourNamespace
{
public class Dinosaur : FirebaseObject
{
public string Name
{
get => GetFirebasePropertyWithKey("name", () => "Default name");
set => SetFirebasePropertyWithKey(value, "name");
}
public string? Family
{
get => GetFirebasePropertyWithKey<string>("family");
set => SetFirebasePropertyWithKey(value, "family");
}
// Uses its property name for firebase key.
public int Height
{
get => GetFirebaseProperty<int>();
set => SetFirebaseProperty(value);
}
}
}
Subscribe
Predefined model values will be overwritten by the database values.
using System.Threading.Tasks;
using RestfulFirebase;
using RestfulFirebase.Database.Realtime;
namespace YourNamespace
{
public static class Program
{
public static void Subscribe()
{
// Creates new realtime wire for https://some-database.firebaseio.com/users/some-uid/pets/dinosaur
RealtimeWire userWire = app.Database
.Child("users")
.Child(app.Auth.Session.LocalId) // User UID
.Child("pets")
.Child("dinosaur")
.AsRealtimeWire();
// Starts to subscribe and listen for the node`s local and online updates
// Realtime local data persistency and notification starts with this node.
userWire.Start();
// Create models
Dinosaur dinosaur1 = new Dinosaur();
Dinosaur dinosaur2 = new Dinosaur();
// Subscribes model to the node https://some-database.firebaseio.com/users/some-uid/pets/dinosaur/dino1
userWire.Child("dino1").PutModel(dinosaur1);
// Subscribes model to the node https://some-database.firebaseio.com/users/some-uid/pets/dinosaur/dino2
userWire.Child("dino2").PutModel(dinosaur2);
// "dinosaur1" and "dinosaur1" are now subscribed to each node`s local and online changes.
// Any preceding changes to "Dinosaur.Name" property will reflect in its database node and vice-versa.
// Changes will trigger the model`s INotifyPropertyChanged observers.
}
}
}
Write and Subscribe
Database values will be overwritten by the predefined model values.
using System.Threading.Tasks;
using RestfulFirebase;
using RestfulFirebase.Database.Realtime;
namespace YourNamespace
{
public static class Program
{
public static void WriteAndSubscribe()
{
// Creates new realtime wire for https://some-database.firebaseio.com/users/some-uid/pets/dinosaur
RealtimeWire userWire = app.Database
.Child("users")
.Child(app.Auth.Session.LocalId) // User UID
.Child("pets")
.Child("dinosaur")
.AsRealtimeWire();
// Starts to subscribe and listen for the node`s local and online updates.
// Realtime local data persistency and notification starts with this node.
userWire.Start();
// Create models
Dinosaur dinosaur1 = new Dinosaur();
Dinosaur dinosaur2 = new Dinosaur();
dinosaur1.Name = "Megalosaurus";
dinosaur2.Name = "T-rex";
// Write and subscribes model to the node https://some-database.firebaseio.com/users/some-uid/pets/dinosaur/dino1
userWire.Child("dino1").PutModel(dinosaur1);
// Write and subscribes model to the node https://some-database.firebaseio.com/users/some-uid/pets/dinosaur/dino2
userWire.Child("dino2").PutModel(dinosaur2);
// "dinosaur1" and "dinosaur1" are now subscribed to each local and online changes.
// Any preceding changes to "Dinosaur.Name" property will reflect in its database node and vice-versa.
// Changes will trigger the model`s INotifyPropertyChanged observers.
}
}
}
Listen Instance
Creating a listen instance of the existing realtime wire without resubscribing to the node will save you some bandwidth and usage.
using System.Threading.Tasks;
using RestfulFirebase;
using RestfulFirebase.Database.Realtime;
namespace YourNamespace
{
public static class Program
{
public static void WriteAndSubscribe()
{
// Creates new realtime wire for https://some-database.firebaseio.com/users/some-uid/
RealtimeWire userWire = app.Database
.Child("users")
.Child(app.Auth.Session.LocalId) // User UID
.AsRealtimeWire();
// Starts to subscribe and listen for the node`s local and online updates
userWire.Start();
// Creates a new listen instance without resubscribing to the node.
RealtimeInstance userDinosaur = userWire
.Child("pets")
.Child("dinosaur");
RealtimeInstance userDinosaur1 = userWire
.Child("pets")
.Child("dinosaur1");
RealtimeInstance userDinosaur2 = userWire
.Child("pets")
.Child("dinosaur2");
}
}
}
UI safe
using RestfulFirebase.Database.Models;
namespace YourNamespace
{
public static class Program
{
private static Dinosaur dinosaur;
public static void UIThread()
{
dinosaur = new Dinosaur();
}
public static void BackgroundThread()
{
// Subscribe to both online and local updates
dinosaur.PropertyChanged += (s, e) =>
{
// Executed on UI thread
}
dinosaur.Name = "Megalosaurus";
}
}
}
Code & Inspiration from the following:
- firebase-authentication-dotnet by @step-up-labs
- firebase-database-dotnet by @step-up-labs
- firebase-storage-dotnet by @step-up-labs
Want To Support This Project?
All I have ever asked is to be active by submitting bugs, features, and sending those pull requests down!.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- ObservableHelpers (>= 1.5.5)
- SerializerHelpers (>= 1.0.4)
- System.Text.Json (>= 6.0.2)
-
.NETStandard 2.1
- ObservableHelpers (>= 1.5.5)
- SerializerHelpers (>= 1.0.4)
- System.Text.Json (>= 6.0.2)
-
net5.0
- ObservableHelpers (>= 1.5.5)
- SerializerHelpers (>= 1.0.4)
- System.Text.Json (>= 6.0.2)
-
net6.0
- ObservableHelpers (>= 1.5.5)
- SerializerHelpers (>= 1.0.4)
- System.Text.Json (>= 6.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.0-prerelease.29 | 96 | 4/16/2023 |
2.0.0-prerelease.28 | 116 | 4/2/2023 |
2.0.0-prerelease.27 | 101 | 3/26/2023 |
2.0.0-prerelease.26 | 94 | 3/26/2023 |
2.0.0-prerelease.24 | 89 | 3/26/2023 |
2.0.0-prerelease.23 | 95 | 3/26/2023 |
2.0.0-prerelease.22 | 130 | 2/12/2023 |
2.0.0-prerelease.21 | 110 | 2/12/2023 |
2.0.0-prerelease.20 | 96 | 2/12/2023 |
2.0.0-prerelease.19 | 93 | 2/11/2023 |
2.0.0-prerelease.18 | 94 | 2/11/2023 |
2.0.0-prerelease.17 | 95 | 2/11/2023 |
2.0.0-prerelease.16 | 112 | 2/5/2023 |
2.0.0-prerelease.15 | 114 | 2/5/2023 |
2.0.0-prerelease.14 | 109 | 2/5/2023 |
2.0.0-prerelease.13 | 99 | 2/4/2023 |
2.0.0-prerelease.12 | 104 | 2/4/2023 |
2.0.0-prerelease.11 | 107 | 2/4/2023 |
2.0.0-prerelease.10 | 103 | 2/4/2023 |
2.0.0-prerelease.9 | 122 | 1/31/2023 |
2.0.0-prerelease.8 | 115 | 1/29/2023 |
2.0.0-prerelease.7 | 129 | 1/23/2023 |
2.0.0-prerelease.6 | 116 | 1/22/2023 |
2.0.0-prerelease.5 | 107 | 1/22/2023 |
2.0.0-prerelease.4 | 106 | 1/22/2023 |
2.0.0-prerelease.3 | 118 | 1/21/2023 |
1.6.0-prerelease.4 | 117 | 10/25/2022 |
1.6.0-prerelease.3 | 113 | 10/24/2022 |
1.6.0-prerelease.2 | 117 | 10/24/2022 |
1.5.1 | 651 | 3/19/2022 |
1.5.0 | 474 | 3/14/2022 |
1.4.5 | 452 | 3/13/2022 |
1.4.4 | 437 | 3/9/2022 |
1.4.2 | 440 | 2/23/2022 |
1.4.1 | 424 | 2/22/2022 |
1.4.0 | 456 | 2/22/2022 |
1.3.30 | 456 | 2/21/2022 |
1.3.29 | 466 | 1/24/2022 |
1.3.28 | 281 | 1/10/2022 |
1.3.27 | 283 | 1/9/2022 |
1.3.26 | 278 | 1/8/2022 |
1.3.25 | 283 | 1/8/2022 |
1.3.24 | 290 | 1/5/2022 |
1.3.23 | 300 | 1/5/2022 |
1.3.22 | 306 | 1/5/2022 |
1.3.21 | 300 | 1/4/2022 |
1.3.20 | 309 | 1/2/2022 |
1.3.19 | 293 | 1/1/2022 |
1.3.18 | 276 | 12/31/2021 |
1.3.17 | 273 | 12/27/2021 |
1.3.16 | 361 | 9/15/2021 |
1.3.15 | 365 | 9/8/2021 |
1.3.14 | 337 | 9/6/2021 |
1.3.13 | 321 | 9/6/2021 |
1.3.12 | 307 | 9/6/2021 |
1.3.11 | 365 | 9/5/2021 |
1.3.10 | 316 | 9/3/2021 |
1.3.9 | 313 | 9/2/2021 |
1.3.8 | 321 | 9/2/2021 |
1.3.7 | 300 | 8/31/2021 |
1.3.6 | 313 | 8/26/2021 |
1.3.5 | 299 | 8/26/2021 |
1.3.4 | 325 | 8/26/2021 |
1.3.3 | 320 | 8/26/2021 |
1.3.2 | 325 | 8/26/2021 |
1.3.1 | 317 | 8/26/2021 |
1.3.0 | 347 | 8/24/2021 |
1.2.8 | 352 | 8/20/2021 |
1.2.7 | 299 | 8/19/2021 |
1.2.6 | 307 | 8/19/2021 |
1.2.5 | 333 | 8/18/2021 |
1.2.4 | 318 | 8/9/2021 |
1.2.3 | 311 | 8/9/2021 |
1.2.2 | 331 | 8/9/2021 |
1.2.1 | 335 | 8/9/2021 |
1.2.0 | 312 | 8/9/2021 |
1.1.9 | 345 | 8/8/2021 |
1.1.8 | 356 | 8/4/2021 |
1.1.7 | 345 | 7/19/2021 |
1.1.6 | 404 | 7/5/2021 |
1.1.5 | 429 | 7/5/2021 |
1.1.4 | 312 | 7/5/2021 |
1.1.3 | 413 | 7/3/2021 |
1.1.2 | 425 | 7/3/2021 |
1.1.1 | 308 | 7/2/2021 |
1.1.0 | 386 | 6/30/2021 |
1.0.99 | 384 | 6/30/2021 |
1.0.98 | 374 | 6/30/2021 |
1.0.97 | 374 | 6/20/2021 |
1.0.96 | 364 | 6/17/2021 |
1.0.95 | 353 | 6/16/2021 |
1.0.94 | 350 | 6/16/2021 |
1.0.93 | 371 | 6/16/2021 |
1.0.92 | 373 | 6/15/2021 |
1.0.91 | 338 | 6/15/2021 |
1.0.90 | 357 | 6/15/2021 |
1.0.89 | 376 | 6/15/2021 |
1.0.88 | 369 | 6/15/2021 |
1.0.87 | 349 | 6/15/2021 |
1.0.86 | 376 | 6/15/2021 |
1.0.83 | 341 | 6/15/2021 |
1.0.82 | 379 | 6/14/2021 |
1.0.81 | 362 | 6/14/2021 |
1.0.80 | 425 | 6/14/2021 |
1.0.79 | 385 | 6/13/2021 |
1.0.78 | 419 | 6/13/2021 |
1.0.77 | 455 | 6/13/2021 |
1.0.76 | 380 | 6/12/2021 |
1.0.75 | 372 | 6/12/2021 |
1.0.74 | 401 | 6/12/2021 |
1.0.72 | 383 | 6/12/2021 |
1.0.71 | 410 | 6/12/2021 |
1.0.70 | 387 | 6/11/2021 |
1.0.69 | 364 | 6/11/2021 |
1.0.68 | 370 | 6/11/2021 |
1.0.67 | 311 | 6/11/2021 |
1.0.66 | 371 | 6/9/2021 |
1.0.65 | 370 | 6/8/2021 |
1.0.64 | 365 | 6/8/2021 |
1.0.63 | 340 | 6/8/2021 |
1.0.62 | 351 | 6/8/2021 |
1.0.61 | 368 | 6/8/2021 |
1.0.60 | 332 | 6/8/2021 |
1.0.59 | 348 | 6/8/2021 |
1.0.58 | 372 | 6/8/2021 |
1.0.56 | 314 | 6/8/2021 |
1.0.55 | 361 | 6/8/2021 |
1.0.54 | 392 | 6/7/2021 |
1.0.53 | 388 | 6/7/2021 |
1.0.52 | 321 | 6/6/2021 |
1.0.51 | 365 | 6/6/2021 |
1.0.50 | 433 | 6/6/2021 |
1.0.49 | 450 | 6/6/2021 |
1.0.48 | 345 | 6/6/2021 |
1.0.47 | 344 | 6/6/2021 |
1.0.46 | 332 | 6/6/2021 |
1.0.45 | 349 | 6/5/2021 |
1.0.44 | 371 | 6/5/2021 |
1.0.43 | 327 | 6/5/2021 |
1.0.42 | 342 | 6/5/2021 |
1.0.41 | 379 | 6/5/2021 |
1.0.40 | 392 | 6/5/2021 |
1.0.39 | 367 | 6/5/2021 |
1.0.38 | 377 | 6/4/2021 |
1.0.37 | 342 | 6/4/2021 |
1.0.36 | 323 | 6/4/2021 |
1.0.35 | 358 | 6/3/2021 |
1.0.34 | 327 | 6/3/2021 |
1.0.33 | 336 | 6/3/2021 |
1.0.32 | 393 | 6/3/2021 |
1.0.31 | 321 | 6/3/2021 |
1.0.30 | 357 | 6/2/2021 |
1.0.29 | 344 | 6/2/2021 |
1.0.28 | 338 | 6/2/2021 |
1.0.27 | 348 | 6/2/2021 |
1.0.26 | 364 | 6/2/2021 |
1.0.25 | 371 | 6/2/2021 |
1.0.24 | 342 | 6/2/2021 |
1.0.23 | 396 | 6/2/2021 |
1.0.22 | 339 | 6/1/2021 |
1.0.21 | 343 | 6/1/2021 |
1.0.20 | 327 | 6/1/2021 |
1.0.19 | 353 | 6/1/2021 |
1.0.18 | 334 | 6/1/2021 |
1.0.17 | 323 | 6/1/2021 |
1.0.16 | 324 | 6/1/2021 |
1.0.15 | 325 | 6/1/2021 |
1.0.14 | 313 | 6/1/2021 |
1.0.13 | 320 | 6/1/2021 |
1.0.12 | 355 | 6/1/2021 |
1.0.11 | 336 | 5/27/2021 |
1.0.10 | 335 | 5/16/2021 |
1.0.9 | 316 | 5/15/2021 |
1.0.8 | 333 | 5/14/2021 |
1.0.7 | 352 | 5/13/2021 |
1.0.6 | 310 | 5/13/2021 |
1.0.5 | 314 | 5/12/2021 |
1.0.4 | 324 | 5/12/2021 |
1.0.3 | 311 | 5/12/2021 |
1.0.2 | 321 | 5/9/2021 |
1.0.1 | 337 | 5/8/2021 |
1.0.0 | 373 | 5/7/2021 |
* Changed auth signout to not to remove local database on signout.