/// <summary> /// Initializes a new instance of the <see cref="FirebaseQuery"/> class. /// </summary> /// <param name="parent"> The parent of this query. </param> /// <param name="client"> The owning client. </param> protected FirebaseQuery(FirebaseQuery parent, FirebaseClient client) { this.Client = client; this.Parent = parent; }
/// <summary> /// Build the url parameter value of this child. /// </summary> /// <param name="child"> The child of this child. </param> /// <returns> The <see cref="string"/>. </returns> protected override string BuildUrlParameter(FirebaseQuery child) { return(this.tokenFactory()); }
/// <summary> /// Build the url segment of this child. /// </summary> /// <param name="child"> The child of this query. </param> /// <returns> The <see cref="string"/>. </returns> protected abstract string BuildUrlSegment(FirebaseQuery child);
/// <summary> /// Initializes a new instance of the <see cref="AuthQuery"/> class. /// </summary> /// <param name="parent"> The parent. </param> /// <param name="tokenFactory"> The authentication token factory. </param> /// <param name="client"> The owner. </param> public AuthQuery(FirebaseQuery parent, Func <string> tokenFactory, FirebaseClient client) : base(parent, () => client.Options.AsAccessToken ? "access_token" : "auth", client) { this.tokenFactory = tokenFactory; }
/// <summary> /// Appends print=silent to save bandwidth. /// </summary> /// <param name="node"> The child. </param> /// <returns> The <see cref="SilentQuery"/>. </returns> internal static SilentQuery Silent(this FirebaseQuery node) { return(new SilentQuery(node, node.Client)); }
public static async Task <FirebaseObject <T> > PostAsync <T>(this FirebaseQuery query, T obj, bool generateKeyOffline = true) { var result = await query.PostAsync(JsonConvert.SerializeObject(obj, query.Client.Options.JsonSerializerSettings), generateKeyOffline); return(new FirebaseObject <T>(result.Key, obj)); }
public static Task PatchAsync <T>(this FirebaseQuery query, T obj) { return(query.PatchAsync(JsonConvert.SerializeObject(obj, query.Client.Options.JsonSerializerSettings))); }
/// <summary> /// Adds an auth parameter to the query. /// </summary> /// <param name="node"> The child. </param> /// <param name="token"> The auth token. </param> /// <returns> The <see cref="AuthQuery"/>. </returns> internal static AuthQuery WithAuth(this FirebaseQuery node, string token) { return(node.WithAuth(() => token)); }