FIRAggregateQuerySnapshot+Internal.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2022 Google LLC
  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 "FIRAggregateQuerySnapshot.h"
  17. #import "FIRAggregateField.h"
  18. #import "FIRDocumentSnapshot.h"
  19. #include "Firestore/core/src/api/api_fwd.h"
  20. @class FIRAggregateQuery;
  21. namespace model = firebase::firestore::model;
  22. NS_ASSUME_NONNULL_BEGIN
  23. @interface FIRAggregateQuerySnapshot (/* init */)
  24. - (instancetype)init NS_UNAVAILABLE;
  25. - (instancetype)initWithObject:(model::ObjectValue)result
  26. query:(FIRAggregateQuery *)query NS_DESIGNATED_INITIALIZER;
  27. @end
  28. // TODO(sum/avg) move the contents of this FuturePublicApi category to
  29. // ../Public/FirebaseFirestore/FIRAggregateQuerySnapshot.h
  30. @interface FIRAggregateQuerySnapshot (FuturePublicApi)
  31. /**
  32. * Gets the aggregation result for the specified aggregation without loss of precision. No coercion
  33. * of data types or values is performed.
  34. *
  35. * See the `AggregateField` class for the expected aggregration result values and types. Numeric
  36. * aggregation results will be boxed in an `NSNumber`.
  37. *
  38. * @param aggregation An instance of `AggregateField` that specifies which aggregation result to
  39. * return.
  40. * @return Returns the aggregation result from the server without loss of precision.
  41. * @warning Throws an `InvalidArgument` exception if the aggregation was not requested in the
  42. * `AggregateQuery`.
  43. * @see `AggregateField`
  44. */
  45. - (nullable id)valueForAggregation:(FIRAggregateField *)aggregation NS_SWIFT_NAME(get(_:));
  46. @end
  47. NS_ASSUME_NONNULL_END