summaryrefslogtreecommitdiff
path: root/dsa/FireBase/Offline/SetHandler.cs
blob: 6314c3c84883d44a08af1d642ac2695b044443ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System.Threading.Tasks;
using Firebase.Database.Query;

namespace Firebase.Database.Offline
{
    public class SetHandler<T> : ISetHandler<T>
    {
        public virtual async Task SetAsync(ChildQuery query, string key, OfflineEntry entry)
        {
            using (var child = query.Child(key))
            {
                if (entry.SyncOptions == SyncOptions.Put)
                    await child.PutAsync(entry.Data);
                else
                    await child.PatchAsync(entry.Data);
            }
        }
    }
}