From e6181c24124d97f2fbc932b8a68311e625463156 Mon Sep 17 00:00:00 2001 From: uzvkl Date: Tue, 11 Jun 2019 23:05:52 +0200 Subject: Move dsa related stuff to subfolder --- dsa/FireBase/FirebaseClient.cs | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 dsa/FireBase/FirebaseClient.cs (limited to 'dsa/FireBase/FirebaseClient.cs') diff --git a/dsa/FireBase/FirebaseClient.cs b/dsa/FireBase/FirebaseClient.cs new file mode 100644 index 0000000..3079f3b --- /dev/null +++ b/dsa/FireBase/FirebaseClient.cs @@ -0,0 +1,49 @@ +using System; +using System.Net.Http; +using System.Runtime.CompilerServices; +using Firebase.Database.Query; + +[assembly: InternalsVisibleTo("Firebase.Database.Tests")] + +namespace Firebase.Database +{ + /// + /// Firebase client which acts as an entry point to the online database. + /// + public class FirebaseClient : IDisposable + { + private readonly string baseUrl; + internal readonly HttpClient HttpClient; + internal readonly FirebaseOptions Options; + + /// + /// Initializes a new instance of the class. + /// + /// The base url. + /// Offline database. + public FirebaseClient(string baseUrl, FirebaseOptions options = null) + { + HttpClient = new HttpClient(); + Options = options ?? new FirebaseOptions(); + + this.baseUrl = baseUrl; + + if (!this.baseUrl.EndsWith("/")) this.baseUrl += "/"; + } + + public void Dispose() + { + HttpClient?.Dispose(); + } + + /// + /// Queries for a child of the data root. + /// + /// Name of the child. + /// . + public ChildQuery Child(string resourceName) + { + return new ChildQuery(this, () => baseUrl + resourceName); + } + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf