diff options
author | natrixaeria <janng@gmx.de> | 2019-05-19 17:40:59 +0200 |
---|---|---|
committer | natrixaeria <janng@gmx.de> | 2019-05-19 17:40:59 +0200 |
commit | 1509b5ef3d7e9e71d9294e234ec0e39f2d831998 (patch) | |
tree | 78300ffff230958101b422a4e6026925b287822f /FireBase/FirebaseClient.cs | |
parent | c3bb858bb54dc8c64bbd48054c2c58dc0073f09c (diff) | |
parent | c4d046858e0822b7c2c540ac2368b2c0e88e7a26 (diff) |
Merge branch 'scribble' of https://github.com/TrueDoctor/DiscoBot into scribble
Diffstat (limited to 'FireBase/FirebaseClient.cs')
-rw-r--r-- | FireBase/FirebaseClient.cs | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/FireBase/FirebaseClient.cs b/FireBase/FirebaseClient.cs index a237c8d..3079f3b 100644 --- a/FireBase/FirebaseClient.cs +++ b/FireBase/FirebaseClient.cs @@ -1,57 +1,49 @@ +using System; using System.Net.Http; +using System.Runtime.CompilerServices; +using Firebase.Database.Query; -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Firebase.Database.Tests")] +[assembly: InternalsVisibleTo("Firebase.Database.Tests")] namespace Firebase.Database { - using System; - using System.Collections.Generic; - using System.Threading.Tasks; - - using Firebase.Database.Offline; - using Firebase.Database.Query; - /// <summary> - /// Firebase client which acts as an entry point to the online database. + /// Firebase client which acts as an entry point to the online database. /// </summary> public class FirebaseClient : IDisposable { + private readonly string baseUrl; internal readonly HttpClient HttpClient; internal readonly FirebaseOptions Options; - private readonly string baseUrl; - /// <summary> - /// Initializes a new instance of the <see cref="FirebaseClient"/> class. + /// Initializes a new instance of the <see cref="FirebaseClient" /> class. /// </summary> /// <param name="baseUrl"> The base url. </param> - /// <param name="offlineDatabaseFactory"> Offline database. </param> + /// <param name="offlineDatabaseFactory"> Offline database. </param> public FirebaseClient(string baseUrl, FirebaseOptions options = null) { - this.HttpClient = new HttpClient(); - this.Options = options ?? new FirebaseOptions(); + HttpClient = new HttpClient(); + Options = options ?? new FirebaseOptions(); this.baseUrl = baseUrl; - if (!this.baseUrl.EndsWith("/")) - { - this.baseUrl += "/"; - } + if (!this.baseUrl.EndsWith("/")) this.baseUrl += "/"; + } + + public void Dispose() + { + HttpClient?.Dispose(); } /// <summary> - /// Queries for a child of the data root. + /// Queries for a child of the data root. /// </summary> /// <param name="resourceName"> Name of the child. </param> - /// <returns> <see cref="ChildQuery"/>. </returns> + /// <returns> <see cref="ChildQuery" />. </returns> public ChildQuery Child(string resourceName) { - return new ChildQuery(this, () => this.baseUrl + resourceName); - } - - public void Dispose() - { - HttpClient?.Dispose(); + return new ChildQuery(this, () => baseUrl + resourceName); } } -} +}
\ No newline at end of file |