using System;
namespace Firebase.Database.Query
{
///
/// Represents an auth parameter in firebase query, e.g. "?auth=xyz".
///
public class AuthQuery : ParameterQuery
{
private readonly Func tokenFactory;
///
/// Initializes a new instance of the class.
///
/// The parent.
/// The authentication token factory.
/// The owner.
public AuthQuery(FirebaseQuery parent, Func tokenFactory, FirebaseClient client) : base(parent,
() => client.Options.AsAccessToken ? "access_token" : "auth", client)
{
this.tokenFactory = tokenFactory;
}
///
/// Build the url parameter value of this child.
///
/// The child of this child.
/// The .
protected override string BuildUrlParameter(FirebaseQuery child)
{
return tokenFactory();
}
}
}