示例#1
0
 public static async Task <object> UpdateAsync(this IFirebaseAdminRef firebaseRef, Dictionary <string, object> content)
 {
     if (content == null || content.Count == 0)
     {
         throw new ArgumentNullException(nameof(content));
     }
     return(await firebaseRef.HttpClient.UpdatePathAsync(firebaseRef.Path, content));
 }
示例#2
0
 public static async Task <string> PushAsync <T>(this IFirebaseAdminRef firebaseRef, T content)
 {
     if (content == null)
     {
         throw new ArgumentNullException(nameof(content));
     }
     return(await firebaseRef.HttpClient.PushToPathAsync(firebaseRef.Path, content));
 }
示例#3
0
 public static IFirebaseAdminRef OrderBy(this IFirebaseAdminRef firebaseRef, string value)
 {
     if (string.IsNullOrWhiteSpace(value))
     {
         throw new ArgumentNullException(nameof(value));
     }
     firebaseRef.Add("orderBy", $"\"{value}\"");
     return(firebaseRef);
 }
示例#4
0
        private static Uri PrepareUri(IFirebaseAdminRef firebaseRef)
        {
            var queryStore  = firebaseRef.GetQueryStore();
            var queryParams = new StringBuilder("?");

            foreach (var param in queryStore)
            {
                queryParams.Append($"{param.Key}={param.Value}&");
            }

            return(new Uri(firebaseRef.Path + queryParams, UriKind.Relative));
        }
 public static IFirebaseAdminRef StartAt(this IFirebaseAdminRef firebaseRef, bool value)
 {
     firebaseRef.AddBool(StartAtValue, value);
     return(firebaseRef);
 }
 public static IFirebaseAdminRef StartAt(this IFirebaseAdminRef firebaseRef, string value)
 {
     firebaseRef.AddString(StartAtValue, value);
     return(firebaseRef);
 }
示例#7
0
 public static IFirebaseAdminRef EndAt(this IFirebaseAdminRef firebaseRef, decimal value)
 {
     firebaseRef.Add(EndAtValue, value.ToString());
     return(firebaseRef);
 }
示例#8
0
        public async static Task <IList <T> > GetWithKeyInjectedAsync <T>(this IFirebaseAdminRef firebaseRef) where T : KeyEntity
        {
            var uri = PrepareUri(firebaseRef);

            return(await firebaseRef.HttpClient.GetFromPathAsyncWithKeyInjected <T>(uri));
        }
示例#9
0
 public static object Update(this IFirebaseAdminRef firebaseRef, Dictionary <string, object> content) => firebaseRef.HttpClient.UpdatePathAsync(firebaseRef.Path, content).Result;
示例#10
0
 public static T Get <T>(this IFirebaseAdminRef firebaseRef) =>
 GetAsync <T>(firebaseRef).Result;
 public static IFirebaseAdminRef LimitToLast(this IFirebaseAdminRef firebaseRef, long value)
 {
     firebaseRef.Add("limitToLast", value.ToString());
     return(firebaseRef);
 }
示例#12
0
 public static IFirebaseAdminRef EqualTo(this IFirebaseAdminRef firebaseRef, bool value)
 {
     firebaseRef.AddBool(EqualToValue, value);
     return(firebaseRef);
 }
示例#13
0
 public static T Set <T>(this IFirebaseAdminRef firebaseRef, T content) => SetAsync(firebaseRef, content).Result;
示例#14
0
 public static List <T> GetArrayWithKeyInjected <T>(this IFirebaseAdminRef firebaseRef) where T : KeyEntity =>
 GetArrayWithKeyInjectedAsync <T>(firebaseRef).Result;
示例#15
0
 public static async Task <List <T> > GetArrayWithKeyInjectedAsync <T>(this IFirebaseAdminRef firebaseRef) where T : KeyEntity =>
 await firebaseRef.HttpClient.GetArrayFromPathAsyncWithKeyInjected <T>(PrepareUri(firebaseRef));
示例#16
0
 public static async Task <List <T> > GetArrayAsync <T>(this IFirebaseAdminRef firebaseRef) =>
 await firebaseRef.HttpClient.GetArrayFromPathAsync <T>(PrepareUri(firebaseRef));
示例#17
0
 public static List <T> GetArray <T>(this IFirebaseAdminRef firebaseRef) =>
 GetArrayAsync <T>(firebaseRef).Result;
 public static IFirebaseAdminRef StartAt(this IFirebaseAdminRef firebaseRef, int value)
 {
     firebaseRef.Add(StartAtValue, value.ToString());
     return(firebaseRef);
 }
示例#19
0
 public static string Push <T>(this IFirebaseAdminRef firebaseRef, T content) => PushAsync(firebaseRef, content).Result;
示例#20
0
 public static T Set <T>(this IFirebaseAdminRef firebaseRef, T content)
 {
     return(SetAsync(firebaseRef, content).Result);
 }
示例#21
0
        public async static Task <T> GetAsync <T>(this IFirebaseAdminRef firebaseRef)
        {
            var uri = PrepareUri(firebaseRef);

            return(await firebaseRef.HttpClient.GetFromPathAsync <T>(uri));
        }
示例#22
0
 public static IFirebaseAdminRef EqualTo(this IFirebaseAdminRef firebaseRef, string value)
 {
     firebaseRef.AddString(EqualToValue, value);
     return(firebaseRef);
 }
示例#23
0
 public static IList <T> GetWithKeyInjected <T>(this IFirebaseAdminRef firebaseRef) where T : KeyEntity
 {
     return(GetWithKeyInjectedAsync <T>(firebaseRef).Result);
 }
示例#24
0
 public static IFirebaseAdminRef EqualTo(this IFirebaseAdminRef firebaseRef, int value)
 {
     firebaseRef.Add(EqualToValue, value.ToString());
     return(firebaseRef);
 }
示例#25
0
 public static async Task DeleteAsync(this IFirebaseAdminRef firebaseRef) => await firebaseRef.HttpClient.DeleteFromPathAsync(firebaseRef.Path);
示例#26
0
 public static void Delete(this IFirebaseAdminRef firebaseRef) => DeleteAsync(firebaseRef).Wait();
示例#27
0
 public static T Get <T>(this IFirebaseAdminRef firebaseRef)
 {
     return(GetAsync <T>(firebaseRef).Result);
 }