FIRQuerySnapshot.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. NS_ASSUME_NONNULL_BEGIN
  18. @class FIRDocumentChange;
  19. @class FIRQuery;
  20. @class FIRQueryDocumentSnapshot;
  21. @class FIRSnapshotMetadata;
  22. /**
  23. * A `FIRQuerySnapshot` contains zero or more `FIRDocumentSnapshot` objects. It can be enumerated
  24. * using "for ... in documentSet.documents" and its size can be inspected with `isEmpty` and
  25. * `count`.
  26. */
  27. NS_SWIFT_NAME(QuerySnapshot)
  28. @interface FIRQuerySnapshot : NSObject
  29. /** :nodoc: */
  30. - (id)init __attribute__((unavailable("FIRQuerySnapshot cannot be created directly.")));
  31. /**
  32. * The query on which you called `getDocuments` or listened to in order to get this
  33. * `FIRQuerySnapshot`.
  34. */
  35. @property(nonatomic, strong, readonly) FIRQuery *query;
  36. /** Metadata about this snapshot, concerning its source and if it has local modifications. */
  37. @property(nonatomic, strong, readonly) FIRSnapshotMetadata *metadata;
  38. /** Indicates whether this `FIRQuerySnapshot` is empty (contains no documents). */
  39. @property(nonatomic, readonly, getter=isEmpty) BOOL empty;
  40. /** The count of documents in this `FIRQuerySnapshot`. */
  41. @property(nonatomic, readonly) NSInteger count;
  42. /** An Array of the `FIRDocumentSnapshots` that make up this document set. */
  43. @property(nonatomic, strong, readonly) NSArray<FIRQueryDocumentSnapshot *> *documents;
  44. /**
  45. * An array of the documents that changed since the last snapshot. If this is the first snapshot,
  46. * all documents will be in the list as Added changes.
  47. */
  48. @property(nonatomic, strong, readonly) NSArray<FIRDocumentChange *> *documentChanges;
  49. /**
  50. * Returns an array of the documents that changed since the last snapshot. If this is the first
  51. * snapshot, all documents will be in the list as Added changes.
  52. *
  53. * @param includeMetadataChanges Whether metadata-only changes (i.e. only
  54. * `FIRDocumentSnapshot.metadata` changed) should be included.
  55. */
  56. - (NSArray<FIRDocumentChange *> *)documentChangesWithIncludeMetadataChanges:
  57. (BOOL)includeMetadataChanges NS_SWIFT_NAME(documentChanges(includeMetadataChanges:));
  58. @end
  59. NS_ASSUME_NONNULL_END