summaryrefslogtreecommitdiff
path: root/FireBase/Query/OrderQuery.cs
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-09-29 16:51:26 +0200
committerTrueDoctor <d-kobert@web.de>2018-09-29 16:51:26 +0200
commitde0f076ef9ff546c9a90513259ad6c42cd2224b3 (patch)
tree995d766417fd2093d7950694ef17f3c84b7f1042 /FireBase/Query/OrderQuery.cs
parent04912687127303fd270b61f131cf68fd4aaae956 (diff)
added firebase api
Diffstat (limited to 'FireBase/Query/OrderQuery.cs')
-rw-r--r--FireBase/Query/OrderQuery.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/FireBase/Query/OrderQuery.cs b/FireBase/Query/OrderQuery.cs
new file mode 100644
index 0000000..46ebd2c
--- /dev/null
+++ b/FireBase/Query/OrderQuery.cs
@@ -0,0 +1,34 @@
+namespace Firebase.Database.Query
+{
+ using System;
+
+ /// <summary>
+ /// Represents a firebase ordering query, e.g. "?OrderBy=Foo".
+ /// </summary>
+ public class OrderQuery : ParameterQuery
+ {
+ private readonly Func<string> propertyNameFactory;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="OrderQuery"/> class.
+ /// </summary>
+ /// <param name="parent"> The query parent. </param>
+ /// <param name="propertyNameFactory"> The property name. </param>
+ /// <param name="client"> The owning client. </param>
+ public OrderQuery(ChildQuery parent, Func<string> propertyNameFactory, FirebaseClient client)
+ : base(parent, () => "orderBy", client)
+ {
+ this.propertyNameFactory = propertyNameFactory;
+ }
+
+ /// <summary>
+ /// The build url parameter.
+ /// </summary>
+ /// <param name="child"> The child. </param>
+ /// <returns> The <see cref="string"/>. </returns>
+ protected override string BuildUrlParameter(FirebaseQuery child)
+ {
+ return $"\"{this.propertyNameFactory()}\"";
+ }
+ }
+}