Giter Site home page Giter Site logo

kekedaine / firesharp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bugthesystem/firesharp

0.0 0.0 0.0 1.14 MB

.Net client library for Firebase

Home Page: https://www.patreon.com/ziyasal

License: MIT License

C# 96.66% ASP 0.12% JavaScript 1.72% Shell 1.50%

firesharp's Introduction

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 status Coverage Status Stories 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?


  IFirebaseConfig config = new FirebaseConfig
  {
     AuthSecret = "your_firebase_secret",
     BasePath = "https://yourfirebase.firebaseio.com/"
  };
IFirebaseClient  client = new FirebaseClient(config);

So far, supported methods are :

####Set

var todo = new Todo {
                name = "Execute SET",
                priority = 2
            };
SetResponse response = await _client.SetAsync("todos/set", todo);
Todo result = response.ResultAs<Todo>(); //The response will contain the data written

####Push

 var 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

 FirebaseResponse response = await _client.GetAsync("todos/set");
 Todo todo=response.ResultAs<Todo>(); //The response will contain the data being retreived

####Update

var todo = new Todo {
                name = "Execute UPDATE!",
                priority = 1
            };

FirebaseResponse response =await  _client.UpdateAsync("todos/set", todo);
Todo todo = response.ResultAs<Todo>(); //The response will contain the data written

####Delete

FirebaseResponse response =await  _client.DeleteAsync("todos"); //Deletes todos collection
Console.WriteLine(response.StatusCode);

####Listen Streaming from the REST API

EventStreamResponse response = await _client.OnAsync("chat", (sender, args) => {
       System.Console.WriteLine(args.Data);
});

//Call dispose to stop listening for events
response.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).

firesharp's People

Contributors

bugthesystem avatar davidrieman avatar ernestopedrosa avatar iurmsepol avatar kevindfs avatar moonpyk avatar pjhuck avatar tillerstarredwards avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.