summaryrefslogtreecommitdiff
path: root/FireBase/FirebaseOptions.cs
blob: 990595647ff059e8b15ff3b30fb6084a52a39a7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
namespace Firebase.Database
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Threading.Tasks;

    using Firebase.Database.Offline;

    using Newtonsoft.Json;

    public class FirebaseOptions
    {
        public FirebaseOptions()
        {
            this.OfflineDatabaseFactory = (t, s) => new Dictionary<string, OfflineEntry>();
            this.SubscriptionStreamReaderFactory = s => new StreamReader(s);
            this.JsonSerializerSettings = new JsonSerializerSettings();
            this.SyncPeriod = TimeSpan.FromSeconds(10);
        }

        /// <summary>
        /// Gets or sets the factory for Firebase offline database. Default is in-memory dictionary.
        /// </summary>
        public Func<Type, string, IDictionary<string, OfflineEntry>> OfflineDatabaseFactory
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the method for retrieving auth tokens. Default is null.
        /// </summary>
        public Func<Task<string>> AuthTokenAsyncFactory
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the factory for <see cref="TextReader"/> used for reading online streams. Default is <see cref="StreamReader"/>.
        /// </summary>
        public Func<Stream, TextReader> SubscriptionStreamReaderFactory
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the json serializer settings.
        /// </summary>
        public JsonSerializerSettings JsonSerializerSettings
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the time between synchronization attempts for pulling and pushing offline entities. Default is 10 seconds.
        /// </summary>
        public TimeSpan SyncPeriod
        {
            get;
            set;
        }

        /// <summary>
        /// Specify if token returned by factory will be used as "auth" url parameter or "access_token". 
        /// </summary>
        public bool AsAccessToken
        {
            get;
            set;
        }
    }
}