summaryrefslogtreecommitdiff
path: root/dsa/FireBase/Offline/SetHandler.cs
blob: c683fdd18109f82c5b8cf0a01e015fc2a1426d44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
            }
        }
    }
}