Skip to content

Repository files navigation

Fire# for Firebase

Firebase REST API wrapper for the .NET & Xamarin.

Changes are sent to all subscribed clients automatically, so you can update your clients in realtime from the backend.

AppVeyor Build statusCoverage StatusStories in Ready
Support via Gratipay

Release Notes

2.0

  • Use Microsoft HTTP Client Libraries instead of RestSharp
  • FireSharp is now Portable Library
  • Supports Streaming from the REST API
  • It is fully asynchronous and designed to be non-blocking

IMPORTANT :v1 docs moved here.

####Installation (NuGet)

//**Install v2**Install-Package FireSharp
//**Install v1**
Install-Package FireSharp -Version 1.1.0

Usage

FirebaseClient uses Newtonsoft.Json by default.

How can I configure FireSharp?


IFirebaseConfigconfig=newFirebaseConfig{AuthSecret="your_firebase_secret",BasePath="https://yourfirebase.firebaseio.com/"};
IFirebaseClientclient=newFirebaseClient(config);

So far, supported methods are :

####Set

vartodo=newTodo{name="Execute SET",priority=2};SetResponseresponse=await_client.SetAsync("todos/set",todo);Todoresult=response.ResultAs<Todo>();//The response will contain the data written

####Push

vartodo=newTodo{name="Execute PUSH",priority=2};PushResponseresponse=await_client.PushAsync("todos/push",todo);response.Result.name//The result will contain the child name of the new data that was added

####Get

FirebaseResponseresponse=await_client.GetAsync("todos/set");Todotodo=response.ResultAs<Todo>();//The response will contain the data being retreived

####Update

vartodo=newTodo{name="Execute UPDATE!",priority=1};FirebaseResponseresponse=await_client.UpdateAsync("todos/set",todo);Todotodo=response.ResultAs<Todo>();//The response will contain the data written

####Delete

FirebaseResponseresponse=await_client.DeleteAsync("todos");//Deletes todos collectionConsole.WriteLine(response.StatusCode);

####Listen Streaming from the REST API

EventStreamResponseresponse=await_client.OnAsync("chat",(sender,args)=>{System.Console.WriteLine(args.Data);});//Call dispose to stop listening for eventsresponse.Dispose();

More information about Firebase and the Firebase API is available at the official website.

License

Code and documentation are available according to the MIT License (see LICENSE).

About

.Net client library for Firebase

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages