Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bugthesystem/firesharp
An asynchronous cross-platform .Net library for Firebase
https://github.com/bugthesystem/firesharp
c-sharp firebase mono streaming xamarin
Last synced: about 1 month ago
JSON representation
An asynchronous cross-platform .Net library for Firebase
- Host: GitHub
- URL: https://github.com/bugthesystem/firesharp
- Owner: bugthesystem
- License: unlicense
- Created: 2013-11-13T17:20:26.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-01-26T18:11:52.000Z (almost 2 years ago)
- Last Synced: 2024-05-22T16:13:01.837Z (6 months ago)
- Topics: c-sharp, firebase, mono, streaming, xamarin
- Language: C#
- Homepage:
- Size: 1.16 MB
- Stars: 686
- Watchers: 58
- Forks: 146
- Open Issues: 78
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **Fire#**
![](https://raw.githubusercontent.com/ziyasal/FireSharp/master/misc/logo.png)
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 status](https://ci.appveyor.com/api/projects/status/bj2sdp2a0w5095sv?svg=true)](https://ci.appveyor.com/project/lablabla/firesharp) [![Coverage Status](https://coveralls.io/repos/github/ziyasal/FireSharp/badge.svg?branch=master)](https://coveralls.io/github/ziyasal/FireSharp?branch=master)
**IMPORTANT :** [**v1 docs**](https://github.com/ziyasal/FireSharp/wiki/v1-Docs) moved [here](https://github.com/ziyasal/FireSharp/wiki/v1-Docs).
#### Installation (NuGet)
```csharp
//**Install v2**
Install-Package FireSharp//**Install v1**
Install-Package FireSharp -Version 1.1.0
```
### Usage
[FirebaseClient](https://github.com/ziyasal/FireSharp/blob/master/FireSharp/FirebaseClient.cs) uses [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) by default.#### How can I configure FireSharp?
------------------------------```csharp
IFirebaseConfig config = new FirebaseConfig
{
AuthSecret = "your_firebase_secret",
BasePath = "https://yourfirebase.firebaseio.com/"
};
````
```csharp
IFirebaseClient client = new FirebaseClient(config);
```
So far, supported methods are :#### Set
```csharpvar todo = new Todo {
name = "Execute SET",
priority = 2
};
SetResponse response = await _client.SetAsync("todos/set", todo);
Todo result = response.ResultAs(); //The response will contain the data written
```
#### Push
```csharpvar todo = new Todo {
name = "Execute PUSH",
priority = 2
};
PushResponse response =await _client.PushAsync("todos/push", todo);
response.Result.name //The result will contain the child name of the new data that was added
```
#### Get
```csharpFirebaseResponse response = await _client.GetAsync("todos/set");
Todo todo=response.ResultAs(); //The response will contain the data being retreived
```
#### Update
```csharp
var todo = new Todo {
name = "Execute UPDATE!",
priority = 1
};FirebaseResponse response =await _client.UpdateAsync("todos/set", todo);
Todo todo = response.ResultAs(); //The response will contain the data written
```
#### Delete
```csharpFirebaseResponse response =await _client.DeleteAsync("todos"); //Deletes todos collection
Console.WriteLine(response.StatusCode);
```
#### Listen **Streaming from the REST API**
```csharp
EventStreamResponse response = await _client.OnAsync("chat", (sender, args, context) => {
System.Console.WriteLine(args.Data);
});//Call dispose to stop listening for events
response.Dispose();
```## Release Notes
**5.0**
- Firesharp now supports .NET5**2.1**
- Firesharp now is a Net Standard library, so it's available for every platform.**2.0**
- Use Microsoft HTTP Client Libraries instead of RestSharp
- FireSharp is now Portable Library
- Supports Streaming from the REST API (Firebase REST endpoints support the EventSource / Server-Sent Events protocol.)
- It is fully asynchronous and designed to be non-blockingMore information about Firebase and the Firebase API is available at the
[official website](http://www.firebase.com/).