bugthesystem / FireSharp

An asynchronous cross-platform .Net library for Firebase
The Unlicense
696 stars 147 forks source link

Firebase server timestamp #36

Closed TiagoGouvea closed 8 years ago

TiagoGouvea commented 8 years ago

I tried to send data with server timestamp in FireSharp, but without success.

My references: https://www.firebase.com/docs/web/api/servervalue/timestamp.html to javascript http://stackoverflow.com/questions/26129077/can-firebase-server-timestamps-be-written-without-making-two-requests to REST

How to do it with FireSharp?

AndreiEzhov commented 8 years ago

If you log the Firebase.ServerValue.TIMESTAMP value from the Javascript API you'll see that it's just an object with a special server value key (.sv) with the value "timestamp". {.sv: "timestamp"}

You can create a property like that on your class and have it be serialized with the rest of it. I created a gist.

TiagoGouvea commented 8 years ago

Great! Thanks!

AndreiEzhov commented 8 years ago

BTW, I updated it to something that may be easier.