示例#1
0
 /// <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;
 }
示例#2
0
 /// <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());
 }
示例#3
0
 /// <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);
示例#4
0
 /// <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;
 }
示例#5
0
 /// <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));
 }
示例#6
0
        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));
        }
示例#7
0
 public static Task PatchAsync <T>(this FirebaseQuery query, T obj)
 {
     return(query.PatchAsync(JsonConvert.SerializeObject(obj, query.Client.Options.JsonSerializerSettings)));
 }
示例#8
0
 /// <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));
 }