FQueryParams.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. @protocol FIndex
  18. , FNodeFilter, FNode;
  19. @interface FQueryParams : NSObject <NSCopying>
  20. @property(nonatomic, readonly) BOOL limitSet;
  21. @property(nonatomic, readonly) NSInteger limit;
  22. @property(nonatomic, strong, readonly) NSString *viewFrom;
  23. @property(nonatomic, strong, readonly) id<FNode> indexStartValue;
  24. @property(nonatomic, strong, readonly) NSString *indexStartKey;
  25. @property(nonatomic, strong, readonly) id<FNode> indexEndValue;
  26. @property(nonatomic, strong, readonly) NSString *indexEndKey;
  27. @property(nonatomic, strong, readonly) id<FIndex> index;
  28. - (BOOL)loadsAllData;
  29. - (BOOL)isDefault;
  30. - (BOOL)isValid;
  31. - (BOOL)hasAnchoredLimit;
  32. - (FQueryParams *)limitTo:(NSInteger)limit;
  33. - (FQueryParams *)limitToFirst:(NSInteger)newLimit;
  34. - (FQueryParams *)limitToLast:(NSInteger)newLimit;
  35. - (FQueryParams *)startAt:(id<FNode>)indexValue childKey:(NSString *)key;
  36. - (FQueryParams *)startAt:(id<FNode>)indexValue;
  37. - (FQueryParams *)endAt:(id<FNode>)indexValue childKey:(NSString *)key;
  38. - (FQueryParams *)endAt:(id<FNode>)indexValue;
  39. - (FQueryParams *)orderBy:(id<FIndex>)index;
  40. + (FQueryParams *)defaultInstance;
  41. + (FQueryParams *)fromQueryObject:(NSDictionary *)dict;
  42. - (BOOL)hasStart;
  43. - (BOOL)hasEnd;
  44. - (NSDictionary *)wireProtocolParams;
  45. - (BOOL)isViewFromLeft;
  46. - (id<FNodeFilter>)nodeFilter;
  47. @end