adding pods method of package managing
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol FIRAppCheckTokenResultInterop;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(AppCheckTokenHandlerInterop)
|
||||
typedef void (^FIRAppCheckTokenHandlerInterop)(id<FIRAppCheckTokenResultInterop> tokenResult);
|
||||
|
||||
@protocol FIRAppCheckInterop <NSObject>
|
||||
|
||||
/// Retrieve a cached or generate a new FAA Token. If forcingRefresh == YES always generates a new
|
||||
/// token and updates the cache.
|
||||
- (void)getTokenForcingRefresh:(BOOL)forcingRefresh
|
||||
completion:(FIRAppCheckTokenHandlerInterop)handler
|
||||
NS_SWIFT_NAME(getToken(forcingRefresh:completion:));
|
||||
|
||||
/// A notification with the specified name is sent to the default notification center
|
||||
/// (`NotificationCenter.default`) each time a Firebase app check token is refreshed.
|
||||
/// The user info dictionary contains `-[self notificationTokenKey]` and
|
||||
/// `-[self notificationAppNameKey]` keys.
|
||||
- (NSString *)tokenDidChangeNotificationName;
|
||||
|
||||
/// `userInfo` key for the FAC token in a notification for `tokenDidChangeNotificationName`.
|
||||
- (NSString *)notificationTokenKey;
|
||||
/// `userInfo` key for the `FirebaseApp.name` in a notification for
|
||||
/// `tokenDidChangeNotificationName`.
|
||||
- (NSString *)notificationAppNameKey;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol FIRAppCheckTokenResultInterop <NSObject>
|
||||
|
||||
/// App Check token in the case of success or a dummy token in the case of a failure.
|
||||
/// In general, the value of the token should always be set to the request header.
|
||||
@property(nonatomic, readonly) NSString *token;
|
||||
|
||||
/// A token fetch error in the case of a failure or `nil` in the case of success.
|
||||
@property(nonatomic, readonly, nullable) NSError *error;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <FirebaseCore/FIRApp.h>
|
||||
|
||||
@class FIRComponentContainer;
|
||||
@protocol FIRLibrary;
|
||||
|
||||
/**
|
||||
* The internal interface to FIRApp. This is meant for first-party integrators, who need to receive
|
||||
* FIRApp notifications, log info about the success or failure of their configuration, and access
|
||||
* other internal functionality of FIRApp.
|
||||
*
|
||||
* TODO(b/28296561): Restructure this header.
|
||||
*/
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, FIRConfigType) {
|
||||
FIRConfigTypeCore = 1,
|
||||
FIRConfigTypeSDK = 2,
|
||||
};
|
||||
|
||||
extern NSString *const kFIRDefaultAppName;
|
||||
extern NSString *const kFIRAppReadyToConfigureSDKNotification;
|
||||
extern NSString *const kFIRAppDeleteNotification;
|
||||
extern NSString *const kFIRAppIsDefaultAppKey;
|
||||
extern NSString *const kFIRAppNameKey;
|
||||
extern NSString *const kFIRGoogleAppIDKey;
|
||||
extern NSString *const kFirebaseCoreErrorDomain;
|
||||
|
||||
/** The NSUserDefaults suite name for FirebaseCore, for those storage locations that use it. */
|
||||
extern NSString *const kFirebaseCoreDefaultsSuiteName;
|
||||
|
||||
/**
|
||||
* The format string for the User Defaults key used for storing the data collection enabled flag.
|
||||
* This includes formatting to append the Firebase App's name.
|
||||
*/
|
||||
extern NSString *const kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat;
|
||||
|
||||
/**
|
||||
* The plist key used for storing the data collection enabled flag.
|
||||
*/
|
||||
extern NSString *const kFIRGlobalAppDataCollectionEnabledPlistKey;
|
||||
|
||||
/** @var FIRAuthStateDidChangeInternalNotification
|
||||
@brief The name of the @c NSNotificationCenter notification which is posted when the auth state
|
||||
changes (e.g. a new token has been produced, a user logs in or out). The object parameter of
|
||||
the notification is a dictionary possibly containing the key:
|
||||
@c FIRAuthStateDidChangeInternalNotificationTokenKey (the new access token.) If it does not
|
||||
contain this key it indicates a sign-out event took place.
|
||||
*/
|
||||
extern NSString *const FIRAuthStateDidChangeInternalNotification;
|
||||
|
||||
/** @var FIRAuthStateDidChangeInternalNotificationTokenKey
|
||||
@brief A key present in the dictionary object parameter of the
|
||||
@c FIRAuthStateDidChangeInternalNotification notification. The value associated with this
|
||||
key will contain the new access token.
|
||||
*/
|
||||
extern NSString *const FIRAuthStateDidChangeInternalNotificationTokenKey;
|
||||
|
||||
/** @var FIRAuthStateDidChangeInternalNotificationAppKey
|
||||
@brief A key present in the dictionary object parameter of the
|
||||
@c FIRAuthStateDidChangeInternalNotification notification. The value associated with this
|
||||
key will contain the FIRApp associated with the auth instance.
|
||||
*/
|
||||
extern NSString *const FIRAuthStateDidChangeInternalNotificationAppKey;
|
||||
|
||||
/** @var FIRAuthStateDidChangeInternalNotificationUIDKey
|
||||
@brief A key present in the dictionary object parameter of the
|
||||
@c FIRAuthStateDidChangeInternalNotification notification. The value associated with this
|
||||
key will contain the new user's UID (or nil if there is no longer a user signed in).
|
||||
*/
|
||||
extern NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey;
|
||||
|
||||
@interface FIRApp ()
|
||||
|
||||
/**
|
||||
* A flag indicating if this is the default app (has the default app name).
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isDefaultApp;
|
||||
|
||||
/*
|
||||
* The container of interop SDKs for this app.
|
||||
*/
|
||||
@property(nonatomic) FIRComponentContainer *container;
|
||||
|
||||
/**
|
||||
* Checks if the default app is configured without trying to configure it.
|
||||
*/
|
||||
+ (BOOL)isDefaultAppConfigured;
|
||||
|
||||
/**
|
||||
* Registers a given third-party library with the given version number to be reported for
|
||||
* analytics.
|
||||
*
|
||||
* @param name Name of the library.
|
||||
* @param version Version of the library.
|
||||
*/
|
||||
+ (void)registerLibrary:(nonnull NSString *)name withVersion:(nonnull NSString *)version;
|
||||
|
||||
/**
|
||||
* Registers a given internal library to be reported for analytics.
|
||||
*
|
||||
* @param library Optional parameter for component registration.
|
||||
* @param name Name of the library.
|
||||
*/
|
||||
+ (void)registerInternalLibrary:(nonnull Class<FIRLibrary>)library
|
||||
withName:(nonnull NSString *)name;
|
||||
|
||||
/**
|
||||
* Registers a given internal library with the given version number to be reported for
|
||||
* analytics. This should only be used for non-Firebase libraries that have their own versioning
|
||||
* scheme.
|
||||
*
|
||||
* @param library Optional parameter for component registration.
|
||||
* @param name Name of the library.
|
||||
* @param version Version of the library.
|
||||
*/
|
||||
+ (void)registerInternalLibrary:(nonnull Class<FIRLibrary>)library
|
||||
withName:(nonnull NSString *)name
|
||||
withVersion:(nonnull NSString *)version;
|
||||
|
||||
/**
|
||||
* A concatenated string representing all the third-party libraries and version numbers.
|
||||
*/
|
||||
+ (NSString *)firebaseUserAgent;
|
||||
|
||||
/**
|
||||
* Can be used by the unit tests in eack SDK to reset FIRApp. This method is thread unsafe.
|
||||
*/
|
||||
+ (void)resetApps;
|
||||
|
||||
/**
|
||||
* Can be used by the unit tests in each SDK to set customized options.
|
||||
*/
|
||||
- (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)options;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright 2018 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class FIRApp;
|
||||
@class FIRComponentContainer;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// Provides a system to clean up cached instances returned from the component system.
|
||||
NS_SWIFT_NAME(ComponentLifecycleMaintainer)
|
||||
@protocol FIRComponentLifecycleMaintainer
|
||||
/// The associated app will be deleted, clean up any resources as they are about to be deallocated.
|
||||
- (void)appWillBeDeleted:(FIRApp *)app;
|
||||
@end
|
||||
|
||||
typedef _Nullable id (^FIRComponentCreationBlock)(FIRComponentContainer *container,
|
||||
BOOL *isCacheable)
|
||||
NS_SWIFT_NAME(ComponentCreationBlock);
|
||||
|
||||
@class FIRDependency;
|
||||
|
||||
/// Describes the timing of instantiation. Note: new components should default to lazy unless there
|
||||
/// is a strong reason to be eager.
|
||||
typedef NS_ENUM(NSInteger, FIRInstantiationTiming) {
|
||||
FIRInstantiationTimingLazy,
|
||||
FIRInstantiationTimingAlwaysEager,
|
||||
FIRInstantiationTimingEagerInDefaultApp
|
||||
} NS_SWIFT_NAME(InstantiationTiming);
|
||||
|
||||
/// A component that can be used from other Firebase SDKs.
|
||||
NS_SWIFT_NAME(Component)
|
||||
@interface FIRComponent : NSObject
|
||||
|
||||
/// The protocol describing functionality provided from the Component.
|
||||
@property(nonatomic, strong, readonly) Protocol *protocol;
|
||||
|
||||
/// The timing of instantiation.
|
||||
@property(nonatomic, readonly) FIRInstantiationTiming instantiationTiming;
|
||||
|
||||
/// An array of dependencies for the component.
|
||||
@property(nonatomic, copy, readonly) NSArray<FIRDependency *> *dependencies;
|
||||
|
||||
/// A block to instantiate an instance of the component with the appropriate dependencies.
|
||||
@property(nonatomic, copy, readonly) FIRComponentCreationBlock creationBlock;
|
||||
|
||||
// There's an issue with long NS_SWIFT_NAMES that causes compilation to fail, disable clang-format
|
||||
// for the next two methods.
|
||||
// clang-format off
|
||||
|
||||
/// Creates a component with no dependencies that will be lazily initialized.
|
||||
+ (instancetype)componentWithProtocol:(Protocol *)protocol
|
||||
creationBlock:(FIRComponentCreationBlock)creationBlock
|
||||
NS_SWIFT_NAME(init(_:creationBlock:));
|
||||
|
||||
/// Creates a component to be registered with the component container.
|
||||
///
|
||||
/// @param protocol - The protocol describing functionality provided by the component.
|
||||
/// @param instantiationTiming - When the component should be initialized. Use .lazy unless there's
|
||||
/// a good reason to be instantiated earlier.
|
||||
/// @param dependencies - Any dependencies the `implementingClass` has, optional or required.
|
||||
/// @param creationBlock - A block to instantiate the component with a container, and if
|
||||
/// @return A component that can be registered with the component container.
|
||||
+ (instancetype)componentWithProtocol:(Protocol *)protocol
|
||||
instantiationTiming:(FIRInstantiationTiming)instantiationTiming
|
||||
dependencies:(NSArray<FIRDependency *> *)dependencies
|
||||
creationBlock:(FIRComponentCreationBlock)creationBlock
|
||||
NS_SWIFT_NAME(init(_:instantiationTiming:dependencies:creationBlock:));
|
||||
|
||||
// clang-format on
|
||||
|
||||
/// Unavailable.
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2018 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// A type-safe macro to retrieve a component from a container. This should be used to retrieve
|
||||
/// components instead of using the container directly.
|
||||
#define FIR_COMPONENT(type, container) \
|
||||
[FIRComponentType<id<type>> instanceForProtocol:@protocol(type) inContainer:container]
|
||||
|
||||
@class FIRApp;
|
||||
|
||||
/// A container that holds different components that are registered via the
|
||||
/// `registerAsComponentRegistrant:` call. These classes should conform to `FIRComponentRegistrant`
|
||||
/// in order to properly register components for Core.
|
||||
NS_SWIFT_NAME(FirebaseComponentContainer)
|
||||
@interface FIRComponentContainer : NSObject
|
||||
|
||||
/// A weak reference to the app that an instance of the container belongs to.
|
||||
@property(nonatomic, weak, readonly) FIRApp *app;
|
||||
|
||||
/// Unavailable. Use the `container` property on `FIRApp`.
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2018 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class FIRComponentContainer;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// Do not use directly. A placeholder type in order to provide a macro that will warn users of
|
||||
/// mis-matched protocols.
|
||||
NS_SWIFT_NAME(ComponentType)
|
||||
@interface FIRComponentType<__covariant T> : NSObject
|
||||
|
||||
/// Do not use directly. A factory method to retrieve an instance that provides a specific
|
||||
/// functionality.
|
||||
+ (T)instanceForProtocol:(Protocol *)protocol inContainer:(FIRComponentContainer *)container;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2019 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class FIRDiagnosticsData;
|
||||
@class FIROptions;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Connects FIRCore with the CoreDiagnostics library. */
|
||||
@interface FIRCoreDiagnosticsConnector : NSObject
|
||||
|
||||
/** Logs FirebaseCore related data.
|
||||
*
|
||||
* @param options The options object containing data to log.
|
||||
*/
|
||||
+ (void)logCoreTelemetryWithOptions:(FIROptions *)options;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2018 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// A dependency on a specific protocol's functionality.
|
||||
NS_SWIFT_NAME(Dependency)
|
||||
@interface FIRDependency : NSObject
|
||||
|
||||
/// The protocol describing functionality being depended on.
|
||||
@property(nonatomic, strong, readonly) Protocol *protocol;
|
||||
|
||||
/// A flag to specify if the dependency is required or not.
|
||||
@property(nonatomic, readonly) BOOL isRequired;
|
||||
|
||||
/// Initializes a dependency that is required. Calls `initWithProtocol:isRequired` with `YES` for
|
||||
/// the required parameter.
|
||||
/// Creates a required dependency on the specified protocol's functionality.
|
||||
+ (instancetype)dependencyWithProtocol:(Protocol *)protocol;
|
||||
|
||||
/// Creates a dependency on the specified protocol's functionality and specify if it's required for
|
||||
/// the class's functionality.
|
||||
+ (instancetype)dependencyWithProtocol:(Protocol *)protocol isRequired:(BOOL)required;
|
||||
|
||||
/// Use `dependencyWithProtocol:isRequired:` instead.
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright 2019 Google
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRHeartbeatInfo : NSObject
|
||||
|
||||
// Enum representing the different heartbeat codes.
|
||||
typedef NS_ENUM(NSInteger, FIRHeartbeatInfoCode) {
|
||||
FIRHeartbeatInfoCodeNone = 0,
|
||||
FIRHeartbeatInfoCodeSDK = 1,
|
||||
FIRHeartbeatInfoCodeGlobal = 2,
|
||||
FIRHeartbeatInfoCodeCombined = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* Get heartbeat code required for the sdk.
|
||||
* @param heartbeatTag String representing the sdk heartbeat tag.
|
||||
* @return Heartbeat code indicating whether or not an sdk/global heartbeat
|
||||
* needs to be sent
|
||||
*/
|
||||
+ (FIRHeartbeatInfoCode)heartbeatCodeForTag:(NSString *)heartbeatTag;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2018 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FIRLibrary_h
|
||||
#define FIRLibrary_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class FIRApp;
|
||||
@class FIRComponent;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// Provide an interface to register a library for userAgent logging and availability to others.
|
||||
NS_SWIFT_NAME(Library)
|
||||
@protocol FIRLibrary
|
||||
|
||||
/// Returns one or more FIRComponents that will be registered in
|
||||
/// FIRApp and participate in dependency resolution and injection.
|
||||
+ (NSArray<FIRComponent *> *)componentsToRegister;
|
||||
|
||||
@optional
|
||||
/// Implement this method if the library needs notifications for lifecycle events. This method is
|
||||
/// called when the developer calls `FirebaseApp.configure()`.
|
||||
+ (void)configureWithApp:(FIRApp *)app;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#endif /* FIRLibrary_h */
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FirebaseCore/FIRLoggerLevel.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* The Firebase services used in Firebase logger.
|
||||
*/
|
||||
typedef NSString *const FIRLoggerService;
|
||||
|
||||
extern FIRLoggerService kFIRLoggerAnalytics;
|
||||
extern FIRLoggerService kFIRLoggerCrash;
|
||||
extern FIRLoggerService kFIRLoggerCore;
|
||||
extern FIRLoggerService kFIRLoggerRemoteConfig;
|
||||
|
||||
/**
|
||||
* The key used to store the logger's error count.
|
||||
*/
|
||||
extern NSString *const kFIRLoggerErrorCountKey;
|
||||
|
||||
/**
|
||||
* The key used to store the logger's warning count.
|
||||
*/
|
||||
extern NSString *const kFIRLoggerWarningCountKey;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* Enables or disables Analytics debug mode.
|
||||
* If set to YES, the logging level for Analytics will be set to FIRLoggerLevelDebug.
|
||||
* Enabling the debug mode has no effect if the app is running from App Store.
|
||||
* (required) analytics debug mode flag.
|
||||
*/
|
||||
void FIRSetAnalyticsDebugMode(BOOL analyticsDebugMode);
|
||||
|
||||
/**
|
||||
* Changes the default logging level of FIRLoggerLevelNotice to a user-specified level.
|
||||
* The default level cannot be set above FIRLoggerLevelNotice if the app is running from App Store.
|
||||
* (required) log level (one of the FIRLoggerLevel enum values).
|
||||
*/
|
||||
void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel);
|
||||
|
||||
/**
|
||||
* Checks if the specified logger level is loggable given the current settings.
|
||||
* (required) log level (one of the FIRLoggerLevel enum values).
|
||||
* (required) whether or not this function is called from the Analytics component.
|
||||
*/
|
||||
BOOL FIRIsLoggableLevel(FIRLoggerLevel loggerLevel, BOOL analyticsComponent);
|
||||
|
||||
/**
|
||||
* Logs a message to the Xcode console and the device log. If running from AppStore, will
|
||||
* not log any messages with a level higher than FIRLoggerLevelNotice to avoid log spamming.
|
||||
* (required) log level (one of the FIRLoggerLevel enum values).
|
||||
* (required) service name of type FIRLoggerService.
|
||||
* (required) message code starting with "I-" which means iOS, followed by a capitalized
|
||||
* three-character service identifier and a six digit integer message ID that is unique
|
||||
* within the service.
|
||||
* An example of the message code is @"I-COR000001".
|
||||
* (required) message string which can be a format string.
|
||||
* (optional) variable arguments list obtained from calling va_start, used when message is a format
|
||||
* string.
|
||||
*/
|
||||
extern void FIRLogBasic(FIRLoggerLevel level,
|
||||
FIRLoggerService service,
|
||||
NSString *messageCode,
|
||||
NSString *message,
|
||||
// On 64-bit simulators, va_list is not a pointer, so cannot be marked nullable
|
||||
// See: http://stackoverflow.com/q/29095469
|
||||
#if __LP64__ && TARGET_OS_SIMULATOR || TARGET_OS_OSX
|
||||
va_list args_ptr
|
||||
#else
|
||||
va_list _Nullable args_ptr
|
||||
#endif
|
||||
);
|
||||
|
||||
/**
|
||||
* The following functions accept the following parameters in order:
|
||||
* (required) service name of type FIRLoggerService.
|
||||
* (required) message code starting from "I-" which means iOS, followed by a capitalized
|
||||
* three-character service identifier and a six digit integer message ID that is unique
|
||||
* within the service.
|
||||
* An example of the message code is @"I-COR000001".
|
||||
* See go/firebase-log-proposal for details.
|
||||
* (required) message string which can be a format string.
|
||||
* (optional) the list of arguments to substitute into the format string.
|
||||
* Example usage:
|
||||
* FIRLogError(kFIRLoggerCore, @"I-COR000001", @"Configuration of %@ failed.", app.name);
|
||||
*/
|
||||
extern void FIRLogError(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
|
||||
NS_FORMAT_FUNCTION(3, 4);
|
||||
extern void FIRLogWarning(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
|
||||
NS_FORMAT_FUNCTION(3, 4);
|
||||
extern void FIRLogNotice(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
|
||||
NS_FORMAT_FUNCTION(3, 4);
|
||||
extern void FIRLogInfo(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
|
||||
NS_FORMAT_FUNCTION(3, 4);
|
||||
extern void FIRLogDebug(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
|
||||
NS_FORMAT_FUNCTION(3, 4);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
@interface FIRLoggerWrapper : NSObject
|
||||
|
||||
/**
|
||||
* Objective-C wrapper for FIRLogBasic to allow weak linking to FIRLogger
|
||||
* (required) log level (one of the FIRLoggerLevel enum values).
|
||||
* (required) service name of type FIRLoggerService.
|
||||
* (required) message code starting with "I-" which means iOS, followed by a capitalized
|
||||
* three-character service identifier and a six digit integer message ID that is unique
|
||||
* within the service.
|
||||
* An example of the message code is @"I-COR000001".
|
||||
* (required) message string which can be a format string.
|
||||
* (optional) variable arguments list obtained from calling va_start, used when message is a format
|
||||
* string.
|
||||
*/
|
||||
|
||||
+ (void)logWithLevel:(FIRLoggerLevel)level
|
||||
withService:(FIRLoggerService)service
|
||||
withCode:(NSString *)messageCode
|
||||
withMessage:(NSString *)message
|
||||
withArgs:(va_list)args;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <FirebaseCore/FIROptions.h>
|
||||
|
||||
/**
|
||||
* Keys for the strings in the plist file.
|
||||
*/
|
||||
extern NSString *const kFIRAPIKey;
|
||||
extern NSString *const kFIRTrackingID;
|
||||
extern NSString *const kFIRGoogleAppID;
|
||||
extern NSString *const kFIRClientID;
|
||||
extern NSString *const kFIRGCMSenderID;
|
||||
extern NSString *const kFIRAndroidClientID;
|
||||
extern NSString *const kFIRDatabaseURL;
|
||||
extern NSString *const kFIRStorageBucket;
|
||||
extern NSString *const kFIRBundleID;
|
||||
extern NSString *const kFIRProjectID;
|
||||
|
||||
/**
|
||||
* Keys for the plist file name
|
||||
*/
|
||||
extern NSString *const kServiceInfoFileName;
|
||||
|
||||
extern NSString *const kServiceInfoFileType;
|
||||
|
||||
/**
|
||||
* This header file exposes the initialization of FIROptions to internal use.
|
||||
*/
|
||||
@interface FIROptions ()
|
||||
|
||||
/**
|
||||
* resetDefaultOptions and initInternalWithOptionsDictionary: are exposed only for unit tests.
|
||||
*/
|
||||
+ (void)resetDefaultOptions;
|
||||
|
||||
/**
|
||||
* Initializes the options with dictionary. The above strings are the keys of the dictionary.
|
||||
* This is the designated initializer.
|
||||
*/
|
||||
- (instancetype)initInternalWithOptionsDictionary:(NSDictionary *)serviceInfoDictionary
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* defaultOptions and defaultOptionsDictionary are exposed in order to be used in FIRApp and
|
||||
* other first party services.
|
||||
*/
|
||||
+ (FIROptions *)defaultOptions;
|
||||
|
||||
+ (NSDictionary *)defaultOptionsDictionary;
|
||||
|
||||
/**
|
||||
* Indicates whether or not Analytics collection was explicitly enabled via a plist flag or at
|
||||
* runtime.
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isAnalyticsCollectionExplicitlySet;
|
||||
|
||||
/**
|
||||
* Whether or not Analytics Collection was enabled. Analytics Collection is enabled unless
|
||||
* explicitly disabled in GoogleService-Info.plist.
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isAnalyticsCollectionEnabled;
|
||||
|
||||
/**
|
||||
* Whether or not Analytics Collection was completely disabled. If YES, then
|
||||
* isAnalyticsCollectionEnabled will be NO.
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isAnalyticsCollectionDeactivated;
|
||||
|
||||
/**
|
||||
* The version ID of the client library, e.g. @"1100000".
|
||||
*/
|
||||
@property(nonatomic, readonly, copy) NSString *libraryVersionID;
|
||||
|
||||
/**
|
||||
* The flag indicating whether this object was constructed with the values in the default plist
|
||||
* file.
|
||||
*/
|
||||
@property(nonatomic) BOOL usingOptionsFromDefaultPlist;
|
||||
|
||||
/**
|
||||
* Whether or not Measurement was enabled. Measurement is enabled unless explicitly disabled in
|
||||
* GoogleService-Info.plist.
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isMeasurementEnabled;
|
||||
|
||||
/**
|
||||
* Whether or not Analytics was enabled in the developer console.
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isAnalyticsEnabled;
|
||||
|
||||
/**
|
||||
* Whether or not SignIn was enabled in the developer console.
|
||||
*/
|
||||
@property(nonatomic, readonly) BOOL isSignInEnabled;
|
||||
|
||||
/**
|
||||
* Whether or not editing is locked. This should occur after FIROptions has been set on a FIRApp.
|
||||
*/
|
||||
@property(nonatomic, getter=isEditingLocked) BOOL editingLocked;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// An umbrella header, for any other libraries in this repo to access Firebase Public and Private
|
||||
// headers. Any package manager complexity should be handled here.
|
||||
|
||||
#import <FirebaseCore/FirebaseCore.h>
|
||||
|
||||
#import "FirebaseCore/Sources/Private/FIRAppInternal.h"
|
||||
#import "FirebaseCore/Sources/Private/FIRComponent.h"
|
||||
#import "FirebaseCore/Sources/Private/FIRComponentContainer.h"
|
||||
#import "FirebaseCore/Sources/Private/FIRComponentType.h"
|
||||
#import "FirebaseCore/Sources/Private/FIRDependency.h"
|
||||
#import "FirebaseCore/Sources/Private/FIRHeartbeatInfo.h"
|
||||
#import "FirebaseCore/Sources/Private/FIRLibrary.h"
|
||||
#import "FirebaseCore/Sources/Private/FIRLogger.h"
|
||||
#import "FirebaseCore/Sources/Private/FIROptionsInternal.h"
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "bundle.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t firestore_BundledQuery_fields[4] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_BundledQuery, parent, parent, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(query_type, 2, MESSAGE , ONEOF, STATIC , OTHER, firestore_BundledQuery, structured_query, parent, &google_firestore_v1_StructuredQuery_fields),
|
||||
PB_FIELD( 3, UENUM , SINGULAR, STATIC , OTHER, firestore_BundledQuery, limit_type, structured_query, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t firestore_NamedQuery_fields[4] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_NamedQuery, name, name, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_NamedQuery, bundled_query, name, &firestore_BundledQuery_fields),
|
||||
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, firestore_NamedQuery, read_time, bundled_query, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t firestore_BundledDocumentMetadata_fields[5] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_BundledDocumentMetadata, name, name, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_BundledDocumentMetadata, read_time, name, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 3, BOOL , SINGULAR, STATIC , OTHER, firestore_BundledDocumentMetadata, exists, read_time, 0),
|
||||
PB_FIELD( 4, BYTES , REPEATED, POINTER , OTHER, firestore_BundledDocumentMetadata, queries, exists, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t firestore_BundleMetadata_fields[6] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_BundleMetadata, id, id, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_BundleMetadata, create_time, id, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 3, UINT32 , SINGULAR, STATIC , OTHER, firestore_BundleMetadata, version, create_time, 0),
|
||||
PB_FIELD( 4, UINT32 , SINGULAR, STATIC , OTHER, firestore_BundleMetadata, total_documents, version, 0),
|
||||
PB_FIELD( 5, UINT64 , SINGULAR, STATIC , OTHER, firestore_BundleMetadata, total_bytes, total_documents, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t firestore_BundleElement_fields[5] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(element_type, 1, MESSAGE , ONEOF, STATIC , FIRST, firestore_BundleElement, metadata, metadata, &firestore_BundleMetadata_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(element_type, 2, MESSAGE , ONEOF, STATIC , UNION, firestore_BundleElement, named_query, named_query, &firestore_NamedQuery_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(element_type, 3, MESSAGE , ONEOF, STATIC , UNION, firestore_BundleElement, document_metadata, document_metadata, &firestore_BundledDocumentMetadata_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(element_type, 4, MESSAGE , ONEOF, STATIC , UNION, firestore_BundleElement, document, document, &google_firestore_v1_Document_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(firestore_BundledQuery, structured_query) < 65536 && pb_membersize(firestore_NamedQuery, bundled_query) < 65536 && pb_membersize(firestore_NamedQuery, read_time) < 65536 && pb_membersize(firestore_BundledDocumentMetadata, read_time) < 65536 && pb_membersize(firestore_BundleMetadata, create_time) < 65536 && pb_membersize(firestore_BundleElement, metadata) < 65536 && pb_membersize(firestore_BundleElement, named_query) < 65536 && pb_membersize(firestore_BundleElement, document_metadata) < 65536 && pb_membersize(firestore_BundleElement, document) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_firestore_BundledQuery_firestore_NamedQuery_firestore_BundledDocumentMetadata_firestore_BundleMetadata_firestore_BundleElement)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(firestore_BundledQuery, structured_query) < 256 && pb_membersize(firestore_NamedQuery, bundled_query) < 256 && pb_membersize(firestore_NamedQuery, read_time) < 256 && pb_membersize(firestore_BundledDocumentMetadata, read_time) < 256 && pb_membersize(firestore_BundleMetadata, create_time) < 256 && pb_membersize(firestore_BundleElement, metadata) < 256 && pb_membersize(firestore_BundleElement, named_query) < 256 && pb_membersize(firestore_BundleElement, document_metadata) < 256 && pb_membersize(firestore_BundleElement, document) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_firestore_BundledQuery_firestore_NamedQuery_firestore_BundledDocumentMetadata_firestore_BundleMetadata_firestore_BundleElement)
|
||||
#endif
|
||||
|
||||
|
||||
const char* EnumToString(
|
||||
firestore_BundledQuery_LimitType value) {
|
||||
switch (value) {
|
||||
case firestore_BundledQuery_LimitType_FIRST:
|
||||
return "FIRST";
|
||||
case firestore_BundledQuery_LimitType_LAST:
|
||||
return "LAST";
|
||||
}
|
||||
return "<unknown enum value>";
|
||||
}
|
||||
|
||||
std::string firestore_BundledQuery::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BundledQuery", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
|
||||
switch (which_query_type) {
|
||||
case firestore_BundledQuery_structured_query_tag:
|
||||
result += PrintMessageField("structured_query ",
|
||||
structured_query, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
result += PrintEnumField("limit_type: ", limit_type, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string firestore_NamedQuery::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "NamedQuery", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("name: ", name, indent + 1, false);
|
||||
result += PrintMessageField("bundled_query ",
|
||||
bundled_query, indent + 1, false);
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string firestore_BundledDocumentMetadata::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BundledDocumentMetadata", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("name: ", name, indent + 1, false);
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, false);
|
||||
result += PrintPrimitiveField("exists: ", exists, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != queries_count; ++i) {
|
||||
result += PrintPrimitiveField("queries: ",
|
||||
queries[i], indent + 1, true);
|
||||
}
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string firestore_BundleMetadata::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BundleMetadata", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("id: ", id, indent + 1, false);
|
||||
result += PrintMessageField("create_time ",
|
||||
create_time, indent + 1, false);
|
||||
result += PrintPrimitiveField("version: ", version, indent + 1, false);
|
||||
result += PrintPrimitiveField("total_documents: ",
|
||||
total_documents, indent + 1, false);
|
||||
result += PrintPrimitiveField("total_bytes: ",
|
||||
total_bytes, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string firestore_BundleElement::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BundleElement", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_element_type) {
|
||||
case firestore_BundleElement_metadata_tag:
|
||||
result += PrintMessageField("metadata ", metadata, indent + 1, true);
|
||||
break;
|
||||
case firestore_BundleElement_named_query_tag:
|
||||
result += PrintMessageField("named_query ",
|
||||
named_query, indent + 1, true);
|
||||
break;
|
||||
case firestore_BundleElement_document_metadata_tag:
|
||||
result += PrintMessageField("document_metadata ",
|
||||
document_metadata, indent + 1, true);
|
||||
break;
|
||||
case firestore_BundleElement_document_tag:
|
||||
result += PrintMessageField("document ", document, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_FIRESTORE_BUNDLE_NANOPB_H_INCLUDED
|
||||
#define PB_FIRESTORE_BUNDLE_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/firestore/v1/document.nanopb.h"
|
||||
|
||||
#include "google/firestore/v1/query.nanopb.h"
|
||||
|
||||
#include "google/protobuf/timestamp.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Enum definitions */
|
||||
typedef enum _firestore_BundledQuery_LimitType {
|
||||
firestore_BundledQuery_LimitType_FIRST = 0,
|
||||
firestore_BundledQuery_LimitType_LAST = 1
|
||||
} firestore_BundledQuery_LimitType;
|
||||
#define _firestore_BundledQuery_LimitType_MIN firestore_BundledQuery_LimitType_FIRST
|
||||
#define _firestore_BundledQuery_LimitType_MAX firestore_BundledQuery_LimitType_LAST
|
||||
#define _firestore_BundledQuery_LimitType_ARRAYSIZE ((firestore_BundledQuery_LimitType)(firestore_BundledQuery_LimitType_LAST+1))
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _firestore_BundleMetadata {
|
||||
pb_bytes_array_t *id;
|
||||
google_protobuf_Timestamp create_time;
|
||||
uint32_t version;
|
||||
uint32_t total_documents;
|
||||
uint64_t total_bytes;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_BundleMetadata) */
|
||||
} firestore_BundleMetadata;
|
||||
|
||||
typedef struct _firestore_BundledDocumentMetadata {
|
||||
pb_bytes_array_t *name;
|
||||
google_protobuf_Timestamp read_time;
|
||||
bool exists;
|
||||
pb_size_t queries_count;
|
||||
pb_bytes_array_t **queries;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_BundledDocumentMetadata) */
|
||||
} firestore_BundledDocumentMetadata;
|
||||
|
||||
typedef struct _firestore_BundledQuery {
|
||||
pb_bytes_array_t *parent;
|
||||
pb_size_t which_query_type;
|
||||
union {
|
||||
google_firestore_v1_StructuredQuery structured_query;
|
||||
};
|
||||
firestore_BundledQuery_LimitType limit_type;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_BundledQuery) */
|
||||
} firestore_BundledQuery;
|
||||
|
||||
typedef struct _firestore_NamedQuery {
|
||||
pb_bytes_array_t *name;
|
||||
firestore_BundledQuery bundled_query;
|
||||
google_protobuf_Timestamp read_time;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_NamedQuery) */
|
||||
} firestore_NamedQuery;
|
||||
|
||||
typedef struct _firestore_BundleElement {
|
||||
pb_size_t which_element_type;
|
||||
union {
|
||||
firestore_BundleMetadata metadata;
|
||||
firestore_NamedQuery named_query;
|
||||
firestore_BundledDocumentMetadata document_metadata;
|
||||
google_firestore_v1_Document document;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_BundleElement) */
|
||||
} firestore_BundleElement;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define firestore_BundledQuery_init_default {NULL, 0, {google_firestore_v1_StructuredQuery_init_default}, _firestore_BundledQuery_LimitType_MIN}
|
||||
#define firestore_NamedQuery_init_default {NULL, firestore_BundledQuery_init_default, google_protobuf_Timestamp_init_default}
|
||||
#define firestore_BundledDocumentMetadata_init_default {NULL, google_protobuf_Timestamp_init_default, 0, 0, NULL}
|
||||
#define firestore_BundleMetadata_init_default {NULL, google_protobuf_Timestamp_init_default, 0, 0, 0}
|
||||
#define firestore_BundleElement_init_default {0, {firestore_BundleMetadata_init_default}}
|
||||
#define firestore_BundledQuery_init_zero {NULL, 0, {google_firestore_v1_StructuredQuery_init_zero}, _firestore_BundledQuery_LimitType_MIN}
|
||||
#define firestore_NamedQuery_init_zero {NULL, firestore_BundledQuery_init_zero, google_protobuf_Timestamp_init_zero}
|
||||
#define firestore_BundledDocumentMetadata_init_zero {NULL, google_protobuf_Timestamp_init_zero, 0, 0, NULL}
|
||||
#define firestore_BundleMetadata_init_zero {NULL, google_protobuf_Timestamp_init_zero, 0, 0, 0}
|
||||
#define firestore_BundleElement_init_zero {0, {firestore_BundleMetadata_init_zero}}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define firestore_BundleMetadata_id_tag 1
|
||||
#define firestore_BundleMetadata_create_time_tag 2
|
||||
#define firestore_BundleMetadata_version_tag 3
|
||||
#define firestore_BundleMetadata_total_documents_tag 4
|
||||
#define firestore_BundleMetadata_total_bytes_tag 5
|
||||
#define firestore_BundledDocumentMetadata_name_tag 1
|
||||
#define firestore_BundledDocumentMetadata_read_time_tag 2
|
||||
#define firestore_BundledDocumentMetadata_exists_tag 3
|
||||
#define firestore_BundledDocumentMetadata_queries_tag 4
|
||||
#define firestore_BundledQuery_structured_query_tag 2
|
||||
#define firestore_BundledQuery_parent_tag 1
|
||||
#define firestore_BundledQuery_limit_type_tag 3
|
||||
#define firestore_NamedQuery_name_tag 1
|
||||
#define firestore_NamedQuery_bundled_query_tag 2
|
||||
#define firestore_NamedQuery_read_time_tag 3
|
||||
#define firestore_BundleElement_metadata_tag 1
|
||||
#define firestore_BundleElement_named_query_tag 2
|
||||
#define firestore_BundleElement_document_metadata_tag 3
|
||||
#define firestore_BundleElement_document_tag 4
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t firestore_BundledQuery_fields[4];
|
||||
extern const pb_field_t firestore_NamedQuery_fields[4];
|
||||
extern const pb_field_t firestore_BundledDocumentMetadata_fields[5];
|
||||
extern const pb_field_t firestore_BundleMetadata_fields[6];
|
||||
extern const pb_field_t firestore_BundleElement_fields[5];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* firestore_BundledQuery_size depends on runtime parameters */
|
||||
/* firestore_NamedQuery_size depends on runtime parameters */
|
||||
/* firestore_BundledDocumentMetadata_size depends on runtime parameters */
|
||||
/* firestore_BundleMetadata_size depends on runtime parameters */
|
||||
/* firestore_BundleElement_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define BUNDLE_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
const char* EnumToString(firestore_BundledQuery_LimitType value);
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "maybe_document.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t firestore_client_NoDocument_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_client_NoDocument, name, name, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_client_NoDocument, read_time, name, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t firestore_client_UnknownDocument_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_client_UnknownDocument, name, name, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_client_UnknownDocument, version, name, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t firestore_client_MaybeDocument_fields[5] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(document_type, 1, MESSAGE , ONEOF, STATIC , FIRST, firestore_client_MaybeDocument, no_document, no_document, &firestore_client_NoDocument_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(document_type, 2, MESSAGE , ONEOF, STATIC , UNION, firestore_client_MaybeDocument, document, document, &google_firestore_v1_Document_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(document_type, 3, MESSAGE , ONEOF, STATIC , UNION, firestore_client_MaybeDocument, unknown_document, unknown_document, &firestore_client_UnknownDocument_fields),
|
||||
PB_FIELD( 4, BOOL , SINGULAR, STATIC , OTHER, firestore_client_MaybeDocument, has_committed_mutations, unknown_document, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(firestore_client_NoDocument, read_time) < 65536 && pb_membersize(firestore_client_UnknownDocument, version) < 65536 && pb_membersize(firestore_client_MaybeDocument, no_document) < 65536 && pb_membersize(firestore_client_MaybeDocument, document) < 65536 && pb_membersize(firestore_client_MaybeDocument, unknown_document) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_firestore_client_NoDocument_firestore_client_UnknownDocument_firestore_client_MaybeDocument)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(firestore_client_NoDocument, read_time) < 256 && pb_membersize(firestore_client_UnknownDocument, version) < 256 && pb_membersize(firestore_client_MaybeDocument, no_document) < 256 && pb_membersize(firestore_client_MaybeDocument, document) < 256 && pb_membersize(firestore_client_MaybeDocument, unknown_document) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_firestore_client_NoDocument_firestore_client_UnknownDocument_firestore_client_MaybeDocument)
|
||||
#endif
|
||||
|
||||
|
||||
std::string firestore_client_NoDocument::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "NoDocument", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("name: ", name, indent + 1, false);
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string firestore_client_UnknownDocument::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "UnknownDocument", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("name: ", name, indent + 1, false);
|
||||
result += PrintMessageField("version ", version, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string firestore_client_MaybeDocument::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "MaybeDocument", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_document_type) {
|
||||
case firestore_client_MaybeDocument_no_document_tag:
|
||||
result += PrintMessageField("no_document ",
|
||||
no_document, indent + 1, true);
|
||||
break;
|
||||
case firestore_client_MaybeDocument_document_tag:
|
||||
result += PrintMessageField("document ", document, indent + 1, true);
|
||||
break;
|
||||
case firestore_client_MaybeDocument_unknown_document_tag:
|
||||
result += PrintMessageField("unknown_document ",
|
||||
unknown_document, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
result += PrintPrimitiveField("has_committed_mutations: ",
|
||||
has_committed_mutations, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_FIRESTORE_CLIENT_MAYBE_DOCUMENT_NANOPB_H_INCLUDED
|
||||
#define PB_FIRESTORE_CLIENT_MAYBE_DOCUMENT_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/firestore/v1/document.nanopb.h"
|
||||
|
||||
#include "google/protobuf/timestamp.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _firestore_client_NoDocument {
|
||||
pb_bytes_array_t *name;
|
||||
google_protobuf_Timestamp read_time;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_client_NoDocument) */
|
||||
} firestore_client_NoDocument;
|
||||
|
||||
typedef struct _firestore_client_UnknownDocument {
|
||||
pb_bytes_array_t *name;
|
||||
google_protobuf_Timestamp version;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_client_UnknownDocument) */
|
||||
} firestore_client_UnknownDocument;
|
||||
|
||||
typedef struct _firestore_client_MaybeDocument {
|
||||
pb_size_t which_document_type;
|
||||
union {
|
||||
firestore_client_NoDocument no_document;
|
||||
google_firestore_v1_Document document;
|
||||
firestore_client_UnknownDocument unknown_document;
|
||||
};
|
||||
bool has_committed_mutations;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_client_MaybeDocument) */
|
||||
} firestore_client_MaybeDocument;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define firestore_client_NoDocument_init_default {NULL, google_protobuf_Timestamp_init_default}
|
||||
#define firestore_client_UnknownDocument_init_default {NULL, google_protobuf_Timestamp_init_default}
|
||||
#define firestore_client_MaybeDocument_init_default {0, {firestore_client_NoDocument_init_default}, 0}
|
||||
#define firestore_client_NoDocument_init_zero {NULL, google_protobuf_Timestamp_init_zero}
|
||||
#define firestore_client_UnknownDocument_init_zero {NULL, google_protobuf_Timestamp_init_zero}
|
||||
#define firestore_client_MaybeDocument_init_zero {0, {firestore_client_NoDocument_init_zero}, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define firestore_client_NoDocument_name_tag 1
|
||||
#define firestore_client_NoDocument_read_time_tag 2
|
||||
#define firestore_client_UnknownDocument_name_tag 1
|
||||
#define firestore_client_UnknownDocument_version_tag 2
|
||||
#define firestore_client_MaybeDocument_no_document_tag 1
|
||||
#define firestore_client_MaybeDocument_document_tag 2
|
||||
#define firestore_client_MaybeDocument_unknown_document_tag 3
|
||||
#define firestore_client_MaybeDocument_has_committed_mutations_tag 4
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t firestore_client_NoDocument_fields[3];
|
||||
extern const pb_field_t firestore_client_UnknownDocument_fields[3];
|
||||
extern const pb_field_t firestore_client_MaybeDocument_fields[5];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* firestore_client_NoDocument_size depends on runtime parameters */
|
||||
/* firestore_client_UnknownDocument_size depends on runtime parameters */
|
||||
/* firestore_client_MaybeDocument_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define MAYBE_DOCUMENT_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "mutation.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t firestore_client_MutationQueue_fields[3] = {
|
||||
PB_FIELD( 1, INT32 , SINGULAR, STATIC , FIRST, firestore_client_MutationQueue, last_acknowledged_batch_id, last_acknowledged_batch_id, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, firestore_client_MutationQueue, last_stream_token, last_acknowledged_batch_id, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t firestore_client_WriteBatch_fields[5] = {
|
||||
PB_FIELD( 1, INT32 , SINGULAR, STATIC , FIRST, firestore_client_WriteBatch, batch_id, batch_id, 0),
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, POINTER , OTHER, firestore_client_WriteBatch, writes, batch_id, &google_firestore_v1_Write_fields),
|
||||
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, firestore_client_WriteBatch, local_write_time, writes, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 4, MESSAGE , REPEATED, POINTER , OTHER, firestore_client_WriteBatch, base_writes, local_write_time, &google_firestore_v1_Write_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(firestore_client_WriteBatch, local_write_time) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_firestore_client_MutationQueue_firestore_client_WriteBatch)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(firestore_client_WriteBatch, local_write_time) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_firestore_client_MutationQueue_firestore_client_WriteBatch)
|
||||
#endif
|
||||
|
||||
|
||||
std::string firestore_client_MutationQueue::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "MutationQueue", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("last_acknowledged_batch_id: ",
|
||||
last_acknowledged_batch_id, indent + 1, false);
|
||||
result += PrintPrimitiveField("last_stream_token: ",
|
||||
last_stream_token, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string firestore_client_WriteBatch::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "WriteBatch", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("batch_id: ", batch_id, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != writes_count; ++i) {
|
||||
result += PrintMessageField("writes ", writes[i], indent + 1, true);
|
||||
}
|
||||
result += PrintMessageField("local_write_time ",
|
||||
local_write_time, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != base_writes_count; ++i) {
|
||||
result += PrintMessageField("base_writes ",
|
||||
base_writes[i], indent + 1, true);
|
||||
}
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_FIRESTORE_CLIENT_MUTATION_NANOPB_H_INCLUDED
|
||||
#define PB_FIRESTORE_CLIENT_MUTATION_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/firestore/v1/write.nanopb.h"
|
||||
|
||||
#include "google/protobuf/timestamp.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _firestore_client_MutationQueue {
|
||||
int32_t last_acknowledged_batch_id;
|
||||
pb_bytes_array_t *last_stream_token;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_client_MutationQueue) */
|
||||
} firestore_client_MutationQueue;
|
||||
|
||||
typedef struct _firestore_client_WriteBatch {
|
||||
int32_t batch_id;
|
||||
pb_size_t writes_count;
|
||||
struct _google_firestore_v1_Write *writes;
|
||||
google_protobuf_Timestamp local_write_time;
|
||||
pb_size_t base_writes_count;
|
||||
struct _google_firestore_v1_Write *base_writes;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_client_WriteBatch) */
|
||||
} firestore_client_WriteBatch;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define firestore_client_MutationQueue_init_default {0, NULL}
|
||||
#define firestore_client_WriteBatch_init_default {0, 0, NULL, google_protobuf_Timestamp_init_default, 0, NULL}
|
||||
#define firestore_client_MutationQueue_init_zero {0, NULL}
|
||||
#define firestore_client_WriteBatch_init_zero {0, 0, NULL, google_protobuf_Timestamp_init_zero, 0, NULL}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define firestore_client_MutationQueue_last_acknowledged_batch_id_tag 1
|
||||
#define firestore_client_MutationQueue_last_stream_token_tag 2
|
||||
#define firestore_client_WriteBatch_batch_id_tag 1
|
||||
#define firestore_client_WriteBatch_writes_tag 2
|
||||
#define firestore_client_WriteBatch_local_write_time_tag 3
|
||||
#define firestore_client_WriteBatch_base_writes_tag 4
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t firestore_client_MutationQueue_fields[3];
|
||||
extern const pb_field_t firestore_client_WriteBatch_fields[5];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* firestore_client_MutationQueue_size depends on runtime parameters */
|
||||
/* firestore_client_WriteBatch_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define MUTATION_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "target.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t firestore_client_Target_fields[8] = {
|
||||
PB_FIELD( 1, INT32 , SINGULAR, STATIC , FIRST, firestore_client_Target, target_id, target_id, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_client_Target, snapshot_version, target_id, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, firestore_client_Target, resume_token, snapshot_version, 0),
|
||||
PB_FIELD( 4, INT64 , SINGULAR, STATIC , OTHER, firestore_client_Target, last_listen_sequence_number, resume_token, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(target_type, 5, MESSAGE , ONEOF, STATIC , OTHER, firestore_client_Target, query, last_listen_sequence_number, &google_firestore_v1_Target_QueryTarget_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(target_type, 6, MESSAGE , ONEOF, STATIC , UNION, firestore_client_Target, documents, last_listen_sequence_number, &google_firestore_v1_Target_DocumentsTarget_fields),
|
||||
PB_FIELD( 7, MESSAGE , SINGULAR, STATIC , OTHER, firestore_client_Target, last_limbo_free_snapshot_version, documents, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t firestore_client_TargetGlobal_fields[5] = {
|
||||
PB_FIELD( 1, INT32 , SINGULAR, STATIC , FIRST, firestore_client_TargetGlobal, highest_target_id, highest_target_id, 0),
|
||||
PB_FIELD( 2, INT64 , SINGULAR, STATIC , OTHER, firestore_client_TargetGlobal, highest_listen_sequence_number, highest_target_id, 0),
|
||||
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, firestore_client_TargetGlobal, last_remote_snapshot_version, highest_listen_sequence_number, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 4, INT32 , SINGULAR, STATIC , OTHER, firestore_client_TargetGlobal, target_count, last_remote_snapshot_version, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(firestore_client_Target, query) < 65536 && pb_membersize(firestore_client_Target, documents) < 65536 && pb_membersize(firestore_client_Target, snapshot_version) < 65536 && pb_membersize(firestore_client_Target, last_limbo_free_snapshot_version) < 65536 && pb_membersize(firestore_client_TargetGlobal, last_remote_snapshot_version) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_firestore_client_Target_firestore_client_TargetGlobal)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(firestore_client_Target, query) < 256 && pb_membersize(firestore_client_Target, documents) < 256 && pb_membersize(firestore_client_Target, snapshot_version) < 256 && pb_membersize(firestore_client_Target, last_limbo_free_snapshot_version) < 256 && pb_membersize(firestore_client_TargetGlobal, last_remote_snapshot_version) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_firestore_client_Target_firestore_client_TargetGlobal)
|
||||
#endif
|
||||
|
||||
|
||||
std::string firestore_client_Target::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Target", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("target_id: ", target_id, indent + 1, false);
|
||||
result += PrintMessageField("snapshot_version ",
|
||||
snapshot_version, indent + 1, false);
|
||||
result += PrintPrimitiveField("resume_token: ",
|
||||
resume_token, indent + 1, false);
|
||||
result += PrintPrimitiveField("last_listen_sequence_number: ",
|
||||
last_listen_sequence_number, indent + 1, false);
|
||||
switch (which_target_type) {
|
||||
case firestore_client_Target_query_tag:
|
||||
result += PrintMessageField("query ", query, indent + 1, true);
|
||||
break;
|
||||
case firestore_client_Target_documents_tag:
|
||||
result += PrintMessageField("documents ", documents, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
result += PrintMessageField("last_limbo_free_snapshot_version ",
|
||||
last_limbo_free_snapshot_version, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string firestore_client_TargetGlobal::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "TargetGlobal", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("highest_target_id: ",
|
||||
highest_target_id, indent + 1, false);
|
||||
result += PrintPrimitiveField("highest_listen_sequence_number: ",
|
||||
highest_listen_sequence_number, indent + 1, false);
|
||||
result += PrintMessageField("last_remote_snapshot_version ",
|
||||
last_remote_snapshot_version, indent + 1, false);
|
||||
result += PrintPrimitiveField("target_count: ",
|
||||
target_count, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_FIRESTORE_CLIENT_TARGET_NANOPB_H_INCLUDED
|
||||
#define PB_FIRESTORE_CLIENT_TARGET_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/firestore/v1/firestore.nanopb.h"
|
||||
|
||||
#include "google/protobuf/timestamp.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _firestore_client_Target {
|
||||
int32_t target_id;
|
||||
google_protobuf_Timestamp snapshot_version;
|
||||
pb_bytes_array_t *resume_token;
|
||||
int64_t last_listen_sequence_number;
|
||||
pb_size_t which_target_type;
|
||||
union {
|
||||
google_firestore_v1_Target_QueryTarget query;
|
||||
google_firestore_v1_Target_DocumentsTarget documents;
|
||||
};
|
||||
google_protobuf_Timestamp last_limbo_free_snapshot_version;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_client_Target) */
|
||||
} firestore_client_Target;
|
||||
|
||||
typedef struct _firestore_client_TargetGlobal {
|
||||
int32_t highest_target_id;
|
||||
int64_t highest_listen_sequence_number;
|
||||
google_protobuf_Timestamp last_remote_snapshot_version;
|
||||
int32_t target_count;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:firestore_client_TargetGlobal) */
|
||||
} firestore_client_TargetGlobal;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define firestore_client_Target_init_default {0, google_protobuf_Timestamp_init_default, NULL, 0, 0, {google_firestore_v1_Target_QueryTarget_init_default}, google_protobuf_Timestamp_init_default}
|
||||
#define firestore_client_TargetGlobal_init_default {0, 0, google_protobuf_Timestamp_init_default, 0}
|
||||
#define firestore_client_Target_init_zero {0, google_protobuf_Timestamp_init_zero, NULL, 0, 0, {google_firestore_v1_Target_QueryTarget_init_zero}, google_protobuf_Timestamp_init_zero}
|
||||
#define firestore_client_TargetGlobal_init_zero {0, 0, google_protobuf_Timestamp_init_zero, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define firestore_client_Target_query_tag 5
|
||||
#define firestore_client_Target_documents_tag 6
|
||||
#define firestore_client_Target_target_id_tag 1
|
||||
#define firestore_client_Target_snapshot_version_tag 2
|
||||
#define firestore_client_Target_resume_token_tag 3
|
||||
#define firestore_client_Target_last_listen_sequence_number_tag 4
|
||||
#define firestore_client_Target_last_limbo_free_snapshot_version_tag 7
|
||||
#define firestore_client_TargetGlobal_highest_target_id_tag 1
|
||||
#define firestore_client_TargetGlobal_highest_listen_sequence_number_tag 2
|
||||
#define firestore_client_TargetGlobal_last_remote_snapshot_version_tag 3
|
||||
#define firestore_client_TargetGlobal_target_count_tag 4
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t firestore_client_Target_fields[8];
|
||||
extern const pb_field_t firestore_client_TargetGlobal_fields[5];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* firestore_client_Target_size depends on runtime parameters */
|
||||
#define firestore_client_TargetGlobal_size 57
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define TARGET_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "annotations.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
#error Field descriptor for google_api_http_struct.http is too large. Define PB_FIELD_32BIT to fix this.
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_API_ANNOTATIONS_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_API_ANNOTATIONS_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/api/http.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Extensions */
|
||||
/* Extension field google_api_http was skipped because only "optional"
|
||||
type of extension fields is currently supported. */
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "http.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_api_Http_fields[3] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_api_Http, rules, rules, &google_api_HttpRule_fields),
|
||||
PB_FIELD( 2, BOOL , SINGULAR, STATIC , OTHER, google_api_Http, fully_decode_reserved_expansion, rules, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_api_HttpRule_fields[10] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_api_HttpRule, selector, selector, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(pattern, 2, BYTES , ONEOF, POINTER , OTHER, google_api_HttpRule, get, selector, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(pattern, 3, BYTES , ONEOF, POINTER , UNION, google_api_HttpRule, put, selector, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(pattern, 4, BYTES , ONEOF, POINTER , UNION, google_api_HttpRule, post, selector, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(pattern, 5, BYTES , ONEOF, POINTER , UNION, google_api_HttpRule, delete_, selector, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(pattern, 6, BYTES , ONEOF, POINTER , UNION, google_api_HttpRule, patch, selector, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(pattern, 8, MESSAGE , ONEOF, STATIC , UNION, google_api_HttpRule, custom, selector, &google_api_CustomHttpPattern_fields),
|
||||
PB_FIELD( 7, BYTES , SINGULAR, POINTER , OTHER, google_api_HttpRule, body, custom, 0),
|
||||
PB_FIELD( 11, MESSAGE , REPEATED, POINTER , OTHER, google_api_HttpRule, additional_bindings, body, &google_api_HttpRule_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_api_CustomHttpPattern_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_api_CustomHttpPattern, kind, kind, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_api_CustomHttpPattern, path, kind, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_api_HttpRule, custom) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_api_Http_google_api_HttpRule_google_api_CustomHttpPattern)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_api_HttpRule, custom) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_api_Http_google_api_HttpRule_google_api_CustomHttpPattern)
|
||||
#endif
|
||||
|
||||
|
||||
std::string google_api_Http::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Http", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != rules_count; ++i) {
|
||||
result += PrintMessageField("rules ", rules[i], indent + 1, true);
|
||||
}
|
||||
result += PrintPrimitiveField("fully_decode_reserved_expansion: ",
|
||||
fully_decode_reserved_expansion, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_api_HttpRule::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "HttpRule", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("selector: ", selector, indent + 1, false);
|
||||
switch (which_pattern) {
|
||||
case google_api_HttpRule_get_tag:
|
||||
result += PrintPrimitiveField("get: ", get, indent + 1, true);
|
||||
break;
|
||||
case google_api_HttpRule_put_tag:
|
||||
result += PrintPrimitiveField("put: ", put, indent + 1, true);
|
||||
break;
|
||||
case google_api_HttpRule_post_tag:
|
||||
result += PrintPrimitiveField("post: ", post, indent + 1, true);
|
||||
break;
|
||||
case google_api_HttpRule_delete_tag:
|
||||
result += PrintPrimitiveField("delete: ", delete_, indent + 1, true);
|
||||
break;
|
||||
case google_api_HttpRule_patch_tag:
|
||||
result += PrintPrimitiveField("patch: ", patch, indent + 1, true);
|
||||
break;
|
||||
case google_api_HttpRule_custom_tag:
|
||||
result += PrintMessageField("custom ", custom, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
result += PrintPrimitiveField("body: ", body, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != additional_bindings_count; ++i) {
|
||||
result += PrintMessageField("additional_bindings ",
|
||||
additional_bindings[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_api_CustomHttpPattern::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "CustomHttpPattern", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("kind: ", kind, indent + 1, false);
|
||||
result += PrintPrimitiveField("path: ", path, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_API_HTTP_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_API_HTTP_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_api_CustomHttpPattern {
|
||||
pb_bytes_array_t *kind;
|
||||
pb_bytes_array_t *path;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_api_CustomHttpPattern) */
|
||||
} google_api_CustomHttpPattern;
|
||||
|
||||
typedef struct _google_api_Http {
|
||||
pb_size_t rules_count;
|
||||
struct _google_api_HttpRule *rules;
|
||||
bool fully_decode_reserved_expansion;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_api_Http) */
|
||||
} google_api_Http;
|
||||
|
||||
typedef struct _google_api_HttpRule {
|
||||
pb_bytes_array_t *selector;
|
||||
pb_size_t which_pattern;
|
||||
union {
|
||||
pb_bytes_array_t *get;
|
||||
pb_bytes_array_t *put;
|
||||
pb_bytes_array_t *post;
|
||||
pb_bytes_array_t *delete_;
|
||||
pb_bytes_array_t *patch;
|
||||
google_api_CustomHttpPattern custom;
|
||||
};
|
||||
pb_bytes_array_t *body;
|
||||
pb_size_t additional_bindings_count;
|
||||
struct _google_api_HttpRule *additional_bindings;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_api_HttpRule) */
|
||||
} google_api_HttpRule;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_api_Http_init_default {0, NULL, 0}
|
||||
#define google_api_HttpRule_init_default {NULL, 0, {NULL}, NULL, 0, NULL}
|
||||
#define google_api_CustomHttpPattern_init_default {NULL, NULL}
|
||||
#define google_api_Http_init_zero {0, NULL, 0}
|
||||
#define google_api_HttpRule_init_zero {NULL, 0, {NULL}, NULL, 0, NULL}
|
||||
#define google_api_CustomHttpPattern_init_zero {NULL, NULL}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_api_CustomHttpPattern_kind_tag 1
|
||||
#define google_api_CustomHttpPattern_path_tag 2
|
||||
#define google_api_Http_rules_tag 1
|
||||
#define google_api_Http_fully_decode_reserved_expansion_tag 2
|
||||
#define google_api_HttpRule_get_tag 2
|
||||
#define google_api_HttpRule_put_tag 3
|
||||
#define google_api_HttpRule_post_tag 4
|
||||
#define google_api_HttpRule_delete_tag 5
|
||||
#define google_api_HttpRule_patch_tag 6
|
||||
#define google_api_HttpRule_custom_tag 8
|
||||
#define google_api_HttpRule_selector_tag 1
|
||||
#define google_api_HttpRule_body_tag 7
|
||||
#define google_api_HttpRule_additional_bindings_tag 11
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_api_Http_fields[3];
|
||||
extern const pb_field_t google_api_HttpRule_fields[10];
|
||||
extern const pb_field_t google_api_CustomHttpPattern_fields[3];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* google_api_Http_size depends on runtime parameters */
|
||||
/* google_api_HttpRule_size depends on runtime parameters */
|
||||
/* google_api_CustomHttpPattern_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define HTTP_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "common.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_firestore_v1_DocumentMask_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , REPEATED, POINTER , FIRST, google_firestore_v1_DocumentMask, field_paths, field_paths, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_Precondition_fields[3] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(condition_type, 1, BOOL , ONEOF, STATIC , FIRST, google_firestore_v1_Precondition, exists, exists, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(condition_type, 2, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Precondition, update_time, update_time, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_TransactionOptions_fields[3] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(mode, 2, MESSAGE , ONEOF, STATIC , FIRST, google_firestore_v1_TransactionOptions, read_only, read_only, &google_firestore_v1_TransactionOptions_ReadOnly_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(mode, 3, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_TransactionOptions, read_write, read_write, &google_firestore_v1_TransactionOptions_ReadWrite_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_TransactionOptions_ReadWrite_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_TransactionOptions_ReadWrite, retry_transaction, retry_transaction, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_TransactionOptions_ReadOnly_fields[2] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(consistency_selector, 2, MESSAGE , ONEOF, STATIC , FIRST, google_firestore_v1_TransactionOptions_ReadOnly, read_time, read_time, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Precondition, update_time) < 65536 && pb_membersize(google_firestore_v1_TransactionOptions, read_only) < 65536 && pb_membersize(google_firestore_v1_TransactionOptions, read_write) < 65536 && pb_membersize(google_firestore_v1_TransactionOptions_ReadOnly, read_time) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_firestore_v1_DocumentMask_google_firestore_v1_Precondition_google_firestore_v1_TransactionOptions_google_firestore_v1_TransactionOptions_ReadWrite_google_firestore_v1_TransactionOptions_ReadOnly)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Precondition, update_time) < 256 && pb_membersize(google_firestore_v1_TransactionOptions, read_only) < 256 && pb_membersize(google_firestore_v1_TransactionOptions, read_write) < 256 && pb_membersize(google_firestore_v1_TransactionOptions_ReadOnly, read_time) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_firestore_v1_DocumentMask_google_firestore_v1_Precondition_google_firestore_v1_TransactionOptions_google_firestore_v1_TransactionOptions_ReadWrite_google_firestore_v1_TransactionOptions_ReadOnly)
|
||||
#endif
|
||||
|
||||
|
||||
std::string google_firestore_v1_DocumentMask::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "DocumentMask", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != field_paths_count; ++i) {
|
||||
result += PrintPrimitiveField("field_paths: ",
|
||||
field_paths[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_Precondition::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Precondition", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_condition_type) {
|
||||
case google_firestore_v1_Precondition_exists_tag:
|
||||
result += PrintPrimitiveField("exists: ", exists, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Precondition_update_time_tag:
|
||||
result += PrintMessageField("update_time ",
|
||||
update_time, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_TransactionOptions::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "TransactionOptions", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_mode) {
|
||||
case google_firestore_v1_TransactionOptions_read_only_tag:
|
||||
result += PrintMessageField("read_only ", read_only, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_TransactionOptions_read_write_tag:
|
||||
result += PrintMessageField("read_write ",
|
||||
read_write, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_TransactionOptions_ReadWrite::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ReadWrite", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("retry_transaction: ",
|
||||
retry_transaction, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_TransactionOptions_ReadOnly::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ReadOnly", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_consistency_selector) {
|
||||
case google_firestore_v1_TransactionOptions_ReadOnly_read_time_tag:
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_FIRESTORE_V1_COMMON_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_FIRESTORE_V1_COMMON_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/api/annotations.nanopb.h"
|
||||
|
||||
#include "google/protobuf/timestamp.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_firestore_v1_DocumentMask {
|
||||
pb_size_t field_paths_count;
|
||||
pb_bytes_array_t **field_paths;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_DocumentMask) */
|
||||
} google_firestore_v1_DocumentMask;
|
||||
|
||||
typedef struct _google_firestore_v1_TransactionOptions_ReadWrite {
|
||||
pb_bytes_array_t *retry_transaction;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_TransactionOptions_ReadWrite) */
|
||||
} google_firestore_v1_TransactionOptions_ReadWrite;
|
||||
|
||||
typedef struct _google_firestore_v1_Precondition {
|
||||
pb_size_t which_condition_type;
|
||||
union {
|
||||
bool exists;
|
||||
google_protobuf_Timestamp update_time;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_Precondition) */
|
||||
} google_firestore_v1_Precondition;
|
||||
|
||||
typedef struct _google_firestore_v1_TransactionOptions_ReadOnly {
|
||||
pb_size_t which_consistency_selector;
|
||||
union {
|
||||
google_protobuf_Timestamp read_time;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_TransactionOptions_ReadOnly) */
|
||||
} google_firestore_v1_TransactionOptions_ReadOnly;
|
||||
|
||||
typedef struct _google_firestore_v1_TransactionOptions {
|
||||
pb_size_t which_mode;
|
||||
union {
|
||||
google_firestore_v1_TransactionOptions_ReadOnly read_only;
|
||||
google_firestore_v1_TransactionOptions_ReadWrite read_write;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_TransactionOptions) */
|
||||
} google_firestore_v1_TransactionOptions;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_firestore_v1_DocumentMask_init_default {0, NULL}
|
||||
#define google_firestore_v1_Precondition_init_default {0, {0}}
|
||||
#define google_firestore_v1_TransactionOptions_init_default {0, {google_firestore_v1_TransactionOptions_ReadOnly_init_default}}
|
||||
#define google_firestore_v1_TransactionOptions_ReadWrite_init_default {NULL}
|
||||
#define google_firestore_v1_TransactionOptions_ReadOnly_init_default {0, {google_protobuf_Timestamp_init_default}}
|
||||
#define google_firestore_v1_DocumentMask_init_zero {0, NULL}
|
||||
#define google_firestore_v1_Precondition_init_zero {0, {0}}
|
||||
#define google_firestore_v1_TransactionOptions_init_zero {0, {google_firestore_v1_TransactionOptions_ReadOnly_init_zero}}
|
||||
#define google_firestore_v1_TransactionOptions_ReadWrite_init_zero {NULL}
|
||||
#define google_firestore_v1_TransactionOptions_ReadOnly_init_zero {0, {google_protobuf_Timestamp_init_zero}}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_firestore_v1_DocumentMask_field_paths_tag 1
|
||||
#define google_firestore_v1_TransactionOptions_ReadWrite_retry_transaction_tag 1
|
||||
#define google_firestore_v1_Precondition_exists_tag 1
|
||||
#define google_firestore_v1_Precondition_update_time_tag 2
|
||||
#define google_firestore_v1_TransactionOptions_ReadOnly_read_time_tag 2
|
||||
#define google_firestore_v1_TransactionOptions_read_only_tag 2
|
||||
#define google_firestore_v1_TransactionOptions_read_write_tag 3
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_firestore_v1_DocumentMask_fields[2];
|
||||
extern const pb_field_t google_firestore_v1_Precondition_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_TransactionOptions_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_TransactionOptions_ReadWrite_fields[2];
|
||||
extern const pb_field_t google_firestore_v1_TransactionOptions_ReadOnly_fields[2];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* google_firestore_v1_DocumentMask_size depends on runtime parameters */
|
||||
#define google_firestore_v1_Precondition_size 24
|
||||
/* google_firestore_v1_TransactionOptions_size depends on runtime parameters */
|
||||
/* google_firestore_v1_TransactionOptions_ReadWrite_size depends on runtime parameters */
|
||||
#define google_firestore_v1_TransactionOptions_ReadOnly_size 24
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define COMMON_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+252
@@ -0,0 +1,252 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "document.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_firestore_v1_Document_fields[5] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_Document, name, name, 0),
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_Document, fields, name, &google_firestore_v1_Document_FieldsEntry_fields),
|
||||
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_Document, create_time, fields, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, google_firestore_v1_Document, update_time, create_time, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_Document_FieldsEntry_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_Document_FieldsEntry, key, key, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_Document_FieldsEntry, value, key, &google_firestore_v1_Value_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_Value_fields[12] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 1, BOOL , ONEOF, STATIC , FIRST, google_firestore_v1_Value, boolean_value, boolean_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 2, INT64 , ONEOF, STATIC , UNION, google_firestore_v1_Value, integer_value, integer_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 3, DOUBLE , ONEOF, STATIC , UNION, google_firestore_v1_Value, double_value, double_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 5, BYTES , ONEOF, POINTER , UNION, google_firestore_v1_Value, reference_value, reference_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 6, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Value, map_value, map_value, &google_firestore_v1_MapValue_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 8, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Value, geo_point_value, geo_point_value, &google_type_LatLng_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 9, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Value, array_value, array_value, &google_firestore_v1_ArrayValue_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 10, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Value, timestamp_value, timestamp_value, &google_protobuf_Timestamp_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 11, UENUM , ONEOF, STATIC , UNION, google_firestore_v1_Value, null_value, null_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 17, BYTES , ONEOF, POINTER , UNION, google_firestore_v1_Value, string_value, string_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(value_type, 18, BYTES , ONEOF, POINTER , UNION, google_firestore_v1_Value, bytes_value, bytes_value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_ArrayValue_fields[2] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_firestore_v1_ArrayValue, values, values, &google_firestore_v1_Value_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_MapValue_fields[2] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_firestore_v1_MapValue, fields, fields, &google_firestore_v1_MapValue_FieldsEntry_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_MapValue_FieldsEntry_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_MapValue_FieldsEntry, key, key, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_MapValue_FieldsEntry, value, key, &google_firestore_v1_Value_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Document, create_time) < 65536 && pb_membersize(google_firestore_v1_Document, update_time) < 65536 && pb_membersize(google_firestore_v1_Document_FieldsEntry, value) < 65536 && pb_membersize(google_firestore_v1_Value, map_value) < 65536 && pb_membersize(google_firestore_v1_Value, geo_point_value) < 65536 && pb_membersize(google_firestore_v1_Value, array_value) < 65536 && pb_membersize(google_firestore_v1_Value, timestamp_value) < 65536 && pb_membersize(google_firestore_v1_MapValue_FieldsEntry, value) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_firestore_v1_Document_google_firestore_v1_Document_FieldsEntry_google_firestore_v1_Value_google_firestore_v1_ArrayValue_google_firestore_v1_MapValue_google_firestore_v1_MapValue_FieldsEntry)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Document, create_time) < 256 && pb_membersize(google_firestore_v1_Document, update_time) < 256 && pb_membersize(google_firestore_v1_Document_FieldsEntry, value) < 256 && pb_membersize(google_firestore_v1_Value, map_value) < 256 && pb_membersize(google_firestore_v1_Value, geo_point_value) < 256 && pb_membersize(google_firestore_v1_Value, array_value) < 256 && pb_membersize(google_firestore_v1_Value, timestamp_value) < 256 && pb_membersize(google_firestore_v1_MapValue_FieldsEntry, value) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_firestore_v1_Document_google_firestore_v1_Document_FieldsEntry_google_firestore_v1_Value_google_firestore_v1_ArrayValue_google_firestore_v1_MapValue_google_firestore_v1_MapValue_FieldsEntry)
|
||||
#endif
|
||||
|
||||
|
||||
/* On some platforms (such as AVR), double is really float.
|
||||
* These are not directly supported by nanopb, but see example_avr_double.
|
||||
* To get rid of this error, remove any double fields from your .proto.
|
||||
*/
|
||||
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
|
||||
|
||||
std::string google_firestore_v1_Document::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Document", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("name: ", name, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != fields_count; ++i) {
|
||||
result += PrintMessageField("fields ", fields[i], indent + 1, true);
|
||||
}
|
||||
result += PrintMessageField("create_time ",
|
||||
create_time, indent + 1, false);
|
||||
if (has_update_time) {
|
||||
result += PrintMessageField("update_time ",
|
||||
update_time, indent + 1, true);
|
||||
}
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_Document_FieldsEntry::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "FieldsEntry", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("key: ", key, indent + 1, false);
|
||||
result += PrintMessageField("value ", value, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_Value::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Value", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_value_type) {
|
||||
case google_firestore_v1_Value_boolean_value_tag:
|
||||
result += PrintPrimitiveField("boolean_value: ",
|
||||
boolean_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_integer_value_tag:
|
||||
result += PrintPrimitiveField("integer_value: ",
|
||||
integer_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_double_value_tag:
|
||||
result += PrintPrimitiveField("double_value: ",
|
||||
double_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_reference_value_tag:
|
||||
result += PrintPrimitiveField("reference_value: ",
|
||||
reference_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_map_value_tag:
|
||||
result += PrintMessageField("map_value ", map_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_geo_point_value_tag:
|
||||
result += PrintMessageField("geo_point_value ",
|
||||
geo_point_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_array_value_tag:
|
||||
result += PrintMessageField("array_value ",
|
||||
array_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_timestamp_value_tag:
|
||||
result += PrintMessageField("timestamp_value ",
|
||||
timestamp_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_null_value_tag:
|
||||
result += PrintEnumField("null_value: ", null_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_string_value_tag:
|
||||
result += PrintPrimitiveField("string_value: ",
|
||||
string_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Value_bytes_value_tag:
|
||||
result += PrintPrimitiveField("bytes_value: ",
|
||||
bytes_value, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_ArrayValue::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ArrayValue", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != values_count; ++i) {
|
||||
result += PrintMessageField("values ", values[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_MapValue::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "MapValue", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != fields_count; ++i) {
|
||||
result += PrintMessageField("fields ", fields[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_MapValue_FieldsEntry::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "FieldsEntry", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("key: ", key, indent + 1, false);
|
||||
result += PrintMessageField("value ", value, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_FIRESTORE_V1_DOCUMENT_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_FIRESTORE_V1_DOCUMENT_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/api/annotations.nanopb.h"
|
||||
|
||||
#include "google/protobuf/struct.nanopb.h"
|
||||
|
||||
#include "google/protobuf/timestamp.nanopb.h"
|
||||
|
||||
#include "google/type/latlng.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_firestore_v1_ArrayValue {
|
||||
pb_size_t values_count;
|
||||
struct _google_firestore_v1_Value *values;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_ArrayValue) */
|
||||
} google_firestore_v1_ArrayValue;
|
||||
|
||||
typedef struct _google_firestore_v1_MapValue {
|
||||
pb_size_t fields_count;
|
||||
struct _google_firestore_v1_MapValue_FieldsEntry *fields;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_MapValue) */
|
||||
} google_firestore_v1_MapValue;
|
||||
|
||||
typedef struct _google_firestore_v1_Document {
|
||||
pb_bytes_array_t *name;
|
||||
pb_size_t fields_count;
|
||||
struct _google_firestore_v1_Document_FieldsEntry *fields;
|
||||
google_protobuf_Timestamp create_time;
|
||||
bool has_update_time;
|
||||
google_protobuf_Timestamp update_time;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_Document) */
|
||||
} google_firestore_v1_Document;
|
||||
|
||||
typedef struct _google_firestore_v1_Value {
|
||||
pb_size_t which_value_type;
|
||||
union {
|
||||
bool boolean_value;
|
||||
int64_t integer_value;
|
||||
double double_value;
|
||||
pb_bytes_array_t *reference_value;
|
||||
google_firestore_v1_MapValue map_value;
|
||||
google_type_LatLng geo_point_value;
|
||||
google_firestore_v1_ArrayValue array_value;
|
||||
google_protobuf_Timestamp timestamp_value;
|
||||
google_protobuf_NullValue null_value;
|
||||
pb_bytes_array_t *string_value;
|
||||
pb_bytes_array_t *bytes_value;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_Value) */
|
||||
} google_firestore_v1_Value;
|
||||
|
||||
typedef struct _google_firestore_v1_Document_FieldsEntry {
|
||||
pb_bytes_array_t *key;
|
||||
google_firestore_v1_Value value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_Document_FieldsEntry) */
|
||||
} google_firestore_v1_Document_FieldsEntry;
|
||||
|
||||
typedef struct _google_firestore_v1_MapValue_FieldsEntry {
|
||||
pb_bytes_array_t *key;
|
||||
google_firestore_v1_Value value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_MapValue_FieldsEntry) */
|
||||
} google_firestore_v1_MapValue_FieldsEntry;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_firestore_v1_Document_init_default {NULL, 0, NULL, google_protobuf_Timestamp_init_default, false, google_protobuf_Timestamp_init_default}
|
||||
#define google_firestore_v1_Document_FieldsEntry_init_default {NULL, google_firestore_v1_Value_init_default}
|
||||
#define google_firestore_v1_Value_init_default {0, {0}}
|
||||
#define google_firestore_v1_ArrayValue_init_default {0, NULL}
|
||||
#define google_firestore_v1_MapValue_init_default {0, NULL}
|
||||
#define google_firestore_v1_MapValue_FieldsEntry_init_default {NULL, google_firestore_v1_Value_init_default}
|
||||
#define google_firestore_v1_Document_init_zero {NULL, 0, NULL, google_protobuf_Timestamp_init_zero, false, google_protobuf_Timestamp_init_zero}
|
||||
#define google_firestore_v1_Document_FieldsEntry_init_zero {NULL, google_firestore_v1_Value_init_zero}
|
||||
#define google_firestore_v1_Value_init_zero {0, {0}}
|
||||
#define google_firestore_v1_ArrayValue_init_zero {0, NULL}
|
||||
#define google_firestore_v1_MapValue_init_zero {0, NULL}
|
||||
#define google_firestore_v1_MapValue_FieldsEntry_init_zero {NULL, google_firestore_v1_Value_init_zero}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_firestore_v1_ArrayValue_values_tag 1
|
||||
#define google_firestore_v1_MapValue_fields_tag 1
|
||||
#define google_firestore_v1_Document_name_tag 1
|
||||
#define google_firestore_v1_Document_fields_tag 2
|
||||
#define google_firestore_v1_Document_create_time_tag 3
|
||||
#define google_firestore_v1_Document_update_time_tag 4
|
||||
#define google_firestore_v1_Value_boolean_value_tag 1
|
||||
#define google_firestore_v1_Value_integer_value_tag 2
|
||||
#define google_firestore_v1_Value_double_value_tag 3
|
||||
#define google_firestore_v1_Value_reference_value_tag 5
|
||||
#define google_firestore_v1_Value_map_value_tag 6
|
||||
#define google_firestore_v1_Value_geo_point_value_tag 8
|
||||
#define google_firestore_v1_Value_array_value_tag 9
|
||||
#define google_firestore_v1_Value_timestamp_value_tag 10
|
||||
#define google_firestore_v1_Value_null_value_tag 11
|
||||
#define google_firestore_v1_Value_string_value_tag 17
|
||||
#define google_firestore_v1_Value_bytes_value_tag 18
|
||||
#define google_firestore_v1_Document_FieldsEntry_key_tag 1
|
||||
#define google_firestore_v1_Document_FieldsEntry_value_tag 2
|
||||
#define google_firestore_v1_MapValue_FieldsEntry_key_tag 1
|
||||
#define google_firestore_v1_MapValue_FieldsEntry_value_tag 2
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_firestore_v1_Document_fields[5];
|
||||
extern const pb_field_t google_firestore_v1_Document_FieldsEntry_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_Value_fields[12];
|
||||
extern const pb_field_t google_firestore_v1_ArrayValue_fields[2];
|
||||
extern const pb_field_t google_firestore_v1_MapValue_fields[2];
|
||||
extern const pb_field_t google_firestore_v1_MapValue_FieldsEntry_fields[3];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* google_firestore_v1_Document_size depends on runtime parameters */
|
||||
/* google_firestore_v1_Document_FieldsEntry_size depends on runtime parameters */
|
||||
/* google_firestore_v1_Value_size depends on runtime parameters */
|
||||
/* google_firestore_v1_ArrayValue_size depends on runtime parameters */
|
||||
/* google_firestore_v1_MapValue_size depends on runtime parameters */
|
||||
/* google_firestore_v1_MapValue_FieldsEntry_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define DOCUMENT_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+849
@@ -0,0 +1,849 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "firestore.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_firestore_v1_GetDocumentRequest_fields[5] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_GetDocumentRequest, name, name, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_GetDocumentRequest, mask, name, &google_firestore_v1_DocumentMask_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(consistency_selector, 3, BYTES , ONEOF, POINTER , OTHER, google_firestore_v1_GetDocumentRequest, transaction, mask, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(consistency_selector, 5, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_GetDocumentRequest, read_time, mask, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_ListDocumentsRequest_fields[10] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_ListDocumentsRequest, parent, parent, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_ListDocumentsRequest, collection_id, parent, 0),
|
||||
PB_FIELD( 3, INT32 , SINGULAR, STATIC , OTHER, google_firestore_v1_ListDocumentsRequest, page_size, collection_id, 0),
|
||||
PB_FIELD( 4, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_ListDocumentsRequest, page_token, page_size, 0),
|
||||
PB_FIELD( 6, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_ListDocumentsRequest, order_by, page_token, 0),
|
||||
PB_FIELD( 7, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_ListDocumentsRequest, mask, order_by, &google_firestore_v1_DocumentMask_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(consistency_selector, 8, BYTES , ONEOF, POINTER , OTHER, google_firestore_v1_ListDocumentsRequest, transaction, mask, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(consistency_selector, 10, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_ListDocumentsRequest, read_time, mask, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 12, BOOL , SINGULAR, STATIC , OTHER, google_firestore_v1_ListDocumentsRequest, show_missing, read_time, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_ListDocumentsResponse_fields[3] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_firestore_v1_ListDocumentsResponse, documents, documents, &google_firestore_v1_Document_fields),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_ListDocumentsResponse, next_page_token, documents, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_CreateDocumentRequest_fields[6] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_CreateDocumentRequest, parent, parent, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_CreateDocumentRequest, collection_id, parent, 0),
|
||||
PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_CreateDocumentRequest, document_id, collection_id, 0),
|
||||
PB_FIELD( 4, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_CreateDocumentRequest, document, document_id, &google_firestore_v1_Document_fields),
|
||||
PB_FIELD( 5, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_CreateDocumentRequest, mask, document, &google_firestore_v1_DocumentMask_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_UpdateDocumentRequest_fields[5] = {
|
||||
PB_FIELD( 1, MESSAGE , SINGULAR, STATIC , FIRST, google_firestore_v1_UpdateDocumentRequest, document, document, &google_firestore_v1_Document_fields),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_UpdateDocumentRequest, update_mask, document, &google_firestore_v1_DocumentMask_fields),
|
||||
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_UpdateDocumentRequest, mask, update_mask, &google_firestore_v1_DocumentMask_fields),
|
||||
PB_FIELD( 4, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_UpdateDocumentRequest, current_document, mask, &google_firestore_v1_Precondition_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_DeleteDocumentRequest_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_DeleteDocumentRequest, name, name, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_DeleteDocumentRequest, current_document, name, &google_firestore_v1_Precondition_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_BatchGetDocumentsRequest_fields[7] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_BatchGetDocumentsRequest, database, database, 0),
|
||||
PB_FIELD( 2, BYTES , REPEATED, POINTER , OTHER, google_firestore_v1_BatchGetDocumentsRequest, documents, database, 0),
|
||||
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_BatchGetDocumentsRequest, mask, documents, &google_firestore_v1_DocumentMask_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(consistency_selector, 4, BYTES , ONEOF, POINTER , OTHER, google_firestore_v1_BatchGetDocumentsRequest, transaction, mask, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(consistency_selector, 5, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_BatchGetDocumentsRequest, new_transaction, mask, &google_firestore_v1_TransactionOptions_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(consistency_selector, 7, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_BatchGetDocumentsRequest, read_time, mask, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_BatchGetDocumentsResponse_fields[5] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(result, 1, MESSAGE , ONEOF, STATIC , FIRST, google_firestore_v1_BatchGetDocumentsResponse, found, found, &google_firestore_v1_Document_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(result, 2, BYTES , ONEOF, POINTER , UNION, google_firestore_v1_BatchGetDocumentsResponse, missing, missing, 0),
|
||||
PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_BatchGetDocumentsResponse, transaction, missing, 0),
|
||||
PB_FIELD( 4, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_BatchGetDocumentsResponse, read_time, transaction, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_BeginTransactionRequest_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_BeginTransactionRequest, database, database, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_BeginTransactionRequest, options, database, &google_firestore_v1_TransactionOptions_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_BeginTransactionResponse_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_BeginTransactionResponse, transaction, transaction, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_CommitRequest_fields[4] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_CommitRequest, database, database, 0),
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_CommitRequest, writes, database, &google_firestore_v1_Write_fields),
|
||||
PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_CommitRequest, transaction, writes, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_CommitResponse_fields[3] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_firestore_v1_CommitResponse, write_results, write_results, &google_firestore_v1_WriteResult_fields),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_CommitResponse, commit_time, write_results, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_RollbackRequest_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_RollbackRequest, database, database, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_RollbackRequest, transaction, database, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_RunQueryRequest_fields[6] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_RunQueryRequest, parent, parent, 0),
|
||||
PB_ONEOF_FIELD(query_type, 2, MESSAGE , ONEOF, STATIC , OTHER, google_firestore_v1_RunQueryRequest, structured_query, parent, &google_firestore_v1_StructuredQuery_fields),
|
||||
PB_ONEOF_FIELD(consistency_selector, 5, BYTES , ONEOF, POINTER , OTHER, google_firestore_v1_RunQueryRequest, transaction, query_type.structured_query, 0),
|
||||
PB_ONEOF_FIELD(consistency_selector, 6, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_RunQueryRequest, new_transaction, query_type.structured_query, &google_firestore_v1_TransactionOptions_fields),
|
||||
PB_ONEOF_FIELD(consistency_selector, 7, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_RunQueryRequest, read_time, query_type.structured_query, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_RunQueryResponse_fields[5] = {
|
||||
PB_FIELD( 1, MESSAGE , SINGULAR, STATIC , FIRST, google_firestore_v1_RunQueryResponse, document, document, &google_firestore_v1_Document_fields),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_RunQueryResponse, transaction, document, 0),
|
||||
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_RunQueryResponse, read_time, transaction, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 4, INT32 , SINGULAR, STATIC , OTHER, google_firestore_v1_RunQueryResponse, skipped_results, read_time, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_WriteRequest_fields[6] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_WriteRequest, database, database, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_WriteRequest, stream_id, database, 0),
|
||||
PB_FIELD( 3, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_WriteRequest, writes, stream_id, &google_firestore_v1_Write_fields),
|
||||
PB_FIELD( 4, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_WriteRequest, stream_token, writes, 0),
|
||||
PB_FIELD( 5, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_WriteRequest, labels, stream_token, &google_firestore_v1_WriteRequest_LabelsEntry_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_WriteRequest_LabelsEntry_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_WriteRequest_LabelsEntry, key, key, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_WriteRequest_LabelsEntry, value, key, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_WriteResponse_fields[5] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_WriteResponse, stream_id, stream_id, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_WriteResponse, stream_token, stream_id, 0),
|
||||
PB_FIELD( 3, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_WriteResponse, write_results, stream_token, &google_firestore_v1_WriteResult_fields),
|
||||
PB_FIELD( 4, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_WriteResponse, commit_time, write_results, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_ListenRequest_fields[5] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_ListenRequest, database, database, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(target_change, 2, MESSAGE , ONEOF, STATIC , OTHER, google_firestore_v1_ListenRequest, add_target, database, &google_firestore_v1_Target_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(target_change, 3, INT32 , ONEOF, STATIC , UNION, google_firestore_v1_ListenRequest, remove_target, database, 0),
|
||||
PB_FIELD( 4, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_ListenRequest, labels, remove_target, &google_firestore_v1_ListenRequest_LabelsEntry_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_ListenRequest_LabelsEntry_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_ListenRequest_LabelsEntry, key, key, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_ListenRequest_LabelsEntry, value, key, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_ListenResponse_fields[6] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(response_type, 2, MESSAGE , ONEOF, STATIC , FIRST, google_firestore_v1_ListenResponse, target_change, target_change, &google_firestore_v1_TargetChange_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(response_type, 3, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_ListenResponse, document_change, document_change, &google_firestore_v1_DocumentChange_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(response_type, 4, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_ListenResponse, document_delete, document_delete, &google_firestore_v1_DocumentDelete_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(response_type, 5, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_ListenResponse, filter, filter, &google_firestore_v1_ExistenceFilter_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(response_type, 6, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_ListenResponse, document_remove, document_remove, &google_firestore_v1_DocumentRemove_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_Target_fields[7] = {
|
||||
PB_ONEOF_FIELD(target_type, 2, MESSAGE , ONEOF, STATIC , FIRST, google_firestore_v1_Target, query, query, &google_firestore_v1_Target_QueryTarget_fields),
|
||||
PB_ONEOF_FIELD(target_type, 3, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Target, documents, documents, &google_firestore_v1_Target_DocumentsTarget_fields),
|
||||
PB_ONEOF_FIELD(resume_type, 4, BYTES , ONEOF, POINTER , OTHER, google_firestore_v1_Target, resume_token, target_type.documents, 0),
|
||||
PB_ONEOF_FIELD(resume_type, 11, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Target, read_time, target_type.documents, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 5, INT32 , SINGULAR, STATIC , OTHER, google_firestore_v1_Target, target_id, resume_type.read_time, 0),
|
||||
PB_FIELD( 6, BOOL , SINGULAR, STATIC , OTHER, google_firestore_v1_Target, once, target_id, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_Target_DocumentsTarget_fields[2] = {
|
||||
PB_FIELD( 2, BYTES , REPEATED, POINTER , FIRST, google_firestore_v1_Target_DocumentsTarget, documents, documents, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_Target_QueryTarget_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_Target_QueryTarget, parent, parent, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(query_type, 2, MESSAGE , ONEOF, STATIC , OTHER, google_firestore_v1_Target_QueryTarget, structured_query, parent, &google_firestore_v1_StructuredQuery_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_TargetChange_fields[6] = {
|
||||
PB_FIELD( 1, UENUM , SINGULAR, STATIC , FIRST, google_firestore_v1_TargetChange, target_change_type, target_change_type, 0),
|
||||
PB_FIELD( 2, INT32 , REPEATED, POINTER , OTHER, google_firestore_v1_TargetChange, target_ids, target_change_type, 0),
|
||||
PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, google_firestore_v1_TargetChange, cause, target_ids, &google_rpc_Status_fields),
|
||||
PB_FIELD( 4, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_TargetChange, resume_token, cause, 0),
|
||||
PB_FIELD( 6, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_TargetChange, read_time, resume_token, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_ListCollectionIdsRequest_fields[4] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_ListCollectionIdsRequest, parent, parent, 0),
|
||||
PB_FIELD( 2, INT32 , SINGULAR, STATIC , OTHER, google_firestore_v1_ListCollectionIdsRequest, page_size, parent, 0),
|
||||
PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_ListCollectionIdsRequest, page_token, page_size, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_ListCollectionIdsResponse_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , REPEATED, POINTER , FIRST, google_firestore_v1_ListCollectionIdsResponse, collection_ids, collection_ids, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_firestore_v1_ListCollectionIdsResponse, next_page_token, collection_ids, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_GetDocumentRequest, read_time) < 65536 && pb_membersize(google_firestore_v1_GetDocumentRequest, mask) < 65536 && pb_membersize(google_firestore_v1_ListDocumentsRequest, read_time) < 65536 && pb_membersize(google_firestore_v1_ListDocumentsRequest, mask) < 65536 && pb_membersize(google_firestore_v1_CreateDocumentRequest, document) < 65536 && pb_membersize(google_firestore_v1_CreateDocumentRequest, mask) < 65536 && pb_membersize(google_firestore_v1_UpdateDocumentRequest, document) < 65536 && pb_membersize(google_firestore_v1_UpdateDocumentRequest, update_mask) < 65536 && pb_membersize(google_firestore_v1_UpdateDocumentRequest, mask) < 65536 && pb_membersize(google_firestore_v1_UpdateDocumentRequest, current_document) < 65536 && pb_membersize(google_firestore_v1_DeleteDocumentRequest, current_document) < 65536 && pb_membersize(google_firestore_v1_BatchGetDocumentsRequest, new_transaction) < 65536 && pb_membersize(google_firestore_v1_BatchGetDocumentsRequest, read_time) < 65536 && pb_membersize(google_firestore_v1_BatchGetDocumentsRequest, mask) < 65536 && pb_membersize(google_firestore_v1_BatchGetDocumentsResponse, found) < 65536 && pb_membersize(google_firestore_v1_BatchGetDocumentsResponse, read_time) < 65536 && pb_membersize(google_firestore_v1_BeginTransactionRequest, options) < 65536 && pb_membersize(google_firestore_v1_CommitResponse, commit_time) < 65536 && pb_membersize(google_firestore_v1_RunQueryRequest, query_type.structured_query) < 65536 && pb_membersize(google_firestore_v1_RunQueryRequest, consistency_selector.new_transaction) < 65536 && pb_membersize(google_firestore_v1_RunQueryRequest, consistency_selector.read_time) < 65536 && pb_membersize(google_firestore_v1_RunQueryResponse, document) < 65536 && pb_membersize(google_firestore_v1_RunQueryResponse, read_time) < 65536 && pb_membersize(google_firestore_v1_WriteResponse, commit_time) < 65536 && pb_membersize(google_firestore_v1_ListenRequest, add_target) < 65536 && pb_membersize(google_firestore_v1_ListenResponse, target_change) < 65536 && pb_membersize(google_firestore_v1_ListenResponse, document_change) < 65536 && pb_membersize(google_firestore_v1_ListenResponse, document_delete) < 65536 && pb_membersize(google_firestore_v1_ListenResponse, filter) < 65536 && pb_membersize(google_firestore_v1_ListenResponse, document_remove) < 65536 && pb_membersize(google_firestore_v1_Target, target_type.query) < 65536 && pb_membersize(google_firestore_v1_Target, target_type.documents) < 65536 && pb_membersize(google_firestore_v1_Target, resume_type.read_time) < 65536 && pb_membersize(google_firestore_v1_Target_QueryTarget, structured_query) < 65536 && pb_membersize(google_firestore_v1_TargetChange, cause) < 65536 && pb_membersize(google_firestore_v1_TargetChange, read_time) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_firestore_v1_GetDocumentRequest_google_firestore_v1_ListDocumentsRequest_google_firestore_v1_ListDocumentsResponse_google_firestore_v1_CreateDocumentRequest_google_firestore_v1_UpdateDocumentRequest_google_firestore_v1_DeleteDocumentRequest_google_firestore_v1_BatchGetDocumentsRequest_google_firestore_v1_BatchGetDocumentsResponse_google_firestore_v1_BeginTransactionRequest_google_firestore_v1_BeginTransactionResponse_google_firestore_v1_CommitRequest_google_firestore_v1_CommitResponse_google_firestore_v1_RollbackRequest_google_firestore_v1_RunQueryRequest_google_firestore_v1_RunQueryResponse_google_firestore_v1_WriteRequest_google_firestore_v1_WriteRequest_LabelsEntry_google_firestore_v1_WriteResponse_google_firestore_v1_ListenRequest_google_firestore_v1_ListenRequest_LabelsEntry_google_firestore_v1_ListenResponse_google_firestore_v1_Target_google_firestore_v1_Target_DocumentsTarget_google_firestore_v1_Target_QueryTarget_google_firestore_v1_TargetChange_google_firestore_v1_ListCollectionIdsRequest_google_firestore_v1_ListCollectionIdsResponse)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_GetDocumentRequest, read_time) < 256 && pb_membersize(google_firestore_v1_GetDocumentRequest, mask) < 256 && pb_membersize(google_firestore_v1_ListDocumentsRequest, read_time) < 256 && pb_membersize(google_firestore_v1_ListDocumentsRequest, mask) < 256 && pb_membersize(google_firestore_v1_CreateDocumentRequest, document) < 256 && pb_membersize(google_firestore_v1_CreateDocumentRequest, mask) < 256 && pb_membersize(google_firestore_v1_UpdateDocumentRequest, document) < 256 && pb_membersize(google_firestore_v1_UpdateDocumentRequest, update_mask) < 256 && pb_membersize(google_firestore_v1_UpdateDocumentRequest, mask) < 256 && pb_membersize(google_firestore_v1_UpdateDocumentRequest, current_document) < 256 && pb_membersize(google_firestore_v1_DeleteDocumentRequest, current_document) < 256 && pb_membersize(google_firestore_v1_BatchGetDocumentsRequest, new_transaction) < 256 && pb_membersize(google_firestore_v1_BatchGetDocumentsRequest, read_time) < 256 && pb_membersize(google_firestore_v1_BatchGetDocumentsRequest, mask) < 256 && pb_membersize(google_firestore_v1_BatchGetDocumentsResponse, found) < 256 && pb_membersize(google_firestore_v1_BatchGetDocumentsResponse, read_time) < 256 && pb_membersize(google_firestore_v1_BeginTransactionRequest, options) < 256 && pb_membersize(google_firestore_v1_CommitResponse, commit_time) < 256 && pb_membersize(google_firestore_v1_RunQueryRequest, query_type.structured_query) < 256 && pb_membersize(google_firestore_v1_RunQueryRequest, consistency_selector.new_transaction) < 256 && pb_membersize(google_firestore_v1_RunQueryRequest, consistency_selector.read_time) < 256 && pb_membersize(google_firestore_v1_RunQueryResponse, document) < 256 && pb_membersize(google_firestore_v1_RunQueryResponse, read_time) < 256 && pb_membersize(google_firestore_v1_WriteResponse, commit_time) < 256 && pb_membersize(google_firestore_v1_ListenRequest, add_target) < 256 && pb_membersize(google_firestore_v1_ListenResponse, target_change) < 256 && pb_membersize(google_firestore_v1_ListenResponse, document_change) < 256 && pb_membersize(google_firestore_v1_ListenResponse, document_delete) < 256 && pb_membersize(google_firestore_v1_ListenResponse, filter) < 256 && pb_membersize(google_firestore_v1_ListenResponse, document_remove) < 256 && pb_membersize(google_firestore_v1_Target, target_type.query) < 256 && pb_membersize(google_firestore_v1_Target, target_type.documents) < 256 && pb_membersize(google_firestore_v1_Target, resume_type.read_time) < 256 && pb_membersize(google_firestore_v1_Target_QueryTarget, structured_query) < 256 && pb_membersize(google_firestore_v1_TargetChange, cause) < 256 && pb_membersize(google_firestore_v1_TargetChange, read_time) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_firestore_v1_GetDocumentRequest_google_firestore_v1_ListDocumentsRequest_google_firestore_v1_ListDocumentsResponse_google_firestore_v1_CreateDocumentRequest_google_firestore_v1_UpdateDocumentRequest_google_firestore_v1_DeleteDocumentRequest_google_firestore_v1_BatchGetDocumentsRequest_google_firestore_v1_BatchGetDocumentsResponse_google_firestore_v1_BeginTransactionRequest_google_firestore_v1_BeginTransactionResponse_google_firestore_v1_CommitRequest_google_firestore_v1_CommitResponse_google_firestore_v1_RollbackRequest_google_firestore_v1_RunQueryRequest_google_firestore_v1_RunQueryResponse_google_firestore_v1_WriteRequest_google_firestore_v1_WriteRequest_LabelsEntry_google_firestore_v1_WriteResponse_google_firestore_v1_ListenRequest_google_firestore_v1_ListenRequest_LabelsEntry_google_firestore_v1_ListenResponse_google_firestore_v1_Target_google_firestore_v1_Target_DocumentsTarget_google_firestore_v1_Target_QueryTarget_google_firestore_v1_TargetChange_google_firestore_v1_ListCollectionIdsRequest_google_firestore_v1_ListCollectionIdsResponse)
|
||||
#endif
|
||||
|
||||
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_TargetChange_TargetChangeType value) {
|
||||
switch (value) {
|
||||
case google_firestore_v1_TargetChange_TargetChangeType_NO_CHANGE:
|
||||
return "NO_CHANGE";
|
||||
case google_firestore_v1_TargetChange_TargetChangeType_ADD:
|
||||
return "ADD";
|
||||
case google_firestore_v1_TargetChange_TargetChangeType_REMOVE:
|
||||
return "REMOVE";
|
||||
case google_firestore_v1_TargetChange_TargetChangeType_CURRENT:
|
||||
return "CURRENT";
|
||||
case google_firestore_v1_TargetChange_TargetChangeType_RESET:
|
||||
return "RESET";
|
||||
}
|
||||
return "<unknown enum value>";
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_GetDocumentRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "GetDocumentRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("name: ", name, indent + 1, false);
|
||||
result += PrintMessageField("mask ", mask, indent + 1, false);
|
||||
switch (which_consistency_selector) {
|
||||
case google_firestore_v1_GetDocumentRequest_transaction_tag:
|
||||
result += PrintPrimitiveField("transaction: ",
|
||||
transaction, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_GetDocumentRequest_read_time_tag:
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_ListDocumentsRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ListDocumentsRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
|
||||
result += PrintPrimitiveField("collection_id: ",
|
||||
collection_id, indent + 1, false);
|
||||
result += PrintPrimitiveField("page_size: ", page_size, indent + 1, false);
|
||||
result += PrintPrimitiveField("page_token: ",
|
||||
page_token, indent + 1, false);
|
||||
result += PrintPrimitiveField("order_by: ", order_by, indent + 1, false);
|
||||
result += PrintMessageField("mask ", mask, indent + 1, false);
|
||||
switch (which_consistency_selector) {
|
||||
case google_firestore_v1_ListDocumentsRequest_transaction_tag:
|
||||
result += PrintPrimitiveField("transaction: ",
|
||||
transaction, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_ListDocumentsRequest_read_time_tag:
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
result += PrintPrimitiveField("show_missing: ",
|
||||
show_missing, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_ListDocumentsResponse::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ListDocumentsResponse", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != documents_count; ++i) {
|
||||
result += PrintMessageField("documents ",
|
||||
documents[i], indent + 1, true);
|
||||
}
|
||||
result += PrintPrimitiveField("next_page_token: ",
|
||||
next_page_token, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_CreateDocumentRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "CreateDocumentRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
|
||||
result += PrintPrimitiveField("collection_id: ",
|
||||
collection_id, indent + 1, false);
|
||||
result += PrintPrimitiveField("document_id: ",
|
||||
document_id, indent + 1, false);
|
||||
result += PrintMessageField("document ", document, indent + 1, false);
|
||||
result += PrintMessageField("mask ", mask, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_UpdateDocumentRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "UpdateDocumentRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintMessageField("document ", document, indent + 1, false);
|
||||
result += PrintMessageField("update_mask ",
|
||||
update_mask, indent + 1, false);
|
||||
result += PrintMessageField("mask ", mask, indent + 1, false);
|
||||
result += PrintMessageField("current_document ",
|
||||
current_document, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_DeleteDocumentRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "DeleteDocumentRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("name: ", name, indent + 1, false);
|
||||
result += PrintMessageField("current_document ",
|
||||
current_document, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_BatchGetDocumentsRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BatchGetDocumentsRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("database: ", database, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != documents_count; ++i) {
|
||||
result += PrintPrimitiveField("documents: ",
|
||||
documents[i], indent + 1, true);
|
||||
}
|
||||
result += PrintMessageField("mask ", mask, indent + 1, false);
|
||||
switch (which_consistency_selector) {
|
||||
case google_firestore_v1_BatchGetDocumentsRequest_transaction_tag:
|
||||
result += PrintPrimitiveField("transaction: ",
|
||||
transaction, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_BatchGetDocumentsRequest_new_transaction_tag:
|
||||
result += PrintMessageField("new_transaction ",
|
||||
new_transaction, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_BatchGetDocumentsRequest_read_time_tag:
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_BatchGetDocumentsResponse::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BatchGetDocumentsResponse", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_result) {
|
||||
case google_firestore_v1_BatchGetDocumentsResponse_found_tag:
|
||||
result += PrintMessageField("found ", found, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_BatchGetDocumentsResponse_missing_tag:
|
||||
result += PrintPrimitiveField("missing: ", missing, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
result += PrintPrimitiveField("transaction: ",
|
||||
transaction, indent + 1, false);
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_BeginTransactionRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BeginTransactionRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("database: ", database, indent + 1, false);
|
||||
result += PrintMessageField("options ", options, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_BeginTransactionResponse::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BeginTransactionResponse", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("transaction: ",
|
||||
transaction, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_CommitRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "CommitRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("database: ", database, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != writes_count; ++i) {
|
||||
result += PrintMessageField("writes ", writes[i], indent + 1, true);
|
||||
}
|
||||
result += PrintPrimitiveField("transaction: ",
|
||||
transaction, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_CommitResponse::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "CommitResponse", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != write_results_count; ++i) {
|
||||
result += PrintMessageField("write_results ",
|
||||
write_results[i], indent + 1, true);
|
||||
}
|
||||
result += PrintMessageField("commit_time ",
|
||||
commit_time, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_RollbackRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "RollbackRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("database: ", database, indent + 1, false);
|
||||
result += PrintPrimitiveField("transaction: ",
|
||||
transaction, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_RunQueryRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "RunQueryRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
|
||||
switch (which_query_type) {
|
||||
case google_firestore_v1_RunQueryRequest_structured_query_tag:
|
||||
result += PrintMessageField("structured_query ",
|
||||
query_type.structured_query, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
switch (which_consistency_selector) {
|
||||
case google_firestore_v1_RunQueryRequest_transaction_tag:
|
||||
result += PrintPrimitiveField("transaction: ",
|
||||
consistency_selector.transaction, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_RunQueryRequest_new_transaction_tag:
|
||||
result += PrintMessageField("new_transaction ",
|
||||
consistency_selector.new_transaction, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_RunQueryRequest_read_time_tag:
|
||||
result += PrintMessageField("read_time ",
|
||||
consistency_selector.read_time, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_RunQueryResponse::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "RunQueryResponse", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintMessageField("document ", document, indent + 1, false);
|
||||
result += PrintPrimitiveField("transaction: ",
|
||||
transaction, indent + 1, false);
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, false);
|
||||
result += PrintPrimitiveField("skipped_results: ",
|
||||
skipped_results, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_WriteRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "WriteRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("database: ", database, indent + 1, false);
|
||||
result += PrintPrimitiveField("stream_id: ", stream_id, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != writes_count; ++i) {
|
||||
result += PrintMessageField("writes ", writes[i], indent + 1, true);
|
||||
}
|
||||
result += PrintPrimitiveField("stream_token: ",
|
||||
stream_token, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != labels_count; ++i) {
|
||||
result += PrintMessageField("labels ", labels[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_WriteRequest_LabelsEntry::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "LabelsEntry", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("key: ", key, indent + 1, false);
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_WriteResponse::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "WriteResponse", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("stream_id: ", stream_id, indent + 1, false);
|
||||
result += PrintPrimitiveField("stream_token: ",
|
||||
stream_token, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != write_results_count; ++i) {
|
||||
result += PrintMessageField("write_results ",
|
||||
write_results[i], indent + 1, true);
|
||||
}
|
||||
result += PrintMessageField("commit_time ",
|
||||
commit_time, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_ListenRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ListenRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("database: ", database, indent + 1, false);
|
||||
switch (which_target_change) {
|
||||
case google_firestore_v1_ListenRequest_add_target_tag:
|
||||
result += PrintMessageField("add_target ",
|
||||
add_target, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_ListenRequest_remove_target_tag:
|
||||
result += PrintPrimitiveField("remove_target: ",
|
||||
remove_target, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
for (pb_size_t i = 0; i != labels_count; ++i) {
|
||||
result += PrintMessageField("labels ", labels[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_ListenRequest_LabelsEntry::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "LabelsEntry", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("key: ", key, indent + 1, false);
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_ListenResponse::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ListenResponse", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_response_type) {
|
||||
case google_firestore_v1_ListenResponse_target_change_tag:
|
||||
result += PrintMessageField("target_change ",
|
||||
target_change, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_ListenResponse_document_change_tag:
|
||||
result += PrintMessageField("document_change ",
|
||||
document_change, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_ListenResponse_document_delete_tag:
|
||||
result += PrintMessageField("document_delete ",
|
||||
document_delete, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_ListenResponse_filter_tag:
|
||||
result += PrintMessageField("filter ", filter, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_ListenResponse_document_remove_tag:
|
||||
result += PrintMessageField("document_remove ",
|
||||
document_remove, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_Target::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Target", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_target_type) {
|
||||
case google_firestore_v1_Target_query_tag:
|
||||
result += PrintMessageField("query ",
|
||||
target_type.query, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Target_documents_tag:
|
||||
result += PrintMessageField("documents ",
|
||||
target_type.documents, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
switch (which_resume_type) {
|
||||
case google_firestore_v1_Target_resume_token_tag:
|
||||
result += PrintPrimitiveField("resume_token: ",
|
||||
resume_type.resume_token, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Target_read_time_tag:
|
||||
result += PrintMessageField("read_time ",
|
||||
resume_type.read_time, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
result += PrintPrimitiveField("target_id: ", target_id, indent + 1, false);
|
||||
result += PrintPrimitiveField("once: ", once, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_Target_DocumentsTarget::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "DocumentsTarget", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != documents_count; ++i) {
|
||||
result += PrintPrimitiveField("documents: ",
|
||||
documents[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_Target_QueryTarget::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "QueryTarget", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
|
||||
switch (which_query_type) {
|
||||
case google_firestore_v1_Target_QueryTarget_structured_query_tag:
|
||||
result += PrintMessageField("structured_query ",
|
||||
structured_query, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_TargetChange::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "TargetChange", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintEnumField("target_change_type: ",
|
||||
target_change_type, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != target_ids_count; ++i) {
|
||||
result += PrintPrimitiveField("target_ids: ",
|
||||
target_ids[i], indent + 1, true);
|
||||
}
|
||||
if (has_cause) {
|
||||
result += PrintMessageField("cause ", cause, indent + 1, true);
|
||||
}
|
||||
result += PrintPrimitiveField("resume_token: ",
|
||||
resume_token, indent + 1, false);
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_ListCollectionIdsRequest::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ListCollectionIdsRequest", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
|
||||
result += PrintPrimitiveField("page_size: ", page_size, indent + 1, false);
|
||||
result += PrintPrimitiveField("page_token: ",
|
||||
page_token, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_ListCollectionIdsResponse::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ListCollectionIdsResponse", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != collection_ids_count; ++i) {
|
||||
result += PrintPrimitiveField("collection_ids: ",
|
||||
collection_ids[i], indent + 1, true);
|
||||
}
|
||||
result += PrintPrimitiveField("next_page_token: ",
|
||||
next_page_token, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+596
@@ -0,0 +1,596 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_FIRESTORE_V1_FIRESTORE_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_FIRESTORE_V1_FIRESTORE_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/api/annotations.nanopb.h"
|
||||
|
||||
#include "google/firestore/v1/common.nanopb.h"
|
||||
|
||||
#include "google/firestore/v1/document.nanopb.h"
|
||||
|
||||
#include "google/firestore/v1/query.nanopb.h"
|
||||
|
||||
#include "google/firestore/v1/write.nanopb.h"
|
||||
|
||||
#include "google/protobuf/empty.nanopb.h"
|
||||
|
||||
#include "google/protobuf/timestamp.nanopb.h"
|
||||
|
||||
#include "google/rpc/status.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Enum definitions */
|
||||
typedef enum _google_firestore_v1_TargetChange_TargetChangeType {
|
||||
google_firestore_v1_TargetChange_TargetChangeType_NO_CHANGE = 0,
|
||||
google_firestore_v1_TargetChange_TargetChangeType_ADD = 1,
|
||||
google_firestore_v1_TargetChange_TargetChangeType_REMOVE = 2,
|
||||
google_firestore_v1_TargetChange_TargetChangeType_CURRENT = 3,
|
||||
google_firestore_v1_TargetChange_TargetChangeType_RESET = 4
|
||||
} google_firestore_v1_TargetChange_TargetChangeType;
|
||||
#define _google_firestore_v1_TargetChange_TargetChangeType_MIN google_firestore_v1_TargetChange_TargetChangeType_NO_CHANGE
|
||||
#define _google_firestore_v1_TargetChange_TargetChangeType_MAX google_firestore_v1_TargetChange_TargetChangeType_RESET
|
||||
#define _google_firestore_v1_TargetChange_TargetChangeType_ARRAYSIZE ((google_firestore_v1_TargetChange_TargetChangeType)(google_firestore_v1_TargetChange_TargetChangeType_RESET+1))
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_firestore_v1_BeginTransactionResponse {
|
||||
pb_bytes_array_t *transaction;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_BeginTransactionResponse) */
|
||||
} google_firestore_v1_BeginTransactionResponse;
|
||||
|
||||
typedef struct _google_firestore_v1_CommitRequest {
|
||||
pb_bytes_array_t *database;
|
||||
pb_size_t writes_count;
|
||||
struct _google_firestore_v1_Write *writes;
|
||||
pb_bytes_array_t *transaction;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_CommitRequest) */
|
||||
} google_firestore_v1_CommitRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_ListCollectionIdsResponse {
|
||||
pb_size_t collection_ids_count;
|
||||
pb_bytes_array_t **collection_ids;
|
||||
pb_bytes_array_t *next_page_token;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_ListCollectionIdsResponse) */
|
||||
} google_firestore_v1_ListCollectionIdsResponse;
|
||||
|
||||
typedef struct _google_firestore_v1_ListDocumentsResponse {
|
||||
pb_size_t documents_count;
|
||||
struct _google_firestore_v1_Document *documents;
|
||||
pb_bytes_array_t *next_page_token;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_ListDocumentsResponse) */
|
||||
} google_firestore_v1_ListDocumentsResponse;
|
||||
|
||||
typedef struct _google_firestore_v1_ListenRequest_LabelsEntry {
|
||||
pb_bytes_array_t *key;
|
||||
pb_bytes_array_t *value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_ListenRequest_LabelsEntry) */
|
||||
} google_firestore_v1_ListenRequest_LabelsEntry;
|
||||
|
||||
typedef struct _google_firestore_v1_RollbackRequest {
|
||||
pb_bytes_array_t *database;
|
||||
pb_bytes_array_t *transaction;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_RollbackRequest) */
|
||||
} google_firestore_v1_RollbackRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_Target_DocumentsTarget {
|
||||
pb_size_t documents_count;
|
||||
pb_bytes_array_t **documents;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_Target_DocumentsTarget) */
|
||||
} google_firestore_v1_Target_DocumentsTarget;
|
||||
|
||||
typedef struct _google_firestore_v1_WriteRequest {
|
||||
pb_bytes_array_t *database;
|
||||
pb_bytes_array_t *stream_id;
|
||||
pb_size_t writes_count;
|
||||
struct _google_firestore_v1_Write *writes;
|
||||
pb_bytes_array_t *stream_token;
|
||||
pb_size_t labels_count;
|
||||
struct _google_firestore_v1_WriteRequest_LabelsEntry *labels;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_WriteRequest) */
|
||||
} google_firestore_v1_WriteRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_WriteRequest_LabelsEntry {
|
||||
pb_bytes_array_t *key;
|
||||
pb_bytes_array_t *value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_WriteRequest_LabelsEntry) */
|
||||
} google_firestore_v1_WriteRequest_LabelsEntry;
|
||||
|
||||
typedef struct _google_firestore_v1_BatchGetDocumentsRequest {
|
||||
pb_bytes_array_t *database;
|
||||
pb_size_t documents_count;
|
||||
pb_bytes_array_t **documents;
|
||||
google_firestore_v1_DocumentMask mask;
|
||||
pb_size_t which_consistency_selector;
|
||||
union {
|
||||
pb_bytes_array_t *transaction;
|
||||
google_firestore_v1_TransactionOptions new_transaction;
|
||||
google_protobuf_Timestamp read_time;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_BatchGetDocumentsRequest) */
|
||||
} google_firestore_v1_BatchGetDocumentsRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_BatchGetDocumentsResponse {
|
||||
pb_size_t which_result;
|
||||
union {
|
||||
google_firestore_v1_Document found;
|
||||
pb_bytes_array_t *missing;
|
||||
};
|
||||
pb_bytes_array_t *transaction;
|
||||
google_protobuf_Timestamp read_time;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_BatchGetDocumentsResponse) */
|
||||
} google_firestore_v1_BatchGetDocumentsResponse;
|
||||
|
||||
typedef struct _google_firestore_v1_BeginTransactionRequest {
|
||||
pb_bytes_array_t *database;
|
||||
google_firestore_v1_TransactionOptions options;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_BeginTransactionRequest) */
|
||||
} google_firestore_v1_BeginTransactionRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_CommitResponse {
|
||||
pb_size_t write_results_count;
|
||||
struct _google_firestore_v1_WriteResult *write_results;
|
||||
google_protobuf_Timestamp commit_time;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_CommitResponse) */
|
||||
} google_firestore_v1_CommitResponse;
|
||||
|
||||
typedef struct _google_firestore_v1_CreateDocumentRequest {
|
||||
pb_bytes_array_t *parent;
|
||||
pb_bytes_array_t *collection_id;
|
||||
pb_bytes_array_t *document_id;
|
||||
google_firestore_v1_Document document;
|
||||
google_firestore_v1_DocumentMask mask;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_CreateDocumentRequest) */
|
||||
} google_firestore_v1_CreateDocumentRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_DeleteDocumentRequest {
|
||||
pb_bytes_array_t *name;
|
||||
google_firestore_v1_Precondition current_document;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_DeleteDocumentRequest) */
|
||||
} google_firestore_v1_DeleteDocumentRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_GetDocumentRequest {
|
||||
pb_bytes_array_t *name;
|
||||
google_firestore_v1_DocumentMask mask;
|
||||
pb_size_t which_consistency_selector;
|
||||
union {
|
||||
pb_bytes_array_t *transaction;
|
||||
google_protobuf_Timestamp read_time;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_GetDocumentRequest) */
|
||||
} google_firestore_v1_GetDocumentRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_ListCollectionIdsRequest {
|
||||
pb_bytes_array_t *parent;
|
||||
int32_t page_size;
|
||||
pb_bytes_array_t *page_token;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_ListCollectionIdsRequest) */
|
||||
} google_firestore_v1_ListCollectionIdsRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_ListDocumentsRequest {
|
||||
pb_bytes_array_t *parent;
|
||||
pb_bytes_array_t *collection_id;
|
||||
int32_t page_size;
|
||||
pb_bytes_array_t *page_token;
|
||||
pb_bytes_array_t *order_by;
|
||||
google_firestore_v1_DocumentMask mask;
|
||||
pb_size_t which_consistency_selector;
|
||||
union {
|
||||
pb_bytes_array_t *transaction;
|
||||
google_protobuf_Timestamp read_time;
|
||||
};
|
||||
bool show_missing;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_ListDocumentsRequest) */
|
||||
} google_firestore_v1_ListDocumentsRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_RunQueryRequest {
|
||||
pb_bytes_array_t *parent;
|
||||
pb_size_t which_query_type;
|
||||
union {
|
||||
google_firestore_v1_StructuredQuery structured_query;
|
||||
} query_type;
|
||||
pb_size_t which_consistency_selector;
|
||||
union {
|
||||
pb_bytes_array_t *transaction;
|
||||
google_firestore_v1_TransactionOptions new_transaction;
|
||||
google_protobuf_Timestamp read_time;
|
||||
} consistency_selector;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_RunQueryRequest) */
|
||||
} google_firestore_v1_RunQueryRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_RunQueryResponse {
|
||||
google_firestore_v1_Document document;
|
||||
pb_bytes_array_t *transaction;
|
||||
google_protobuf_Timestamp read_time;
|
||||
int32_t skipped_results;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_RunQueryResponse) */
|
||||
} google_firestore_v1_RunQueryResponse;
|
||||
|
||||
typedef struct _google_firestore_v1_TargetChange {
|
||||
google_firestore_v1_TargetChange_TargetChangeType target_change_type;
|
||||
pb_size_t target_ids_count;
|
||||
int32_t *target_ids;
|
||||
bool has_cause;
|
||||
google_rpc_Status cause;
|
||||
pb_bytes_array_t *resume_token;
|
||||
google_protobuf_Timestamp read_time;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_TargetChange) */
|
||||
} google_firestore_v1_TargetChange;
|
||||
|
||||
typedef struct _google_firestore_v1_Target_QueryTarget {
|
||||
pb_bytes_array_t *parent;
|
||||
pb_size_t which_query_type;
|
||||
union {
|
||||
google_firestore_v1_StructuredQuery structured_query;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_Target_QueryTarget) */
|
||||
} google_firestore_v1_Target_QueryTarget;
|
||||
|
||||
typedef struct _google_firestore_v1_UpdateDocumentRequest {
|
||||
google_firestore_v1_Document document;
|
||||
google_firestore_v1_DocumentMask update_mask;
|
||||
google_firestore_v1_DocumentMask mask;
|
||||
google_firestore_v1_Precondition current_document;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_UpdateDocumentRequest) */
|
||||
} google_firestore_v1_UpdateDocumentRequest;
|
||||
|
||||
typedef struct _google_firestore_v1_WriteResponse {
|
||||
pb_bytes_array_t *stream_id;
|
||||
pb_bytes_array_t *stream_token;
|
||||
pb_size_t write_results_count;
|
||||
struct _google_firestore_v1_WriteResult *write_results;
|
||||
google_protobuf_Timestamp commit_time;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_WriteResponse) */
|
||||
} google_firestore_v1_WriteResponse;
|
||||
|
||||
typedef struct _google_firestore_v1_ListenResponse {
|
||||
pb_size_t which_response_type;
|
||||
union {
|
||||
google_firestore_v1_TargetChange target_change;
|
||||
google_firestore_v1_DocumentChange document_change;
|
||||
google_firestore_v1_DocumentDelete document_delete;
|
||||
google_firestore_v1_ExistenceFilter filter;
|
||||
google_firestore_v1_DocumentRemove document_remove;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_ListenResponse) */
|
||||
} google_firestore_v1_ListenResponse;
|
||||
|
||||
typedef struct _google_firestore_v1_Target {
|
||||
pb_size_t which_target_type;
|
||||
union {
|
||||
google_firestore_v1_Target_QueryTarget query;
|
||||
google_firestore_v1_Target_DocumentsTarget documents;
|
||||
} target_type;
|
||||
pb_size_t which_resume_type;
|
||||
union {
|
||||
pb_bytes_array_t *resume_token;
|
||||
google_protobuf_Timestamp read_time;
|
||||
} resume_type;
|
||||
int32_t target_id;
|
||||
bool once;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_Target) */
|
||||
} google_firestore_v1_Target;
|
||||
|
||||
typedef struct _google_firestore_v1_ListenRequest {
|
||||
pb_bytes_array_t *database;
|
||||
pb_size_t which_target_change;
|
||||
union {
|
||||
google_firestore_v1_Target add_target;
|
||||
int32_t remove_target;
|
||||
};
|
||||
pb_size_t labels_count;
|
||||
struct _google_firestore_v1_ListenRequest_LabelsEntry *labels;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_ListenRequest) */
|
||||
} google_firestore_v1_ListenRequest;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_firestore_v1_GetDocumentRequest_init_default {NULL, google_firestore_v1_DocumentMask_init_default, 0, {NULL}}
|
||||
#define google_firestore_v1_ListDocumentsRequest_init_default {NULL, NULL, 0, NULL, NULL, google_firestore_v1_DocumentMask_init_default, 0, {NULL}, 0}
|
||||
#define google_firestore_v1_ListDocumentsResponse_init_default {0, NULL, NULL}
|
||||
#define google_firestore_v1_CreateDocumentRequest_init_default {NULL, NULL, NULL, google_firestore_v1_Document_init_default, google_firestore_v1_DocumentMask_init_default}
|
||||
#define google_firestore_v1_UpdateDocumentRequest_init_default {google_firestore_v1_Document_init_default, google_firestore_v1_DocumentMask_init_default, google_firestore_v1_DocumentMask_init_default, google_firestore_v1_Precondition_init_default}
|
||||
#define google_firestore_v1_DeleteDocumentRequest_init_default {NULL, google_firestore_v1_Precondition_init_default}
|
||||
#define google_firestore_v1_BatchGetDocumentsRequest_init_default {NULL, 0, NULL, google_firestore_v1_DocumentMask_init_default, 0, {NULL}}
|
||||
#define google_firestore_v1_BatchGetDocumentsResponse_init_default {0, {google_firestore_v1_Document_init_default}, NULL, google_protobuf_Timestamp_init_default}
|
||||
#define google_firestore_v1_BeginTransactionRequest_init_default {NULL, google_firestore_v1_TransactionOptions_init_default}
|
||||
#define google_firestore_v1_BeginTransactionResponse_init_default {NULL}
|
||||
#define google_firestore_v1_CommitRequest_init_default {NULL, 0, NULL, NULL}
|
||||
#define google_firestore_v1_CommitResponse_init_default {0, NULL, google_protobuf_Timestamp_init_default}
|
||||
#define google_firestore_v1_RollbackRequest_init_default {NULL, NULL}
|
||||
#define google_firestore_v1_RunQueryRequest_init_default {NULL, 0, {google_firestore_v1_StructuredQuery_init_default}, 0, {NULL}}
|
||||
#define google_firestore_v1_RunQueryResponse_init_default {google_firestore_v1_Document_init_default, NULL, google_protobuf_Timestamp_init_default, 0}
|
||||
#define google_firestore_v1_WriteRequest_init_default {NULL, NULL, 0, NULL, NULL, 0, NULL}
|
||||
#define google_firestore_v1_WriteRequest_LabelsEntry_init_default {NULL, NULL}
|
||||
#define google_firestore_v1_WriteResponse_init_default {NULL, NULL, 0, NULL, google_protobuf_Timestamp_init_default}
|
||||
#define google_firestore_v1_ListenRequest_init_default {NULL, 0, {google_firestore_v1_Target_init_default}, 0, NULL}
|
||||
#define google_firestore_v1_ListenRequest_LabelsEntry_init_default {NULL, NULL}
|
||||
#define google_firestore_v1_ListenResponse_init_default {0, {google_firestore_v1_TargetChange_init_default}}
|
||||
#define google_firestore_v1_Target_init_default {0, {google_firestore_v1_Target_QueryTarget_init_default}, 0, {NULL}, 0, 0}
|
||||
#define google_firestore_v1_Target_DocumentsTarget_init_default {0, NULL}
|
||||
#define google_firestore_v1_Target_QueryTarget_init_default {NULL, 0, {google_firestore_v1_StructuredQuery_init_default}}
|
||||
#define google_firestore_v1_TargetChange_init_default {_google_firestore_v1_TargetChange_TargetChangeType_MIN, 0, NULL, false, google_rpc_Status_init_default, NULL, google_protobuf_Timestamp_init_default}
|
||||
#define google_firestore_v1_ListCollectionIdsRequest_init_default {NULL, 0, NULL}
|
||||
#define google_firestore_v1_ListCollectionIdsResponse_init_default {0, NULL, NULL}
|
||||
#define google_firestore_v1_GetDocumentRequest_init_zero {NULL, google_firestore_v1_DocumentMask_init_zero, 0, {NULL}}
|
||||
#define google_firestore_v1_ListDocumentsRequest_init_zero {NULL, NULL, 0, NULL, NULL, google_firestore_v1_DocumentMask_init_zero, 0, {NULL}, 0}
|
||||
#define google_firestore_v1_ListDocumentsResponse_init_zero {0, NULL, NULL}
|
||||
#define google_firestore_v1_CreateDocumentRequest_init_zero {NULL, NULL, NULL, google_firestore_v1_Document_init_zero, google_firestore_v1_DocumentMask_init_zero}
|
||||
#define google_firestore_v1_UpdateDocumentRequest_init_zero {google_firestore_v1_Document_init_zero, google_firestore_v1_DocumentMask_init_zero, google_firestore_v1_DocumentMask_init_zero, google_firestore_v1_Precondition_init_zero}
|
||||
#define google_firestore_v1_DeleteDocumentRequest_init_zero {NULL, google_firestore_v1_Precondition_init_zero}
|
||||
#define google_firestore_v1_BatchGetDocumentsRequest_init_zero {NULL, 0, NULL, google_firestore_v1_DocumentMask_init_zero, 0, {NULL}}
|
||||
#define google_firestore_v1_BatchGetDocumentsResponse_init_zero {0, {google_firestore_v1_Document_init_zero}, NULL, google_protobuf_Timestamp_init_zero}
|
||||
#define google_firestore_v1_BeginTransactionRequest_init_zero {NULL, google_firestore_v1_TransactionOptions_init_zero}
|
||||
#define google_firestore_v1_BeginTransactionResponse_init_zero {NULL}
|
||||
#define google_firestore_v1_CommitRequest_init_zero {NULL, 0, NULL, NULL}
|
||||
#define google_firestore_v1_CommitResponse_init_zero {0, NULL, google_protobuf_Timestamp_init_zero}
|
||||
#define google_firestore_v1_RollbackRequest_init_zero {NULL, NULL}
|
||||
#define google_firestore_v1_RunQueryRequest_init_zero {NULL, 0, {google_firestore_v1_StructuredQuery_init_zero}, 0, {NULL}}
|
||||
#define google_firestore_v1_RunQueryResponse_init_zero {google_firestore_v1_Document_init_zero, NULL, google_protobuf_Timestamp_init_zero, 0}
|
||||
#define google_firestore_v1_WriteRequest_init_zero {NULL, NULL, 0, NULL, NULL, 0, NULL}
|
||||
#define google_firestore_v1_WriteRequest_LabelsEntry_init_zero {NULL, NULL}
|
||||
#define google_firestore_v1_WriteResponse_init_zero {NULL, NULL, 0, NULL, google_protobuf_Timestamp_init_zero}
|
||||
#define google_firestore_v1_ListenRequest_init_zero {NULL, 0, {google_firestore_v1_Target_init_zero}, 0, NULL}
|
||||
#define google_firestore_v1_ListenRequest_LabelsEntry_init_zero {NULL, NULL}
|
||||
#define google_firestore_v1_ListenResponse_init_zero {0, {google_firestore_v1_TargetChange_init_zero}}
|
||||
#define google_firestore_v1_Target_init_zero {0, {google_firestore_v1_Target_QueryTarget_init_zero}, 0, {NULL}, 0, 0}
|
||||
#define google_firestore_v1_Target_DocumentsTarget_init_zero {0, NULL}
|
||||
#define google_firestore_v1_Target_QueryTarget_init_zero {NULL, 0, {google_firestore_v1_StructuredQuery_init_zero}}
|
||||
#define google_firestore_v1_TargetChange_init_zero {_google_firestore_v1_TargetChange_TargetChangeType_MIN, 0, NULL, false, google_rpc_Status_init_zero, NULL, google_protobuf_Timestamp_init_zero}
|
||||
#define google_firestore_v1_ListCollectionIdsRequest_init_zero {NULL, 0, NULL}
|
||||
#define google_firestore_v1_ListCollectionIdsResponse_init_zero {0, NULL, NULL}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_firestore_v1_BeginTransactionResponse_transaction_tag 1
|
||||
#define google_firestore_v1_CommitRequest_database_tag 1
|
||||
#define google_firestore_v1_CommitRequest_writes_tag 2
|
||||
#define google_firestore_v1_CommitRequest_transaction_tag 3
|
||||
#define google_firestore_v1_ListCollectionIdsResponse_collection_ids_tag 1
|
||||
#define google_firestore_v1_ListCollectionIdsResponse_next_page_token_tag 2
|
||||
#define google_firestore_v1_ListDocumentsResponse_documents_tag 1
|
||||
#define google_firestore_v1_ListDocumentsResponse_next_page_token_tag 2
|
||||
#define google_firestore_v1_ListenRequest_LabelsEntry_key_tag 1
|
||||
#define google_firestore_v1_ListenRequest_LabelsEntry_value_tag 2
|
||||
#define google_firestore_v1_RollbackRequest_database_tag 1
|
||||
#define google_firestore_v1_RollbackRequest_transaction_tag 2
|
||||
#define google_firestore_v1_Target_DocumentsTarget_documents_tag 2
|
||||
#define google_firestore_v1_WriteRequest_database_tag 1
|
||||
#define google_firestore_v1_WriteRequest_stream_id_tag 2
|
||||
#define google_firestore_v1_WriteRequest_writes_tag 3
|
||||
#define google_firestore_v1_WriteRequest_stream_token_tag 4
|
||||
#define google_firestore_v1_WriteRequest_labels_tag 5
|
||||
#define google_firestore_v1_WriteRequest_LabelsEntry_key_tag 1
|
||||
#define google_firestore_v1_WriteRequest_LabelsEntry_value_tag 2
|
||||
#define google_firestore_v1_BatchGetDocumentsRequest_transaction_tag 4
|
||||
#define google_firestore_v1_BatchGetDocumentsRequest_new_transaction_tag 5
|
||||
#define google_firestore_v1_BatchGetDocumentsRequest_read_time_tag 7
|
||||
#define google_firestore_v1_BatchGetDocumentsRequest_database_tag 1
|
||||
#define google_firestore_v1_BatchGetDocumentsRequest_documents_tag 2
|
||||
#define google_firestore_v1_BatchGetDocumentsRequest_mask_tag 3
|
||||
#define google_firestore_v1_BatchGetDocumentsResponse_found_tag 1
|
||||
#define google_firestore_v1_BatchGetDocumentsResponse_missing_tag 2
|
||||
#define google_firestore_v1_BatchGetDocumentsResponse_transaction_tag 3
|
||||
#define google_firestore_v1_BatchGetDocumentsResponse_read_time_tag 4
|
||||
#define google_firestore_v1_BeginTransactionRequest_database_tag 1
|
||||
#define google_firestore_v1_BeginTransactionRequest_options_tag 2
|
||||
#define google_firestore_v1_CommitResponse_write_results_tag 1
|
||||
#define google_firestore_v1_CommitResponse_commit_time_tag 2
|
||||
#define google_firestore_v1_CreateDocumentRequest_parent_tag 1
|
||||
#define google_firestore_v1_CreateDocumentRequest_collection_id_tag 2
|
||||
#define google_firestore_v1_CreateDocumentRequest_document_id_tag 3
|
||||
#define google_firestore_v1_CreateDocumentRequest_document_tag 4
|
||||
#define google_firestore_v1_CreateDocumentRequest_mask_tag 5
|
||||
#define google_firestore_v1_DeleteDocumentRequest_name_tag 1
|
||||
#define google_firestore_v1_DeleteDocumentRequest_current_document_tag 2
|
||||
#define google_firestore_v1_GetDocumentRequest_transaction_tag 3
|
||||
#define google_firestore_v1_GetDocumentRequest_read_time_tag 5
|
||||
#define google_firestore_v1_GetDocumentRequest_name_tag 1
|
||||
#define google_firestore_v1_GetDocumentRequest_mask_tag 2
|
||||
#define google_firestore_v1_ListCollectionIdsRequest_parent_tag 1
|
||||
#define google_firestore_v1_ListCollectionIdsRequest_page_size_tag 2
|
||||
#define google_firestore_v1_ListCollectionIdsRequest_page_token_tag 3
|
||||
#define google_firestore_v1_ListDocumentsRequest_transaction_tag 8
|
||||
#define google_firestore_v1_ListDocumentsRequest_read_time_tag 10
|
||||
#define google_firestore_v1_ListDocumentsRequest_parent_tag 1
|
||||
#define google_firestore_v1_ListDocumentsRequest_collection_id_tag 2
|
||||
#define google_firestore_v1_ListDocumentsRequest_page_size_tag 3
|
||||
#define google_firestore_v1_ListDocumentsRequest_page_token_tag 4
|
||||
#define google_firestore_v1_ListDocumentsRequest_order_by_tag 6
|
||||
#define google_firestore_v1_ListDocumentsRequest_mask_tag 7
|
||||
#define google_firestore_v1_ListDocumentsRequest_show_missing_tag 12
|
||||
#define google_firestore_v1_RunQueryRequest_structured_query_tag 2
|
||||
#define google_firestore_v1_RunQueryRequest_transaction_tag 5
|
||||
#define google_firestore_v1_RunQueryRequest_new_transaction_tag 6
|
||||
#define google_firestore_v1_RunQueryRequest_read_time_tag 7
|
||||
#define google_firestore_v1_RunQueryRequest_parent_tag 1
|
||||
#define google_firestore_v1_RunQueryResponse_transaction_tag 2
|
||||
#define google_firestore_v1_RunQueryResponse_document_tag 1
|
||||
#define google_firestore_v1_RunQueryResponse_read_time_tag 3
|
||||
#define google_firestore_v1_RunQueryResponse_skipped_results_tag 4
|
||||
#define google_firestore_v1_TargetChange_target_change_type_tag 1
|
||||
#define google_firestore_v1_TargetChange_target_ids_tag 2
|
||||
#define google_firestore_v1_TargetChange_cause_tag 3
|
||||
#define google_firestore_v1_TargetChange_resume_token_tag 4
|
||||
#define google_firestore_v1_TargetChange_read_time_tag 6
|
||||
#define google_firestore_v1_Target_QueryTarget_structured_query_tag 2
|
||||
#define google_firestore_v1_Target_QueryTarget_parent_tag 1
|
||||
#define google_firestore_v1_UpdateDocumentRequest_document_tag 1
|
||||
#define google_firestore_v1_UpdateDocumentRequest_update_mask_tag 2
|
||||
#define google_firestore_v1_UpdateDocumentRequest_mask_tag 3
|
||||
#define google_firestore_v1_UpdateDocumentRequest_current_document_tag 4
|
||||
#define google_firestore_v1_WriteResponse_stream_id_tag 1
|
||||
#define google_firestore_v1_WriteResponse_stream_token_tag 2
|
||||
#define google_firestore_v1_WriteResponse_write_results_tag 3
|
||||
#define google_firestore_v1_WriteResponse_commit_time_tag 4
|
||||
#define google_firestore_v1_ListenResponse_target_change_tag 2
|
||||
#define google_firestore_v1_ListenResponse_document_change_tag 3
|
||||
#define google_firestore_v1_ListenResponse_document_delete_tag 4
|
||||
#define google_firestore_v1_ListenResponse_filter_tag 5
|
||||
#define google_firestore_v1_ListenResponse_document_remove_tag 6
|
||||
#define google_firestore_v1_Target_query_tag 2
|
||||
#define google_firestore_v1_Target_documents_tag 3
|
||||
#define google_firestore_v1_Target_resume_token_tag 4
|
||||
#define google_firestore_v1_Target_read_time_tag 11
|
||||
#define google_firestore_v1_Target_target_id_tag 5
|
||||
#define google_firestore_v1_Target_once_tag 6
|
||||
#define google_firestore_v1_ListenRequest_add_target_tag 2
|
||||
#define google_firestore_v1_ListenRequest_remove_target_tag 3
|
||||
#define google_firestore_v1_ListenRequest_database_tag 1
|
||||
#define google_firestore_v1_ListenRequest_labels_tag 4
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_firestore_v1_GetDocumentRequest_fields[5];
|
||||
extern const pb_field_t google_firestore_v1_ListDocumentsRequest_fields[10];
|
||||
extern const pb_field_t google_firestore_v1_ListDocumentsResponse_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_CreateDocumentRequest_fields[6];
|
||||
extern const pb_field_t google_firestore_v1_UpdateDocumentRequest_fields[5];
|
||||
extern const pb_field_t google_firestore_v1_DeleteDocumentRequest_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_BatchGetDocumentsRequest_fields[7];
|
||||
extern const pb_field_t google_firestore_v1_BatchGetDocumentsResponse_fields[5];
|
||||
extern const pb_field_t google_firestore_v1_BeginTransactionRequest_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_BeginTransactionResponse_fields[2];
|
||||
extern const pb_field_t google_firestore_v1_CommitRequest_fields[4];
|
||||
extern const pb_field_t google_firestore_v1_CommitResponse_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_RollbackRequest_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_RunQueryRequest_fields[6];
|
||||
extern const pb_field_t google_firestore_v1_RunQueryResponse_fields[5];
|
||||
extern const pb_field_t google_firestore_v1_WriteRequest_fields[6];
|
||||
extern const pb_field_t google_firestore_v1_WriteRequest_LabelsEntry_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_WriteResponse_fields[5];
|
||||
extern const pb_field_t google_firestore_v1_ListenRequest_fields[5];
|
||||
extern const pb_field_t google_firestore_v1_ListenRequest_LabelsEntry_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_ListenResponse_fields[6];
|
||||
extern const pb_field_t google_firestore_v1_Target_fields[7];
|
||||
extern const pb_field_t google_firestore_v1_Target_DocumentsTarget_fields[2];
|
||||
extern const pb_field_t google_firestore_v1_Target_QueryTarget_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_TargetChange_fields[6];
|
||||
extern const pb_field_t google_firestore_v1_ListCollectionIdsRequest_fields[4];
|
||||
extern const pb_field_t google_firestore_v1_ListCollectionIdsResponse_fields[3];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* google_firestore_v1_GetDocumentRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_ListDocumentsRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_ListDocumentsResponse_size depends on runtime parameters */
|
||||
/* google_firestore_v1_CreateDocumentRequest_size depends on runtime parameters */
|
||||
#define google_firestore_v1_UpdateDocumentRequest_size (44 + google_firestore_v1_Document_size + google_firestore_v1_DocumentMask_size + google_firestore_v1_DocumentMask_size)
|
||||
/* google_firestore_v1_DeleteDocumentRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_BatchGetDocumentsRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_BatchGetDocumentsResponse_size depends on runtime parameters */
|
||||
/* google_firestore_v1_BeginTransactionRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_BeginTransactionResponse_size depends on runtime parameters */
|
||||
/* google_firestore_v1_CommitRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_CommitResponse_size depends on runtime parameters */
|
||||
/* google_firestore_v1_RollbackRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_RunQueryRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_RunQueryResponse_size depends on runtime parameters */
|
||||
/* google_firestore_v1_WriteRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_WriteRequest_LabelsEntry_size depends on runtime parameters */
|
||||
/* google_firestore_v1_WriteResponse_size depends on runtime parameters */
|
||||
/* google_firestore_v1_ListenRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_ListenRequest_LabelsEntry_size depends on runtime parameters */
|
||||
/* google_firestore_v1_ListenResponse_size depends on runtime parameters */
|
||||
/* google_firestore_v1_Target_size depends on runtime parameters */
|
||||
/* google_firestore_v1_Target_DocumentsTarget_size depends on runtime parameters */
|
||||
/* google_firestore_v1_Target_QueryTarget_size depends on runtime parameters */
|
||||
/* google_firestore_v1_TargetChange_size depends on runtime parameters */
|
||||
/* google_firestore_v1_ListCollectionIdsRequest_size depends on runtime parameters */
|
||||
/* google_firestore_v1_ListCollectionIdsResponse_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define FIRESTORE_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_TargetChange_TargetChangeType value);
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+390
@@ -0,0 +1,390 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "query.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_firestore_v1_StructuredQuery_fields[9] = {
|
||||
PB_FIELD( 1, MESSAGE , SINGULAR, STATIC , FIRST, google_firestore_v1_StructuredQuery, select, select, &google_firestore_v1_StructuredQuery_Projection_fields),
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_StructuredQuery, from, select, &google_firestore_v1_StructuredQuery_CollectionSelector_fields),
|
||||
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_StructuredQuery, where, from, &google_firestore_v1_StructuredQuery_Filter_fields),
|
||||
PB_FIELD( 4, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_StructuredQuery, order_by, where, &google_firestore_v1_StructuredQuery_Order_fields),
|
||||
PB_FIELD( 5, MESSAGE , OPTIONAL, STATIC , OTHER, google_firestore_v1_StructuredQuery, limit, order_by, &google_protobuf_Int32Value_fields),
|
||||
PB_FIELD( 6, INT32 , SINGULAR, STATIC , OTHER, google_firestore_v1_StructuredQuery, offset, limit, 0),
|
||||
PB_FIELD( 7, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_StructuredQuery, start_at, offset, &google_firestore_v1_Cursor_fields),
|
||||
PB_FIELD( 8, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_StructuredQuery, end_at, start_at, &google_firestore_v1_Cursor_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_StructuredQuery_CollectionSelector_fields[3] = {
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_StructuredQuery_CollectionSelector, collection_id, collection_id, 0),
|
||||
PB_FIELD( 3, BOOL , SINGULAR, STATIC , OTHER, google_firestore_v1_StructuredQuery_CollectionSelector, all_descendants, collection_id, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_StructuredQuery_Filter_fields[4] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(filter_type, 1, MESSAGE , ONEOF, STATIC , FIRST, google_firestore_v1_StructuredQuery_Filter, composite_filter, composite_filter, &google_firestore_v1_StructuredQuery_CompositeFilter_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(filter_type, 2, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_StructuredQuery_Filter, field_filter, field_filter, &google_firestore_v1_StructuredQuery_FieldFilter_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(filter_type, 3, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_StructuredQuery_Filter, unary_filter, unary_filter, &google_firestore_v1_StructuredQuery_UnaryFilter_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_StructuredQuery_CompositeFilter_fields[3] = {
|
||||
PB_FIELD( 1, UENUM , SINGULAR, STATIC , FIRST, google_firestore_v1_StructuredQuery_CompositeFilter, op, op, 0),
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_StructuredQuery_CompositeFilter, filters, op, &google_firestore_v1_StructuredQuery_Filter_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_StructuredQuery_FieldFilter_fields[4] = {
|
||||
PB_FIELD( 1, MESSAGE , SINGULAR, STATIC , FIRST, google_firestore_v1_StructuredQuery_FieldFilter, field, field, &google_firestore_v1_StructuredQuery_FieldReference_fields),
|
||||
PB_FIELD( 2, UENUM , SINGULAR, STATIC , OTHER, google_firestore_v1_StructuredQuery_FieldFilter, op, field, 0),
|
||||
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_StructuredQuery_FieldFilter, value, op, &google_firestore_v1_Value_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_StructuredQuery_UnaryFilter_fields[3] = {
|
||||
PB_FIELD( 1, UENUM , SINGULAR, STATIC , FIRST, google_firestore_v1_StructuredQuery_UnaryFilter, op, op, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(operand_type, 2, MESSAGE , ONEOF, STATIC , OTHER, google_firestore_v1_StructuredQuery_UnaryFilter, field, op, &google_firestore_v1_StructuredQuery_FieldReference_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_StructuredQuery_Order_fields[3] = {
|
||||
PB_FIELD( 1, MESSAGE , SINGULAR, STATIC , FIRST, google_firestore_v1_StructuredQuery_Order, field, field, &google_firestore_v1_StructuredQuery_FieldReference_fields),
|
||||
PB_FIELD( 2, UENUM , SINGULAR, STATIC , OTHER, google_firestore_v1_StructuredQuery_Order, direction, field, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_StructuredQuery_FieldReference_fields[2] = {
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_StructuredQuery_FieldReference, field_path, field_path, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_StructuredQuery_Projection_fields[2] = {
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, POINTER , FIRST, google_firestore_v1_StructuredQuery_Projection, fields, fields, &google_firestore_v1_StructuredQuery_FieldReference_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_Cursor_fields[3] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_firestore_v1_Cursor, values, values, &google_firestore_v1_Value_fields),
|
||||
PB_FIELD( 2, BOOL , SINGULAR, STATIC , OTHER, google_firestore_v1_Cursor, before, values, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_StructuredQuery, select) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery, where) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery, start_at) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery, end_at) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery, limit) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery_Filter, composite_filter) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery_Filter, field_filter) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery_Filter, unary_filter) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery_FieldFilter, field) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery_FieldFilter, value) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery_UnaryFilter, field) < 65536 && pb_membersize(google_firestore_v1_StructuredQuery_Order, field) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_firestore_v1_StructuredQuery_google_firestore_v1_StructuredQuery_CollectionSelector_google_firestore_v1_StructuredQuery_Filter_google_firestore_v1_StructuredQuery_CompositeFilter_google_firestore_v1_StructuredQuery_FieldFilter_google_firestore_v1_StructuredQuery_UnaryFilter_google_firestore_v1_StructuredQuery_Order_google_firestore_v1_StructuredQuery_FieldReference_google_firestore_v1_StructuredQuery_Projection_google_firestore_v1_Cursor)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_StructuredQuery, select) < 256 && pb_membersize(google_firestore_v1_StructuredQuery, where) < 256 && pb_membersize(google_firestore_v1_StructuredQuery, start_at) < 256 && pb_membersize(google_firestore_v1_StructuredQuery, end_at) < 256 && pb_membersize(google_firestore_v1_StructuredQuery, limit) < 256 && pb_membersize(google_firestore_v1_StructuredQuery_Filter, composite_filter) < 256 && pb_membersize(google_firestore_v1_StructuredQuery_Filter, field_filter) < 256 && pb_membersize(google_firestore_v1_StructuredQuery_Filter, unary_filter) < 256 && pb_membersize(google_firestore_v1_StructuredQuery_FieldFilter, field) < 256 && pb_membersize(google_firestore_v1_StructuredQuery_FieldFilter, value) < 256 && pb_membersize(google_firestore_v1_StructuredQuery_UnaryFilter, field) < 256 && pb_membersize(google_firestore_v1_StructuredQuery_Order, field) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_firestore_v1_StructuredQuery_google_firestore_v1_StructuredQuery_CollectionSelector_google_firestore_v1_StructuredQuery_Filter_google_firestore_v1_StructuredQuery_CompositeFilter_google_firestore_v1_StructuredQuery_FieldFilter_google_firestore_v1_StructuredQuery_UnaryFilter_google_firestore_v1_StructuredQuery_Order_google_firestore_v1_StructuredQuery_FieldReference_google_firestore_v1_StructuredQuery_Projection_google_firestore_v1_Cursor)
|
||||
#endif
|
||||
|
||||
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_StructuredQuery_Direction value) {
|
||||
switch (value) {
|
||||
case google_firestore_v1_StructuredQuery_Direction_DIRECTION_UNSPECIFIED:
|
||||
return "DIRECTION_UNSPECIFIED";
|
||||
case google_firestore_v1_StructuredQuery_Direction_ASCENDING:
|
||||
return "ASCENDING";
|
||||
case google_firestore_v1_StructuredQuery_Direction_DESCENDING:
|
||||
return "DESCENDING";
|
||||
}
|
||||
return "<unknown enum value>";
|
||||
}
|
||||
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_StructuredQuery_CompositeFilter_Operator value) {
|
||||
switch (value) {
|
||||
case google_firestore_v1_StructuredQuery_CompositeFilter_Operator_OPERATOR_UNSPECIFIED:
|
||||
return "OPERATOR_UNSPECIFIED";
|
||||
case google_firestore_v1_StructuredQuery_CompositeFilter_Operator_AND:
|
||||
return "AND";
|
||||
}
|
||||
return "<unknown enum value>";
|
||||
}
|
||||
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator value) {
|
||||
switch (value) {
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_OPERATOR_UNSPECIFIED:
|
||||
return "OPERATOR_UNSPECIFIED";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_LESS_THAN:
|
||||
return "LESS_THAN";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_LESS_THAN_OR_EQUAL:
|
||||
return "LESS_THAN_OR_EQUAL";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_GREATER_THAN:
|
||||
return "GREATER_THAN";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_GREATER_THAN_OR_EQUAL:
|
||||
return "GREATER_THAN_OR_EQUAL";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_EQUAL:
|
||||
return "EQUAL";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_NOT_EQUAL:
|
||||
return "NOT_EQUAL";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_ARRAY_CONTAINS:
|
||||
return "ARRAY_CONTAINS";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_IN:
|
||||
return "IN";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_ARRAY_CONTAINS_ANY:
|
||||
return "ARRAY_CONTAINS_ANY";
|
||||
case google_firestore_v1_StructuredQuery_FieldFilter_Operator_NOT_IN:
|
||||
return "NOT_IN";
|
||||
}
|
||||
return "<unknown enum value>";
|
||||
}
|
||||
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_StructuredQuery_UnaryFilter_Operator value) {
|
||||
switch (value) {
|
||||
case google_firestore_v1_StructuredQuery_UnaryFilter_Operator_OPERATOR_UNSPECIFIED:
|
||||
return "OPERATOR_UNSPECIFIED";
|
||||
case google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NAN:
|
||||
return "IS_NAN";
|
||||
case google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NULL:
|
||||
return "IS_NULL";
|
||||
case google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NOT_NAN:
|
||||
return "IS_NOT_NAN";
|
||||
case google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NOT_NULL:
|
||||
return "IS_NOT_NULL";
|
||||
}
|
||||
return "<unknown enum value>";
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_StructuredQuery::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "StructuredQuery", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintMessageField("select ", select, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != from_count; ++i) {
|
||||
result += PrintMessageField("from ", from[i], indent + 1, true);
|
||||
}
|
||||
result += PrintMessageField("where ", where, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != order_by_count; ++i) {
|
||||
result += PrintMessageField("order_by ",
|
||||
order_by[i], indent + 1, true);
|
||||
}
|
||||
if (has_limit) {
|
||||
result += PrintMessageField("limit ", limit, indent + 1, true);
|
||||
}
|
||||
result += PrintPrimitiveField("offset: ", offset, indent + 1, false);
|
||||
result += PrintMessageField("start_at ", start_at, indent + 1, false);
|
||||
result += PrintMessageField("end_at ", end_at, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_StructuredQuery_CollectionSelector::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "CollectionSelector", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("collection_id: ",
|
||||
collection_id, indent + 1, false);
|
||||
result += PrintPrimitiveField("all_descendants: ",
|
||||
all_descendants, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_StructuredQuery_Filter::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Filter", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_filter_type) {
|
||||
case google_firestore_v1_StructuredQuery_Filter_composite_filter_tag:
|
||||
result += PrintMessageField("composite_filter ",
|
||||
composite_filter, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_StructuredQuery_Filter_field_filter_tag:
|
||||
result += PrintMessageField("field_filter ",
|
||||
field_filter, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_StructuredQuery_Filter_unary_filter_tag:
|
||||
result += PrintMessageField("unary_filter ",
|
||||
unary_filter, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_StructuredQuery_CompositeFilter::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "CompositeFilter", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintEnumField("op: ", op, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != filters_count; ++i) {
|
||||
result += PrintMessageField("filters ", filters[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_StructuredQuery_FieldFilter::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "FieldFilter", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintMessageField("field ", field, indent + 1, false);
|
||||
result += PrintEnumField("op: ", op, indent + 1, false);
|
||||
result += PrintMessageField("value ", value, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_StructuredQuery_UnaryFilter::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "UnaryFilter", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintEnumField("op: ", op, indent + 1, false);
|
||||
switch (which_operand_type) {
|
||||
case google_firestore_v1_StructuredQuery_UnaryFilter_field_tag:
|
||||
result += PrintMessageField("field ", field, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_StructuredQuery_Order::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Order", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintMessageField("field ", field, indent + 1, false);
|
||||
result += PrintEnumField("direction: ", direction, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_StructuredQuery_FieldReference::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "FieldReference", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("field_path: ",
|
||||
field_path, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_StructuredQuery_Projection::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Projection", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != fields_count; ++i) {
|
||||
result += PrintMessageField("fields ", fields[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_Cursor::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Cursor", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != values_count; ++i) {
|
||||
result += PrintMessageField("values ", values[i], indent + 1, true);
|
||||
}
|
||||
result += PrintPrimitiveField("before: ", before, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+282
@@ -0,0 +1,282 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_FIRESTORE_V1_QUERY_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_FIRESTORE_V1_QUERY_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/api/annotations.nanopb.h"
|
||||
|
||||
#include "google/firestore/v1/document.nanopb.h"
|
||||
|
||||
#include "google/protobuf/wrappers.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Enum definitions */
|
||||
typedef enum _google_firestore_v1_StructuredQuery_Direction {
|
||||
google_firestore_v1_StructuredQuery_Direction_DIRECTION_UNSPECIFIED = 0,
|
||||
google_firestore_v1_StructuredQuery_Direction_ASCENDING = 1,
|
||||
google_firestore_v1_StructuredQuery_Direction_DESCENDING = 2
|
||||
} google_firestore_v1_StructuredQuery_Direction;
|
||||
#define _google_firestore_v1_StructuredQuery_Direction_MIN google_firestore_v1_StructuredQuery_Direction_DIRECTION_UNSPECIFIED
|
||||
#define _google_firestore_v1_StructuredQuery_Direction_MAX google_firestore_v1_StructuredQuery_Direction_DESCENDING
|
||||
#define _google_firestore_v1_StructuredQuery_Direction_ARRAYSIZE ((google_firestore_v1_StructuredQuery_Direction)(google_firestore_v1_StructuredQuery_Direction_DESCENDING+1))
|
||||
|
||||
typedef enum _google_firestore_v1_StructuredQuery_CompositeFilter_Operator {
|
||||
google_firestore_v1_StructuredQuery_CompositeFilter_Operator_OPERATOR_UNSPECIFIED = 0,
|
||||
google_firestore_v1_StructuredQuery_CompositeFilter_Operator_AND = 1
|
||||
} google_firestore_v1_StructuredQuery_CompositeFilter_Operator;
|
||||
#define _google_firestore_v1_StructuredQuery_CompositeFilter_Operator_MIN google_firestore_v1_StructuredQuery_CompositeFilter_Operator_OPERATOR_UNSPECIFIED
|
||||
#define _google_firestore_v1_StructuredQuery_CompositeFilter_Operator_MAX google_firestore_v1_StructuredQuery_CompositeFilter_Operator_AND
|
||||
#define _google_firestore_v1_StructuredQuery_CompositeFilter_Operator_ARRAYSIZE ((google_firestore_v1_StructuredQuery_CompositeFilter_Operator)(google_firestore_v1_StructuredQuery_CompositeFilter_Operator_AND+1))
|
||||
|
||||
typedef enum _google_firestore_v1_StructuredQuery_FieldFilter_Operator {
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_OPERATOR_UNSPECIFIED = 0,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_LESS_THAN = 1,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_LESS_THAN_OR_EQUAL = 2,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_GREATER_THAN = 3,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_GREATER_THAN_OR_EQUAL = 4,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_EQUAL = 5,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_NOT_EQUAL = 6,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_ARRAY_CONTAINS = 7,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_IN = 8,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_ARRAY_CONTAINS_ANY = 9,
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator_NOT_IN = 10
|
||||
} google_firestore_v1_StructuredQuery_FieldFilter_Operator;
|
||||
#define _google_firestore_v1_StructuredQuery_FieldFilter_Operator_MIN google_firestore_v1_StructuredQuery_FieldFilter_Operator_OPERATOR_UNSPECIFIED
|
||||
#define _google_firestore_v1_StructuredQuery_FieldFilter_Operator_MAX google_firestore_v1_StructuredQuery_FieldFilter_Operator_NOT_IN
|
||||
#define _google_firestore_v1_StructuredQuery_FieldFilter_Operator_ARRAYSIZE ((google_firestore_v1_StructuredQuery_FieldFilter_Operator)(google_firestore_v1_StructuredQuery_FieldFilter_Operator_NOT_IN+1))
|
||||
|
||||
typedef enum _google_firestore_v1_StructuredQuery_UnaryFilter_Operator {
|
||||
google_firestore_v1_StructuredQuery_UnaryFilter_Operator_OPERATOR_UNSPECIFIED = 0,
|
||||
google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NAN = 2,
|
||||
google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NULL = 3,
|
||||
google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NOT_NAN = 4,
|
||||
google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NOT_NULL = 5
|
||||
} google_firestore_v1_StructuredQuery_UnaryFilter_Operator;
|
||||
#define _google_firestore_v1_StructuredQuery_UnaryFilter_Operator_MIN google_firestore_v1_StructuredQuery_UnaryFilter_Operator_OPERATOR_UNSPECIFIED
|
||||
#define _google_firestore_v1_StructuredQuery_UnaryFilter_Operator_MAX google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NOT_NULL
|
||||
#define _google_firestore_v1_StructuredQuery_UnaryFilter_Operator_ARRAYSIZE ((google_firestore_v1_StructuredQuery_UnaryFilter_Operator)(google_firestore_v1_StructuredQuery_UnaryFilter_Operator_IS_NOT_NULL+1))
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_firestore_v1_StructuredQuery_FieldReference {
|
||||
pb_bytes_array_t *field_path;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_FieldReference) */
|
||||
} google_firestore_v1_StructuredQuery_FieldReference;
|
||||
|
||||
typedef struct _google_firestore_v1_StructuredQuery_Projection {
|
||||
pb_size_t fields_count;
|
||||
struct _google_firestore_v1_StructuredQuery_FieldReference *fields;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_Projection) */
|
||||
} google_firestore_v1_StructuredQuery_Projection;
|
||||
|
||||
typedef struct _google_firestore_v1_Cursor {
|
||||
pb_size_t values_count;
|
||||
struct _google_firestore_v1_Value *values;
|
||||
bool before;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_Cursor) */
|
||||
} google_firestore_v1_Cursor;
|
||||
|
||||
typedef struct _google_firestore_v1_StructuredQuery_CollectionSelector {
|
||||
pb_bytes_array_t *collection_id;
|
||||
bool all_descendants;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_CollectionSelector) */
|
||||
} google_firestore_v1_StructuredQuery_CollectionSelector;
|
||||
|
||||
typedef struct _google_firestore_v1_StructuredQuery_CompositeFilter {
|
||||
google_firestore_v1_StructuredQuery_CompositeFilter_Operator op;
|
||||
pb_size_t filters_count;
|
||||
struct _google_firestore_v1_StructuredQuery_Filter *filters;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_CompositeFilter) */
|
||||
} google_firestore_v1_StructuredQuery_CompositeFilter;
|
||||
|
||||
typedef struct _google_firestore_v1_StructuredQuery_FieldFilter {
|
||||
google_firestore_v1_StructuredQuery_FieldReference field;
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator op;
|
||||
google_firestore_v1_Value value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_FieldFilter) */
|
||||
} google_firestore_v1_StructuredQuery_FieldFilter;
|
||||
|
||||
typedef struct _google_firestore_v1_StructuredQuery_Order {
|
||||
google_firestore_v1_StructuredQuery_FieldReference field;
|
||||
google_firestore_v1_StructuredQuery_Direction direction;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_Order) */
|
||||
} google_firestore_v1_StructuredQuery_Order;
|
||||
|
||||
typedef struct _google_firestore_v1_StructuredQuery_UnaryFilter {
|
||||
google_firestore_v1_StructuredQuery_UnaryFilter_Operator op;
|
||||
pb_size_t which_operand_type;
|
||||
union {
|
||||
google_firestore_v1_StructuredQuery_FieldReference field;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_UnaryFilter) */
|
||||
} google_firestore_v1_StructuredQuery_UnaryFilter;
|
||||
|
||||
typedef struct _google_firestore_v1_StructuredQuery_Filter {
|
||||
pb_size_t which_filter_type;
|
||||
union {
|
||||
google_firestore_v1_StructuredQuery_CompositeFilter composite_filter;
|
||||
google_firestore_v1_StructuredQuery_FieldFilter field_filter;
|
||||
google_firestore_v1_StructuredQuery_UnaryFilter unary_filter;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery_Filter) */
|
||||
} google_firestore_v1_StructuredQuery_Filter;
|
||||
|
||||
typedef struct _google_firestore_v1_StructuredQuery {
|
||||
google_firestore_v1_StructuredQuery_Projection select;
|
||||
pb_size_t from_count;
|
||||
struct _google_firestore_v1_StructuredQuery_CollectionSelector *from;
|
||||
google_firestore_v1_StructuredQuery_Filter where;
|
||||
pb_size_t order_by_count;
|
||||
struct _google_firestore_v1_StructuredQuery_Order *order_by;
|
||||
bool has_limit;
|
||||
google_protobuf_Int32Value limit;
|
||||
int32_t offset;
|
||||
google_firestore_v1_Cursor start_at;
|
||||
google_firestore_v1_Cursor end_at;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_StructuredQuery) */
|
||||
} google_firestore_v1_StructuredQuery;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_firestore_v1_StructuredQuery_init_default {google_firestore_v1_StructuredQuery_Projection_init_default, 0, NULL, google_firestore_v1_StructuredQuery_Filter_init_default, 0, NULL, false, google_protobuf_Int32Value_init_default, 0, google_firestore_v1_Cursor_init_default, google_firestore_v1_Cursor_init_default}
|
||||
#define google_firestore_v1_StructuredQuery_CollectionSelector_init_default {NULL, 0}
|
||||
#define google_firestore_v1_StructuredQuery_Filter_init_default {0, {google_firestore_v1_StructuredQuery_CompositeFilter_init_default}}
|
||||
#define google_firestore_v1_StructuredQuery_CompositeFilter_init_default {_google_firestore_v1_StructuredQuery_CompositeFilter_Operator_MIN, 0, NULL}
|
||||
#define google_firestore_v1_StructuredQuery_FieldFilter_init_default {google_firestore_v1_StructuredQuery_FieldReference_init_default, _google_firestore_v1_StructuredQuery_FieldFilter_Operator_MIN, google_firestore_v1_Value_init_default}
|
||||
#define google_firestore_v1_StructuredQuery_UnaryFilter_init_default {_google_firestore_v1_StructuredQuery_UnaryFilter_Operator_MIN, 0, {google_firestore_v1_StructuredQuery_FieldReference_init_default}}
|
||||
#define google_firestore_v1_StructuredQuery_Order_init_default {google_firestore_v1_StructuredQuery_FieldReference_init_default, _google_firestore_v1_StructuredQuery_Direction_MIN}
|
||||
#define google_firestore_v1_StructuredQuery_FieldReference_init_default {NULL}
|
||||
#define google_firestore_v1_StructuredQuery_Projection_init_default {0, NULL}
|
||||
#define google_firestore_v1_Cursor_init_default {0, NULL, 0}
|
||||
#define google_firestore_v1_StructuredQuery_init_zero {google_firestore_v1_StructuredQuery_Projection_init_zero, 0, NULL, google_firestore_v1_StructuredQuery_Filter_init_zero, 0, NULL, false, google_protobuf_Int32Value_init_zero, 0, google_firestore_v1_Cursor_init_zero, google_firestore_v1_Cursor_init_zero}
|
||||
#define google_firestore_v1_StructuredQuery_CollectionSelector_init_zero {NULL, 0}
|
||||
#define google_firestore_v1_StructuredQuery_Filter_init_zero {0, {google_firestore_v1_StructuredQuery_CompositeFilter_init_zero}}
|
||||
#define google_firestore_v1_StructuredQuery_CompositeFilter_init_zero {_google_firestore_v1_StructuredQuery_CompositeFilter_Operator_MIN, 0, NULL}
|
||||
#define google_firestore_v1_StructuredQuery_FieldFilter_init_zero {google_firestore_v1_StructuredQuery_FieldReference_init_zero, _google_firestore_v1_StructuredQuery_FieldFilter_Operator_MIN, google_firestore_v1_Value_init_zero}
|
||||
#define google_firestore_v1_StructuredQuery_UnaryFilter_init_zero {_google_firestore_v1_StructuredQuery_UnaryFilter_Operator_MIN, 0, {google_firestore_v1_StructuredQuery_FieldReference_init_zero}}
|
||||
#define google_firestore_v1_StructuredQuery_Order_init_zero {google_firestore_v1_StructuredQuery_FieldReference_init_zero, _google_firestore_v1_StructuredQuery_Direction_MIN}
|
||||
#define google_firestore_v1_StructuredQuery_FieldReference_init_zero {NULL}
|
||||
#define google_firestore_v1_StructuredQuery_Projection_init_zero {0, NULL}
|
||||
#define google_firestore_v1_Cursor_init_zero {0, NULL, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_firestore_v1_StructuredQuery_FieldReference_field_path_tag 2
|
||||
#define google_firestore_v1_StructuredQuery_Projection_fields_tag 2
|
||||
#define google_firestore_v1_Cursor_values_tag 1
|
||||
#define google_firestore_v1_Cursor_before_tag 2
|
||||
#define google_firestore_v1_StructuredQuery_CollectionSelector_collection_id_tag 2
|
||||
#define google_firestore_v1_StructuredQuery_CollectionSelector_all_descendants_tag 3
|
||||
#define google_firestore_v1_StructuredQuery_CompositeFilter_op_tag 1
|
||||
#define google_firestore_v1_StructuredQuery_CompositeFilter_filters_tag 2
|
||||
#define google_firestore_v1_StructuredQuery_FieldFilter_field_tag 1
|
||||
#define google_firestore_v1_StructuredQuery_FieldFilter_op_tag 2
|
||||
#define google_firestore_v1_StructuredQuery_FieldFilter_value_tag 3
|
||||
#define google_firestore_v1_StructuredQuery_Order_field_tag 1
|
||||
#define google_firestore_v1_StructuredQuery_Order_direction_tag 2
|
||||
#define google_firestore_v1_StructuredQuery_UnaryFilter_field_tag 2
|
||||
#define google_firestore_v1_StructuredQuery_UnaryFilter_op_tag 1
|
||||
#define google_firestore_v1_StructuredQuery_Filter_composite_filter_tag 1
|
||||
#define google_firestore_v1_StructuredQuery_Filter_field_filter_tag 2
|
||||
#define google_firestore_v1_StructuredQuery_Filter_unary_filter_tag 3
|
||||
#define google_firestore_v1_StructuredQuery_select_tag 1
|
||||
#define google_firestore_v1_StructuredQuery_from_tag 2
|
||||
#define google_firestore_v1_StructuredQuery_where_tag 3
|
||||
#define google_firestore_v1_StructuredQuery_order_by_tag 4
|
||||
#define google_firestore_v1_StructuredQuery_start_at_tag 7
|
||||
#define google_firestore_v1_StructuredQuery_end_at_tag 8
|
||||
#define google_firestore_v1_StructuredQuery_offset_tag 6
|
||||
#define google_firestore_v1_StructuredQuery_limit_tag 5
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_firestore_v1_StructuredQuery_fields[9];
|
||||
extern const pb_field_t google_firestore_v1_StructuredQuery_CollectionSelector_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_StructuredQuery_Filter_fields[4];
|
||||
extern const pb_field_t google_firestore_v1_StructuredQuery_CompositeFilter_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_StructuredQuery_FieldFilter_fields[4];
|
||||
extern const pb_field_t google_firestore_v1_StructuredQuery_UnaryFilter_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_StructuredQuery_Order_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_StructuredQuery_FieldReference_fields[2];
|
||||
extern const pb_field_t google_firestore_v1_StructuredQuery_Projection_fields[2];
|
||||
extern const pb_field_t google_firestore_v1_Cursor_fields[3];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* google_firestore_v1_StructuredQuery_size depends on runtime parameters */
|
||||
/* google_firestore_v1_StructuredQuery_CollectionSelector_size depends on runtime parameters */
|
||||
/* google_firestore_v1_StructuredQuery_Filter_size depends on runtime parameters */
|
||||
/* google_firestore_v1_StructuredQuery_CompositeFilter_size depends on runtime parameters */
|
||||
/* google_firestore_v1_StructuredQuery_FieldFilter_size depends on runtime parameters */
|
||||
/* google_firestore_v1_StructuredQuery_UnaryFilter_size depends on runtime parameters */
|
||||
/* google_firestore_v1_StructuredQuery_Order_size depends on runtime parameters */
|
||||
/* google_firestore_v1_StructuredQuery_FieldReference_size depends on runtime parameters */
|
||||
/* google_firestore_v1_StructuredQuery_Projection_size depends on runtime parameters */
|
||||
/* google_firestore_v1_Cursor_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define QUERY_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
const char* EnumToString(google_firestore_v1_StructuredQuery_Direction value);
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_StructuredQuery_CompositeFilter_Operator value);
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_StructuredQuery_FieldFilter_Operator value);
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_StructuredQuery_UnaryFilter_Operator value);
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+317
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "write.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_firestore_v1_Write_fields[8] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(operation, 1, MESSAGE , ONEOF, STATIC , FIRST, google_firestore_v1_Write, update, update, &google_firestore_v1_Document_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(operation, 2, BYTES , ONEOF, POINTER , UNION, google_firestore_v1_Write, delete_, delete_, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(operation, 5, BYTES , ONEOF, POINTER , UNION, google_firestore_v1_Write, verify, verify, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(operation, 6, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Write, transform, transform, &google_firestore_v1_DocumentTransform_fields),
|
||||
PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, google_firestore_v1_Write, update_mask, transform, &google_firestore_v1_DocumentMask_fields),
|
||||
PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, google_firestore_v1_Write, current_document, update_mask, &google_firestore_v1_Precondition_fields),
|
||||
PB_FIELD( 7, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_Write, update_transforms, current_document, &google_firestore_v1_DocumentTransform_FieldTransform_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_DocumentTransform_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_DocumentTransform, document, document, 0),
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_DocumentTransform, field_transforms, document, &google_firestore_v1_DocumentTransform_FieldTransform_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_DocumentTransform_FieldTransform_fields[8] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_DocumentTransform_FieldTransform, field_path, field_path, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(transform_type, 2, UENUM , ONEOF, STATIC , OTHER, google_firestore_v1_DocumentTransform_FieldTransform, set_to_server_value, field_path, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(transform_type, 3, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_DocumentTransform_FieldTransform, increment, field_path, &google_firestore_v1_Value_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(transform_type, 4, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_DocumentTransform_FieldTransform, maximum, field_path, &google_firestore_v1_Value_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(transform_type, 5, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_DocumentTransform_FieldTransform, minimum, field_path, &google_firestore_v1_Value_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(transform_type, 6, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_DocumentTransform_FieldTransform, append_missing_elements, field_path, &google_firestore_v1_ArrayValue_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(transform_type, 7, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_DocumentTransform_FieldTransform, remove_all_from_array, field_path, &google_firestore_v1_ArrayValue_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_WriteResult_fields[3] = {
|
||||
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, google_firestore_v1_WriteResult, update_time, update_time, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_WriteResult, transform_results, update_time, &google_firestore_v1_Value_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_DocumentChange_fields[4] = {
|
||||
PB_FIELD( 1, MESSAGE , SINGULAR, STATIC , FIRST, google_firestore_v1_DocumentChange, document, document, &google_firestore_v1_Document_fields),
|
||||
PB_FIELD( 5, INT32 , REPEATED, POINTER , OTHER, google_firestore_v1_DocumentChange, target_ids, document, 0),
|
||||
PB_FIELD( 6, INT32 , REPEATED, POINTER , OTHER, google_firestore_v1_DocumentChange, removed_target_ids, target_ids, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_DocumentDelete_fields[4] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_DocumentDelete, document, document, 0),
|
||||
PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, google_firestore_v1_DocumentDelete, read_time, document, &google_protobuf_Timestamp_fields),
|
||||
PB_FIELD( 6, INT32 , REPEATED, POINTER , OTHER, google_firestore_v1_DocumentDelete, removed_target_ids, read_time, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_DocumentRemove_fields[4] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_DocumentRemove, document, document, 0),
|
||||
PB_FIELD( 2, INT32 , REPEATED, POINTER , OTHER, google_firestore_v1_DocumentRemove, removed_target_ids, document, 0),
|
||||
PB_FIELD( 4, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_DocumentRemove, read_time, removed_target_ids, &google_protobuf_Timestamp_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_firestore_v1_ExistenceFilter_fields[3] = {
|
||||
PB_FIELD( 1, INT32 , SINGULAR, STATIC , FIRST, google_firestore_v1_ExistenceFilter, target_id, target_id, 0),
|
||||
PB_FIELD( 2, INT32 , SINGULAR, STATIC , OTHER, google_firestore_v1_ExistenceFilter, count, target_id, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Write, update) < 65536 && pb_membersize(google_firestore_v1_Write, transform) < 65536 && pb_membersize(google_firestore_v1_Write, update_mask) < 65536 && pb_membersize(google_firestore_v1_Write, current_document) < 65536 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, increment) < 65536 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, maximum) < 65536 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, minimum) < 65536 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, append_missing_elements) < 65536 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, remove_all_from_array) < 65536 && pb_membersize(google_firestore_v1_WriteResult, update_time) < 65536 && pb_membersize(google_firestore_v1_DocumentChange, document) < 65536 && pb_membersize(google_firestore_v1_DocumentDelete, read_time) < 65536 && pb_membersize(google_firestore_v1_DocumentRemove, read_time) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_firestore_v1_Write_google_firestore_v1_DocumentTransform_google_firestore_v1_DocumentTransform_FieldTransform_google_firestore_v1_WriteResult_google_firestore_v1_DocumentChange_google_firestore_v1_DocumentDelete_google_firestore_v1_DocumentRemove_google_firestore_v1_ExistenceFilter)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Write, update) < 256 && pb_membersize(google_firestore_v1_Write, transform) < 256 && pb_membersize(google_firestore_v1_Write, update_mask) < 256 && pb_membersize(google_firestore_v1_Write, current_document) < 256 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, increment) < 256 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, maximum) < 256 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, minimum) < 256 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, append_missing_elements) < 256 && pb_membersize(google_firestore_v1_DocumentTransform_FieldTransform, remove_all_from_array) < 256 && pb_membersize(google_firestore_v1_WriteResult, update_time) < 256 && pb_membersize(google_firestore_v1_DocumentChange, document) < 256 && pb_membersize(google_firestore_v1_DocumentDelete, read_time) < 256 && pb_membersize(google_firestore_v1_DocumentRemove, read_time) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_firestore_v1_Write_google_firestore_v1_DocumentTransform_google_firestore_v1_DocumentTransform_FieldTransform_google_firestore_v1_WriteResult_google_firestore_v1_DocumentChange_google_firestore_v1_DocumentDelete_google_firestore_v1_DocumentRemove_google_firestore_v1_ExistenceFilter)
|
||||
#endif
|
||||
|
||||
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_DocumentTransform_FieldTransform_ServerValue value) {
|
||||
switch (value) {
|
||||
case google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_SERVER_VALUE_UNSPECIFIED:
|
||||
return "SERVER_VALUE_UNSPECIFIED";
|
||||
case google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_REQUEST_TIME:
|
||||
return "REQUEST_TIME";
|
||||
}
|
||||
return "<unknown enum value>";
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_Write::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Write", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_operation) {
|
||||
case google_firestore_v1_Write_update_tag:
|
||||
result += PrintMessageField("update ", update, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Write_delete_tag:
|
||||
result += PrintPrimitiveField("delete: ", delete_, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Write_verify_tag:
|
||||
result += PrintPrimitiveField("verify: ", verify, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_Write_transform_tag:
|
||||
result += PrintMessageField("transform ", transform, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
if (has_update_mask) {
|
||||
result += PrintMessageField("update_mask ",
|
||||
update_mask, indent + 1, true);
|
||||
}
|
||||
if (has_current_document) {
|
||||
result += PrintMessageField("current_document ",
|
||||
current_document, indent + 1, true);
|
||||
}
|
||||
for (pb_size_t i = 0; i != update_transforms_count; ++i) {
|
||||
result += PrintMessageField("update_transforms ",
|
||||
update_transforms[i], indent + 1, true);
|
||||
}
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_DocumentTransform::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "DocumentTransform", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("document: ", document, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != field_transforms_count; ++i) {
|
||||
result += PrintMessageField("field_transforms ",
|
||||
field_transforms[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_DocumentTransform_FieldTransform::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "FieldTransform", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("field_path: ",
|
||||
field_path, indent + 1, false);
|
||||
switch (which_transform_type) {
|
||||
case google_firestore_v1_DocumentTransform_FieldTransform_set_to_server_value_tag:
|
||||
result += PrintEnumField("set_to_server_value: ",
|
||||
set_to_server_value, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_DocumentTransform_FieldTransform_increment_tag:
|
||||
result += PrintMessageField("increment ", increment, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_DocumentTransform_FieldTransform_maximum_tag:
|
||||
result += PrintMessageField("maximum ", maximum, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_DocumentTransform_FieldTransform_minimum_tag:
|
||||
result += PrintMessageField("minimum ", minimum, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_DocumentTransform_FieldTransform_append_missing_elements_tag:
|
||||
result += PrintMessageField("append_missing_elements ",
|
||||
append_missing_elements, indent + 1, true);
|
||||
break;
|
||||
case google_firestore_v1_DocumentTransform_FieldTransform_remove_all_from_array_tag:
|
||||
result += PrintMessageField("remove_all_from_array ",
|
||||
remove_all_from_array, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_WriteResult::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "WriteResult", this);
|
||||
std::string result;
|
||||
|
||||
if (has_update_time) {
|
||||
result += PrintMessageField("update_time ",
|
||||
update_time, indent + 1, true);
|
||||
}
|
||||
for (pb_size_t i = 0; i != transform_results_count; ++i) {
|
||||
result += PrintMessageField("transform_results ",
|
||||
transform_results[i], indent + 1, true);
|
||||
}
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_DocumentChange::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "DocumentChange", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintMessageField("document ", document, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != target_ids_count; ++i) {
|
||||
result += PrintPrimitiveField("target_ids: ",
|
||||
target_ids[i], indent + 1, true);
|
||||
}
|
||||
for (pb_size_t i = 0; i != removed_target_ids_count; ++i) {
|
||||
result += PrintPrimitiveField("removed_target_ids: ",
|
||||
removed_target_ids[i], indent + 1, true);
|
||||
}
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_DocumentDelete::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "DocumentDelete", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("document: ", document, indent + 1, false);
|
||||
if (has_read_time) {
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, true);
|
||||
}
|
||||
for (pb_size_t i = 0; i != removed_target_ids_count; ++i) {
|
||||
result += PrintPrimitiveField("removed_target_ids: ",
|
||||
removed_target_ids[i], indent + 1, true);
|
||||
}
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_DocumentRemove::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "DocumentRemove", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("document: ", document, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != removed_target_ids_count; ++i) {
|
||||
result += PrintPrimitiveField("removed_target_ids: ",
|
||||
removed_target_ids[i], indent + 1, true);
|
||||
}
|
||||
result += PrintMessageField("read_time ", read_time, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_firestore_v1_ExistenceFilter::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ExistenceFilter", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("target_id: ", target_id, indent + 1, false);
|
||||
result += PrintPrimitiveField("count: ", count, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_FIRESTORE_V1_WRITE_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_FIRESTORE_V1_WRITE_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/api/annotations.nanopb.h"
|
||||
|
||||
#include "google/firestore/v1/common.nanopb.h"
|
||||
|
||||
#include "google/firestore/v1/document.nanopb.h"
|
||||
|
||||
#include "google/protobuf/timestamp.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Enum definitions */
|
||||
typedef enum _google_firestore_v1_DocumentTransform_FieldTransform_ServerValue {
|
||||
google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_SERVER_VALUE_UNSPECIFIED = 0,
|
||||
google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_REQUEST_TIME = 1
|
||||
} google_firestore_v1_DocumentTransform_FieldTransform_ServerValue;
|
||||
#define _google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_MIN google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_SERVER_VALUE_UNSPECIFIED
|
||||
#define _google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_MAX google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_REQUEST_TIME
|
||||
#define _google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_ARRAYSIZE ((google_firestore_v1_DocumentTransform_FieldTransform_ServerValue)(google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_REQUEST_TIME+1))
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_firestore_v1_DocumentTransform {
|
||||
pb_bytes_array_t *document;
|
||||
pb_size_t field_transforms_count;
|
||||
struct _google_firestore_v1_DocumentTransform_FieldTransform *field_transforms;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_DocumentTransform) */
|
||||
} google_firestore_v1_DocumentTransform;
|
||||
|
||||
typedef struct _google_firestore_v1_DocumentChange {
|
||||
google_firestore_v1_Document document;
|
||||
pb_size_t target_ids_count;
|
||||
int32_t *target_ids;
|
||||
pb_size_t removed_target_ids_count;
|
||||
int32_t *removed_target_ids;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_DocumentChange) */
|
||||
} google_firestore_v1_DocumentChange;
|
||||
|
||||
typedef struct _google_firestore_v1_DocumentDelete {
|
||||
pb_bytes_array_t *document;
|
||||
bool has_read_time;
|
||||
google_protobuf_Timestamp read_time;
|
||||
pb_size_t removed_target_ids_count;
|
||||
int32_t *removed_target_ids;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_DocumentDelete) */
|
||||
} google_firestore_v1_DocumentDelete;
|
||||
|
||||
typedef struct _google_firestore_v1_DocumentRemove {
|
||||
pb_bytes_array_t *document;
|
||||
pb_size_t removed_target_ids_count;
|
||||
int32_t *removed_target_ids;
|
||||
google_protobuf_Timestamp read_time;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_DocumentRemove) */
|
||||
} google_firestore_v1_DocumentRemove;
|
||||
|
||||
typedef struct _google_firestore_v1_DocumentTransform_FieldTransform {
|
||||
pb_bytes_array_t *field_path;
|
||||
pb_size_t which_transform_type;
|
||||
union {
|
||||
google_firestore_v1_DocumentTransform_FieldTransform_ServerValue set_to_server_value;
|
||||
google_firestore_v1_Value increment;
|
||||
google_firestore_v1_Value maximum;
|
||||
google_firestore_v1_Value minimum;
|
||||
google_firestore_v1_ArrayValue append_missing_elements;
|
||||
google_firestore_v1_ArrayValue remove_all_from_array;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_DocumentTransform_FieldTransform) */
|
||||
} google_firestore_v1_DocumentTransform_FieldTransform;
|
||||
|
||||
typedef struct _google_firestore_v1_ExistenceFilter {
|
||||
int32_t target_id;
|
||||
int32_t count;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_ExistenceFilter) */
|
||||
} google_firestore_v1_ExistenceFilter;
|
||||
|
||||
typedef struct _google_firestore_v1_Write {
|
||||
pb_size_t which_operation;
|
||||
union {
|
||||
google_firestore_v1_Document update;
|
||||
pb_bytes_array_t *delete_;
|
||||
pb_bytes_array_t *verify;
|
||||
google_firestore_v1_DocumentTransform transform;
|
||||
};
|
||||
bool has_update_mask;
|
||||
google_firestore_v1_DocumentMask update_mask;
|
||||
bool has_current_document;
|
||||
google_firestore_v1_Precondition current_document;
|
||||
pb_size_t update_transforms_count;
|
||||
struct _google_firestore_v1_DocumentTransform_FieldTransform *update_transforms;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_Write) */
|
||||
} google_firestore_v1_Write;
|
||||
|
||||
typedef struct _google_firestore_v1_WriteResult {
|
||||
bool has_update_time;
|
||||
google_protobuf_Timestamp update_time;
|
||||
pb_size_t transform_results_count;
|
||||
struct _google_firestore_v1_Value *transform_results;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_firestore_v1_WriteResult) */
|
||||
} google_firestore_v1_WriteResult;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_firestore_v1_Write_init_default {0, {google_firestore_v1_Document_init_default}, false, google_firestore_v1_DocumentMask_init_default, false, google_firestore_v1_Precondition_init_default, 0, NULL}
|
||||
#define google_firestore_v1_DocumentTransform_init_default {NULL, 0, NULL}
|
||||
#define google_firestore_v1_DocumentTransform_FieldTransform_init_default {NULL, 0, {_google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_MIN}}
|
||||
#define google_firestore_v1_WriteResult_init_default {false, google_protobuf_Timestamp_init_default, 0, NULL}
|
||||
#define google_firestore_v1_DocumentChange_init_default {google_firestore_v1_Document_init_default, 0, NULL, 0, NULL}
|
||||
#define google_firestore_v1_DocumentDelete_init_default {NULL, false, google_protobuf_Timestamp_init_default, 0, NULL}
|
||||
#define google_firestore_v1_DocumentRemove_init_default {NULL, 0, NULL, google_protobuf_Timestamp_init_default}
|
||||
#define google_firestore_v1_ExistenceFilter_init_default {0, 0}
|
||||
#define google_firestore_v1_Write_init_zero {0, {google_firestore_v1_Document_init_zero}, false, google_firestore_v1_DocumentMask_init_zero, false, google_firestore_v1_Precondition_init_zero, 0, NULL}
|
||||
#define google_firestore_v1_DocumentTransform_init_zero {NULL, 0, NULL}
|
||||
#define google_firestore_v1_DocumentTransform_FieldTransform_init_zero {NULL, 0, {_google_firestore_v1_DocumentTransform_FieldTransform_ServerValue_MIN}}
|
||||
#define google_firestore_v1_WriteResult_init_zero {false, google_protobuf_Timestamp_init_zero, 0, NULL}
|
||||
#define google_firestore_v1_DocumentChange_init_zero {google_firestore_v1_Document_init_zero, 0, NULL, 0, NULL}
|
||||
#define google_firestore_v1_DocumentDelete_init_zero {NULL, false, google_protobuf_Timestamp_init_zero, 0, NULL}
|
||||
#define google_firestore_v1_DocumentRemove_init_zero {NULL, 0, NULL, google_protobuf_Timestamp_init_zero}
|
||||
#define google_firestore_v1_ExistenceFilter_init_zero {0, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_firestore_v1_DocumentTransform_document_tag 1
|
||||
#define google_firestore_v1_DocumentTransform_field_transforms_tag 2
|
||||
#define google_firestore_v1_DocumentChange_document_tag 1
|
||||
#define google_firestore_v1_DocumentChange_target_ids_tag 5
|
||||
#define google_firestore_v1_DocumentChange_removed_target_ids_tag 6
|
||||
#define google_firestore_v1_DocumentDelete_document_tag 1
|
||||
#define google_firestore_v1_DocumentDelete_removed_target_ids_tag 6
|
||||
#define google_firestore_v1_DocumentDelete_read_time_tag 4
|
||||
#define google_firestore_v1_DocumentRemove_document_tag 1
|
||||
#define google_firestore_v1_DocumentRemove_removed_target_ids_tag 2
|
||||
#define google_firestore_v1_DocumentRemove_read_time_tag 4
|
||||
#define google_firestore_v1_DocumentTransform_FieldTransform_set_to_server_value_tag 2
|
||||
#define google_firestore_v1_DocumentTransform_FieldTransform_increment_tag 3
|
||||
#define google_firestore_v1_DocumentTransform_FieldTransform_maximum_tag 4
|
||||
#define google_firestore_v1_DocumentTransform_FieldTransform_minimum_tag 5
|
||||
#define google_firestore_v1_DocumentTransform_FieldTransform_append_missing_elements_tag 6
|
||||
#define google_firestore_v1_DocumentTransform_FieldTransform_remove_all_from_array_tag 7
|
||||
#define google_firestore_v1_DocumentTransform_FieldTransform_field_path_tag 1
|
||||
#define google_firestore_v1_ExistenceFilter_target_id_tag 1
|
||||
#define google_firestore_v1_ExistenceFilter_count_tag 2
|
||||
#define google_firestore_v1_Write_update_tag 1
|
||||
#define google_firestore_v1_Write_delete_tag 2
|
||||
#define google_firestore_v1_Write_verify_tag 5
|
||||
#define google_firestore_v1_Write_transform_tag 6
|
||||
#define google_firestore_v1_Write_update_mask_tag 3
|
||||
#define google_firestore_v1_Write_update_transforms_tag 7
|
||||
#define google_firestore_v1_Write_current_document_tag 4
|
||||
#define google_firestore_v1_WriteResult_update_time_tag 1
|
||||
#define google_firestore_v1_WriteResult_transform_results_tag 2
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_firestore_v1_Write_fields[8];
|
||||
extern const pb_field_t google_firestore_v1_DocumentTransform_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_DocumentTransform_FieldTransform_fields[8];
|
||||
extern const pb_field_t google_firestore_v1_WriteResult_fields[3];
|
||||
extern const pb_field_t google_firestore_v1_DocumentChange_fields[4];
|
||||
extern const pb_field_t google_firestore_v1_DocumentDelete_fields[4];
|
||||
extern const pb_field_t google_firestore_v1_DocumentRemove_fields[4];
|
||||
extern const pb_field_t google_firestore_v1_ExistenceFilter_fields[3];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* google_firestore_v1_Write_size depends on runtime parameters */
|
||||
/* google_firestore_v1_DocumentTransform_size depends on runtime parameters */
|
||||
/* google_firestore_v1_DocumentTransform_FieldTransform_size depends on runtime parameters */
|
||||
/* google_firestore_v1_WriteResult_size depends on runtime parameters */
|
||||
/* google_firestore_v1_DocumentChange_size depends on runtime parameters */
|
||||
/* google_firestore_v1_DocumentDelete_size depends on runtime parameters */
|
||||
/* google_firestore_v1_DocumentRemove_size depends on runtime parameters */
|
||||
#define google_firestore_v1_ExistenceFilter_size 22
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define WRITE_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
const char* EnumToString(
|
||||
google_firestore_v1_DocumentTransform_FieldTransform_ServerValue value);
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "any.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_protobuf_Any_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_protobuf_Any, type_url, type_url, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_protobuf_Any, value, type_url, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
std::string google_protobuf_Any::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Any", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("type_url: ", type_url, indent + 1, false);
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_PROTOBUF_ANY_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_PROTOBUF_ANY_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_protobuf_Any {
|
||||
pb_bytes_array_t *type_url;
|
||||
pb_bytes_array_t *value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_Any) */
|
||||
} google_protobuf_Any;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_protobuf_Any_init_default {NULL, NULL}
|
||||
#define google_protobuf_Any_init_zero {NULL, NULL}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_protobuf_Any_type_url_tag 1
|
||||
#define google_protobuf_Any_value_tag 2
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_protobuf_Any_fields[3];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* google_protobuf_Any_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define ANY_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "empty.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_protobuf_Empty_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
std::string google_protobuf_Empty::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Empty", this);
|
||||
std::string result;
|
||||
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_PROTOBUF_EMPTY_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_PROTOBUF_EMPTY_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_protobuf_Empty {
|
||||
char dummy_field;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_Empty) */
|
||||
} google_protobuf_Empty;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_protobuf_Empty_init_default {0}
|
||||
#define google_protobuf_Empty_init_zero {0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_protobuf_Empty_fields[1];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define google_protobuf_Empty_size 0
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define EMPTY_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "struct.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_protobuf_Struct_fields[2] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_protobuf_Struct, fields, fields, &google_protobuf_Struct_FieldsEntry_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_Struct_FieldsEntry_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_protobuf_Struct_FieldsEntry, key, key, 0),
|
||||
PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_protobuf_Struct_FieldsEntry, value, key, &google_protobuf_Value_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_Value_fields[7] = {
|
||||
PB_ANONYMOUS_ONEOF_FIELD(kind, 1, UENUM , ONEOF, STATIC , FIRST, google_protobuf_Value, null_value, null_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(kind, 2, DOUBLE , ONEOF, STATIC , UNION, google_protobuf_Value, number_value, number_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(kind, 3, BYTES , ONEOF, POINTER , UNION, google_protobuf_Value, string_value, string_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(kind, 4, BOOL , ONEOF, STATIC , UNION, google_protobuf_Value, bool_value, bool_value, 0),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(kind, 5, MESSAGE , ONEOF, STATIC , UNION, google_protobuf_Value, struct_value, struct_value, &google_protobuf_Struct_fields),
|
||||
PB_ANONYMOUS_ONEOF_FIELD(kind, 6, MESSAGE , ONEOF, STATIC , UNION, google_protobuf_Value, list_value, list_value, &google_protobuf_ListValue_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_ListValue_fields[2] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_protobuf_ListValue, values, values, &google_protobuf_Value_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_protobuf_Struct_FieldsEntry, value) < 65536 && pb_membersize(google_protobuf_Value, struct_value) < 65536 && pb_membersize(google_protobuf_Value, list_value) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_protobuf_Struct_google_protobuf_Struct_FieldsEntry_google_protobuf_Value_google_protobuf_ListValue)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(google_protobuf_Struct_FieldsEntry, value) < 256 && pb_membersize(google_protobuf_Value, struct_value) < 256 && pb_membersize(google_protobuf_Value, list_value) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_protobuf_Struct_google_protobuf_Struct_FieldsEntry_google_protobuf_Value_google_protobuf_ListValue)
|
||||
#endif
|
||||
|
||||
|
||||
/* On some platforms (such as AVR), double is really float.
|
||||
* These are not directly supported by nanopb, but see example_avr_double.
|
||||
* To get rid of this error, remove any double fields from your .proto.
|
||||
*/
|
||||
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
|
||||
|
||||
const char* EnumToString(
|
||||
google_protobuf_NullValue value) {
|
||||
switch (value) {
|
||||
case google_protobuf_NullValue_NULL_VALUE:
|
||||
return "NULL_VALUE";
|
||||
}
|
||||
return "<unknown enum value>";
|
||||
}
|
||||
|
||||
std::string google_protobuf_Struct::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Struct", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != fields_count; ++i) {
|
||||
result += PrintMessageField("fields ", fields[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_Struct_FieldsEntry::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "FieldsEntry", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("key: ", key, indent + 1, false);
|
||||
result += PrintMessageField("value ", value, indent + 1, false);
|
||||
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
}
|
||||
|
||||
std::string google_protobuf_Value::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Value", this);
|
||||
std::string result;
|
||||
|
||||
switch (which_kind) {
|
||||
case google_protobuf_Value_null_value_tag:
|
||||
result += PrintEnumField("null_value: ", null_value, indent + 1, true);
|
||||
break;
|
||||
case google_protobuf_Value_number_value_tag:
|
||||
result += PrintPrimitiveField("number_value: ",
|
||||
number_value, indent + 1, true);
|
||||
break;
|
||||
case google_protobuf_Value_string_value_tag:
|
||||
result += PrintPrimitiveField("string_value: ",
|
||||
string_value, indent + 1, true);
|
||||
break;
|
||||
case google_protobuf_Value_bool_value_tag:
|
||||
result += PrintPrimitiveField("bool_value: ",
|
||||
bool_value, indent + 1, true);
|
||||
break;
|
||||
case google_protobuf_Value_struct_value_tag:
|
||||
result += PrintMessageField("struct_value ",
|
||||
struct_value, indent + 1, true);
|
||||
break;
|
||||
case google_protobuf_Value_list_value_tag:
|
||||
result += PrintMessageField("list_value ",
|
||||
list_value, indent + 1, true);
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_ListValue::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "ListValue", this);
|
||||
std::string result;
|
||||
|
||||
for (pb_size_t i = 0; i != values_count; ++i) {
|
||||
result += PrintMessageField("values ", values[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_PROTOBUF_STRUCT_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_PROTOBUF_STRUCT_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Enum definitions */
|
||||
typedef enum _google_protobuf_NullValue {
|
||||
google_protobuf_NullValue_NULL_VALUE = 0
|
||||
} google_protobuf_NullValue;
|
||||
#define _google_protobuf_NullValue_MIN google_protobuf_NullValue_NULL_VALUE
|
||||
#define _google_protobuf_NullValue_MAX google_protobuf_NullValue_NULL_VALUE
|
||||
#define _google_protobuf_NullValue_ARRAYSIZE ((google_protobuf_NullValue)(google_protobuf_NullValue_NULL_VALUE+1))
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_protobuf_ListValue {
|
||||
pb_size_t values_count;
|
||||
struct _google_protobuf_Value *values;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_ListValue) */
|
||||
} google_protobuf_ListValue;
|
||||
|
||||
typedef struct _google_protobuf_Struct {
|
||||
pb_size_t fields_count;
|
||||
struct _google_protobuf_Struct_FieldsEntry *fields;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_Struct) */
|
||||
} google_protobuf_Struct;
|
||||
|
||||
typedef struct _google_protobuf_Value {
|
||||
pb_size_t which_kind;
|
||||
union {
|
||||
google_protobuf_NullValue null_value;
|
||||
double number_value;
|
||||
pb_bytes_array_t *string_value;
|
||||
bool bool_value;
|
||||
google_protobuf_Struct struct_value;
|
||||
google_protobuf_ListValue list_value;
|
||||
};
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_Value) */
|
||||
} google_protobuf_Value;
|
||||
|
||||
typedef struct _google_protobuf_Struct_FieldsEntry {
|
||||
pb_bytes_array_t *key;
|
||||
google_protobuf_Value value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_Struct_FieldsEntry) */
|
||||
} google_protobuf_Struct_FieldsEntry;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_protobuf_Struct_init_default {0, NULL}
|
||||
#define google_protobuf_Struct_FieldsEntry_init_default {NULL, google_protobuf_Value_init_default}
|
||||
#define google_protobuf_Value_init_default {0, {_google_protobuf_NullValue_MIN}}
|
||||
#define google_protobuf_ListValue_init_default {0, NULL}
|
||||
#define google_protobuf_Struct_init_zero {0, NULL}
|
||||
#define google_protobuf_Struct_FieldsEntry_init_zero {NULL, google_protobuf_Value_init_zero}
|
||||
#define google_protobuf_Value_init_zero {0, {_google_protobuf_NullValue_MIN}}
|
||||
#define google_protobuf_ListValue_init_zero {0, NULL}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_protobuf_ListValue_values_tag 1
|
||||
#define google_protobuf_Struct_fields_tag 1
|
||||
#define google_protobuf_Value_null_value_tag 1
|
||||
#define google_protobuf_Value_number_value_tag 2
|
||||
#define google_protobuf_Value_string_value_tag 3
|
||||
#define google_protobuf_Value_bool_value_tag 4
|
||||
#define google_protobuf_Value_struct_value_tag 5
|
||||
#define google_protobuf_Value_list_value_tag 6
|
||||
#define google_protobuf_Struct_FieldsEntry_key_tag 1
|
||||
#define google_protobuf_Struct_FieldsEntry_value_tag 2
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_protobuf_Struct_fields[2];
|
||||
extern const pb_field_t google_protobuf_Struct_FieldsEntry_fields[3];
|
||||
extern const pb_field_t google_protobuf_Value_fields[7];
|
||||
extern const pb_field_t google_protobuf_ListValue_fields[2];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* google_protobuf_Struct_size depends on runtime parameters */
|
||||
/* google_protobuf_Struct_FieldsEntry_size depends on runtime parameters */
|
||||
/* google_protobuf_Value_size depends on runtime parameters */
|
||||
/* google_protobuf_ListValue_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define STRUCT_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
const char* EnumToString(google_protobuf_NullValue value);
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "timestamp.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_protobuf_Timestamp_fields[3] = {
|
||||
PB_FIELD( 1, INT64 , SINGULAR, STATIC , FIRST, google_protobuf_Timestamp, seconds, seconds, 0),
|
||||
PB_FIELD( 2, INT32 , SINGULAR, STATIC , OTHER, google_protobuf_Timestamp, nanos, seconds, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
std::string google_protobuf_Timestamp::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Timestamp", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("seconds: ", seconds, indent + 1, false);
|
||||
result += PrintPrimitiveField("nanos: ", nanos, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_PROTOBUF_TIMESTAMP_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_PROTOBUF_TIMESTAMP_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_protobuf_Timestamp {
|
||||
int64_t seconds;
|
||||
int32_t nanos;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_Timestamp) */
|
||||
} google_protobuf_Timestamp;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_protobuf_Timestamp_init_default {0, 0}
|
||||
#define google_protobuf_Timestamp_init_zero {0, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_protobuf_Timestamp_seconds_tag 1
|
||||
#define google_protobuf_Timestamp_nanos_tag 2
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_protobuf_Timestamp_fields[3];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define google_protobuf_Timestamp_size 22
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define TIMESTAMP_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "wrappers.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_protobuf_DoubleValue_fields[2] = {
|
||||
PB_FIELD( 1, DOUBLE , SINGULAR, STATIC , FIRST, google_protobuf_DoubleValue, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_FloatValue_fields[2] = {
|
||||
PB_FIELD( 1, FLOAT , SINGULAR, STATIC , FIRST, google_protobuf_FloatValue, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_Int64Value_fields[2] = {
|
||||
PB_FIELD( 1, INT64 , SINGULAR, STATIC , FIRST, google_protobuf_Int64Value, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_UInt64Value_fields[2] = {
|
||||
PB_FIELD( 1, UINT64 , SINGULAR, STATIC , FIRST, google_protobuf_UInt64Value, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_Int32Value_fields[2] = {
|
||||
PB_FIELD( 1, INT32 , SINGULAR, STATIC , FIRST, google_protobuf_Int32Value, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_UInt32Value_fields[2] = {
|
||||
PB_FIELD( 1, UINT32 , SINGULAR, STATIC , FIRST, google_protobuf_UInt32Value, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_BoolValue_fields[2] = {
|
||||
PB_FIELD( 1, BOOL , SINGULAR, STATIC , FIRST, google_protobuf_BoolValue, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_StringValue_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_protobuf_StringValue, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t google_protobuf_BytesValue_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_protobuf_BytesValue, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
/* On some platforms (such as AVR), double is really float.
|
||||
* These are not directly supported by nanopb, but see example_avr_double.
|
||||
* To get rid of this error, remove any double fields from your .proto.
|
||||
*/
|
||||
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
|
||||
|
||||
std::string google_protobuf_DoubleValue::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "DoubleValue", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_FloatValue::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "FloatValue", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_Int64Value::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Int64Value", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_UInt64Value::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "UInt64Value", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_Int32Value::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Int32Value", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_UInt32Value::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "UInt32Value", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_BoolValue::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BoolValue", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_StringValue::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "StringValue", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string google_protobuf_BytesValue::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "BytesValue", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("value: ", value, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_PROTOBUF_WRAPPERS_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_PROTOBUF_WRAPPERS_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_protobuf_BytesValue {
|
||||
pb_bytes_array_t *value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_BytesValue) */
|
||||
} google_protobuf_BytesValue;
|
||||
|
||||
typedef struct _google_protobuf_StringValue {
|
||||
pb_bytes_array_t *value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_StringValue) */
|
||||
} google_protobuf_StringValue;
|
||||
|
||||
typedef struct _google_protobuf_BoolValue {
|
||||
bool value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_BoolValue) */
|
||||
} google_protobuf_BoolValue;
|
||||
|
||||
typedef struct _google_protobuf_DoubleValue {
|
||||
double value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_DoubleValue) */
|
||||
} google_protobuf_DoubleValue;
|
||||
|
||||
typedef struct _google_protobuf_FloatValue {
|
||||
float value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_FloatValue) */
|
||||
} google_protobuf_FloatValue;
|
||||
|
||||
typedef struct _google_protobuf_Int32Value {
|
||||
int32_t value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_Int32Value) */
|
||||
} google_protobuf_Int32Value;
|
||||
|
||||
typedef struct _google_protobuf_Int64Value {
|
||||
int64_t value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_Int64Value) */
|
||||
} google_protobuf_Int64Value;
|
||||
|
||||
typedef struct _google_protobuf_UInt32Value {
|
||||
uint32_t value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_UInt32Value) */
|
||||
} google_protobuf_UInt32Value;
|
||||
|
||||
typedef struct _google_protobuf_UInt64Value {
|
||||
uint64_t value;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_protobuf_UInt64Value) */
|
||||
} google_protobuf_UInt64Value;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_protobuf_DoubleValue_init_default {0}
|
||||
#define google_protobuf_FloatValue_init_default {0}
|
||||
#define google_protobuf_Int64Value_init_default {0}
|
||||
#define google_protobuf_UInt64Value_init_default {0}
|
||||
#define google_protobuf_Int32Value_init_default {0}
|
||||
#define google_protobuf_UInt32Value_init_default {0}
|
||||
#define google_protobuf_BoolValue_init_default {0}
|
||||
#define google_protobuf_StringValue_init_default {NULL}
|
||||
#define google_protobuf_BytesValue_init_default {NULL}
|
||||
#define google_protobuf_DoubleValue_init_zero {0}
|
||||
#define google_protobuf_FloatValue_init_zero {0}
|
||||
#define google_protobuf_Int64Value_init_zero {0}
|
||||
#define google_protobuf_UInt64Value_init_zero {0}
|
||||
#define google_protobuf_Int32Value_init_zero {0}
|
||||
#define google_protobuf_UInt32Value_init_zero {0}
|
||||
#define google_protobuf_BoolValue_init_zero {0}
|
||||
#define google_protobuf_StringValue_init_zero {NULL}
|
||||
#define google_protobuf_BytesValue_init_zero {NULL}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_protobuf_BytesValue_value_tag 1
|
||||
#define google_protobuf_StringValue_value_tag 1
|
||||
#define google_protobuf_BoolValue_value_tag 1
|
||||
#define google_protobuf_DoubleValue_value_tag 1
|
||||
#define google_protobuf_FloatValue_value_tag 1
|
||||
#define google_protobuf_Int32Value_value_tag 1
|
||||
#define google_protobuf_Int64Value_value_tag 1
|
||||
#define google_protobuf_UInt32Value_value_tag 1
|
||||
#define google_protobuf_UInt64Value_value_tag 1
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_protobuf_DoubleValue_fields[2];
|
||||
extern const pb_field_t google_protobuf_FloatValue_fields[2];
|
||||
extern const pb_field_t google_protobuf_Int64Value_fields[2];
|
||||
extern const pb_field_t google_protobuf_UInt64Value_fields[2];
|
||||
extern const pb_field_t google_protobuf_Int32Value_fields[2];
|
||||
extern const pb_field_t google_protobuf_UInt32Value_fields[2];
|
||||
extern const pb_field_t google_protobuf_BoolValue_fields[2];
|
||||
extern const pb_field_t google_protobuf_StringValue_fields[2];
|
||||
extern const pb_field_t google_protobuf_BytesValue_fields[2];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define google_protobuf_DoubleValue_size 9
|
||||
#define google_protobuf_FloatValue_size 5
|
||||
#define google_protobuf_Int64Value_size 11
|
||||
#define google_protobuf_UInt64Value_size 11
|
||||
#define google_protobuf_Int32Value_size 11
|
||||
#define google_protobuf_UInt32Value_size 6
|
||||
#define google_protobuf_BoolValue_size 2
|
||||
/* google_protobuf_StringValue_size depends on runtime parameters */
|
||||
/* google_protobuf_BytesValue_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define WRAPPERS_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "status.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_rpc_Status_fields[4] = {
|
||||
PB_FIELD( 1, INT32 , SINGULAR, STATIC , FIRST, google_rpc_Status, code, code, 0),
|
||||
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_rpc_Status, message, code, 0),
|
||||
PB_FIELD( 3, MESSAGE , REPEATED, POINTER , OTHER, google_rpc_Status, details, message, &google_protobuf_Any_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
std::string google_rpc_Status::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "Status", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("code: ", code, indent + 1, false);
|
||||
result += PrintPrimitiveField("message: ", message, indent + 1, false);
|
||||
for (pb_size_t i = 0; i != details_count; ++i) {
|
||||
result += PrintMessageField("details ", details[i], indent + 1, true);
|
||||
}
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_RPC_STATUS_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_RPC_STATUS_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include "google/protobuf/any.nanopb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_rpc_Status {
|
||||
int32_t code;
|
||||
pb_bytes_array_t *message;
|
||||
pb_size_t details_count;
|
||||
struct _google_protobuf_Any *details;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_rpc_Status) */
|
||||
} google_rpc_Status;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_rpc_Status_init_default {0, NULL, 0, NULL}
|
||||
#define google_rpc_Status_init_zero {0, NULL, 0, NULL}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_rpc_Status_code_tag 1
|
||||
#define google_rpc_Status_message_tag 2
|
||||
#define google_rpc_Status_details_tag 3
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_rpc_Status_fields[4];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* google_rpc_Status_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define STATUS_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#include "latlng.nanopb.h"
|
||||
|
||||
#include "Firestore/core/src/nanopb/pretty_printing.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
using nanopb::PrintEnumField;
|
||||
using nanopb::PrintHeader;
|
||||
using nanopb::PrintMessageField;
|
||||
using nanopb::PrintPrimitiveField;
|
||||
using nanopb::PrintTail;
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const pb_field_t google_type_LatLng_fields[3] = {
|
||||
PB_FIELD( 1, DOUBLE , SINGULAR, STATIC , FIRST, google_type_LatLng, latitude, latitude, 0),
|
||||
PB_FIELD( 2, DOUBLE , SINGULAR, STATIC , OTHER, google_type_LatLng, longitude, latitude, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
/* On some platforms (such as AVR), double is really float.
|
||||
* These are not directly supported by nanopb, but see example_avr_double.
|
||||
* To get rid of this error, remove any double fields from your .proto.
|
||||
*/
|
||||
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
|
||||
|
||||
std::string google_type_LatLng::ToString(int indent) const {
|
||||
std::string header = PrintHeader(indent, "LatLng", this);
|
||||
std::string result;
|
||||
|
||||
result += PrintPrimitiveField("latitude: ", latitude, indent + 1, false);
|
||||
result += PrintPrimitiveField("longitude: ", longitude, indent + 1, false);
|
||||
|
||||
bool is_root = indent == 0;
|
||||
if (!result.empty() || is_root) {
|
||||
std::string tail = PrintTail(indent);
|
||||
return header + result + tail;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.3.9.8 */
|
||||
|
||||
#ifndef PB_GOOGLE_TYPE_LATLNG_NANOPB_H_INCLUDED
|
||||
#define PB_GOOGLE_TYPE_LATLNG_NANOPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
|
||||
/* @@protoc_insertion_point(includes) */
|
||||
#if PB_PROTO_HEADER_VERSION != 30
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _google_type_LatLng {
|
||||
double latitude;
|
||||
double longitude;
|
||||
|
||||
std::string ToString(int indent = 0) const;
|
||||
/* @@protoc_insertion_point(struct:google_type_LatLng) */
|
||||
} google_type_LatLng;
|
||||
|
||||
/* Default values for struct fields */
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define google_type_LatLng_init_default {0, 0}
|
||||
#define google_type_LatLng_init_zero {0, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define google_type_LatLng_latitude_tag 1
|
||||
#define google_type_LatLng_longitude_tag 2
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t google_type_LatLng_fields[3];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define google_type_LatLng_size 18
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define LATLNG_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
||||
#endif
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRCollectionReference.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Firestore/core/src/api/api_fwd.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
namespace model {
|
||||
class ResourcePath;
|
||||
} // namespace model
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
namespace model = firebase::firestore::model;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Internal FIRCollectionReference API we don't want exposed in our public header files. */
|
||||
@interface FIRCollectionReference (/* Init */)
|
||||
|
||||
- (instancetype)initWithReference:(api::CollectionReference &&)reference NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
// Mark the super class designated initializer unavailable.
|
||||
- (instancetype)initWithQuery:(api::Query &&)query NS_UNAVAILABLE;
|
||||
|
||||
- (instancetype)initWithPath:(model::ResourcePath)path
|
||||
firestore:(std::shared_ptr<api::Firestore>)firestore;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRCollectionReference.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#import "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFirestore+Internal.h"
|
||||
#import "Firestore/Source/API/FIRQuery+Internal.h"
|
||||
#import "Firestore/Source/API/FSTUserDataReader.h"
|
||||
|
||||
#include "Firestore/core/src/api/collection_reference.h"
|
||||
#include "Firestore/core/src/api/document_reference.h"
|
||||
#include "Firestore/core/src/core/user_data.h"
|
||||
#include "Firestore/core/src/model/resource_path.h"
|
||||
#include "Firestore/core/src/util/error_apple.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/string_apple.h"
|
||||
|
||||
using firebase::firestore::api::CollectionReference;
|
||||
using firebase::firestore::api::DocumentReference;
|
||||
using firebase::firestore::core::ParsedSetData;
|
||||
using firebase::firestore::model::ResourcePath;
|
||||
using firebase::firestore::util::MakeCallback;
|
||||
using firebase::firestore::util::MakeNSString;
|
||||
using firebase::firestore::util::MakeString;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation FIRCollectionReference
|
||||
|
||||
- (instancetype)initWithReference:(CollectionReference &&)reference {
|
||||
return [super initWithQuery:std::move(reference)];
|
||||
}
|
||||
|
||||
- (instancetype)initWithPath:(ResourcePath)path
|
||||
firestore:(std::shared_ptr<api::Firestore>)firestore {
|
||||
CollectionReference ref(std::move(path), std::move(firestore));
|
||||
return [self initWithReference:std::move(ref)];
|
||||
}
|
||||
|
||||
// Override the designated initializer from the super class.
|
||||
- (instancetype)initWithQuery:(__unused api::Query &&)query {
|
||||
HARD_FAIL("Use FIRCollectionReference initWithPath: initializer.");
|
||||
}
|
||||
|
||||
// NSObject Methods
|
||||
- (BOOL)isEqual:(nullable id)other {
|
||||
if (other == self) return YES;
|
||||
if (![[other class] isEqual:[self class]]) return NO;
|
||||
|
||||
return [self isEqualToReference:other];
|
||||
}
|
||||
|
||||
- (BOOL)isEqualToReference:(nullable FIRCollectionReference *)otherReference {
|
||||
if (self == otherReference) return YES;
|
||||
if (otherReference == nil) return NO;
|
||||
return self.reference == otherReference.reference;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return self.reference.Hash();
|
||||
}
|
||||
|
||||
- (const CollectionReference &)reference {
|
||||
// TODO(wilhuff): Use some alternate method for doing this.
|
||||
//
|
||||
// Casting from Query& to CollectionReference& when the value is actually a
|
||||
// Query violates aliasing rules and is technically undefined behavior.
|
||||
// Nevertheless this works on Clang so this is good enough for now.
|
||||
return static_cast<const CollectionReference &>(self.apiQuery);
|
||||
}
|
||||
|
||||
- (NSString *)collectionID {
|
||||
return MakeNSString(self.reference.collection_id());
|
||||
}
|
||||
|
||||
- (FIRDocumentReference *_Nullable)parent {
|
||||
absl::optional<DocumentReference> parent = self.reference.parent();
|
||||
if (!parent) {
|
||||
return nil;
|
||||
}
|
||||
return [[FIRDocumentReference alloc] initWithReference:std::move(*parent)];
|
||||
}
|
||||
|
||||
- (NSString *)path {
|
||||
return MakeNSString(self.reference.path());
|
||||
}
|
||||
|
||||
- (FIRDocumentReference *)documentWithPath:(NSString *)documentPath {
|
||||
if (!documentPath) {
|
||||
ThrowInvalidArgument("Document path cannot be nil.");
|
||||
}
|
||||
if (!documentPath.length) {
|
||||
ThrowInvalidArgument("Document path cannot be empty.");
|
||||
}
|
||||
DocumentReference child = self.reference.Document(MakeString(documentPath));
|
||||
return [[FIRDocumentReference alloc] initWithReference:std::move(child)];
|
||||
}
|
||||
|
||||
- (FIRDocumentReference *)addDocumentWithData:(NSDictionary<NSString *, id> *)data {
|
||||
return [self addDocumentWithData:data completion:nil];
|
||||
}
|
||||
|
||||
- (FIRDocumentReference *)addDocumentWithData:(NSDictionary<NSString *, id> *)data
|
||||
completion:
|
||||
(nullable void (^)(NSError *_Nullable error))completion {
|
||||
ParsedSetData parsed = [self.firestore.dataReader parsedSetData:data];
|
||||
DocumentReference docRef =
|
||||
self.reference.AddDocument(std::move(parsed), MakeCallback(completion));
|
||||
return [[FIRDocumentReference alloc] initWithReference:std::move(docRef)];
|
||||
}
|
||||
|
||||
- (FIRDocumentReference *)documentWithAutoID {
|
||||
return [[FIRDocumentReference alloc] initWithReference:self.reference.Document()];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRDocumentChange.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "Firestore/core/src/api/document_change.h"
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRDocumentChange (/* Init */)
|
||||
|
||||
- (instancetype)initWithDocumentChange:(api::DocumentChange &&)documentChange
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FIRDocumentChange+Internal.h"
|
||||
|
||||
#import "Firestore/Source/API/FIRDocumentSnapshot+Internal.h"
|
||||
|
||||
#include "Firestore/core/src/api/document_change.h"
|
||||
#include "Firestore/core/src/util/hard_assert.h"
|
||||
|
||||
using firebase::firestore::api::DocumentChange;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* Converts from C++ document change indexes to Objective-C document change
|
||||
* indexes. Objective-C's NSNotFound is signed NSIntegerMax, not unsigned -1.
|
||||
*/
|
||||
constexpr NSUInteger MakeIndex(size_t index) {
|
||||
return index == DocumentChange::npos ? NSNotFound : index;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@implementation FIRDocumentChange {
|
||||
DocumentChange _documentChange;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDocumentChange:(DocumentChange &&)documentChange {
|
||||
if (self = [super init]) {
|
||||
_documentChange = std::move(documentChange);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(nullable id)other {
|
||||
if (other == self) return YES;
|
||||
if (![other isKindOfClass:[FIRDocumentChange class]]) return NO;
|
||||
|
||||
FIRDocumentChange *change = (FIRDocumentChange *)other;
|
||||
return _documentChange == change->_documentChange;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return _documentChange.Hash();
|
||||
}
|
||||
|
||||
- (FIRDocumentChangeType)type {
|
||||
switch (_documentChange.type()) {
|
||||
case DocumentChange::Type::Added:
|
||||
return FIRDocumentChangeTypeAdded;
|
||||
case DocumentChange::Type::Modified:
|
||||
return FIRDocumentChangeTypeModified;
|
||||
case DocumentChange::Type::Removed:
|
||||
return FIRDocumentChangeTypeRemoved;
|
||||
}
|
||||
|
||||
HARD_FAIL("Unknown DocumentChange::Type: %s", _documentChange.type());
|
||||
}
|
||||
|
||||
- (FIRQueryDocumentSnapshot *)document {
|
||||
return [[FIRQueryDocumentSnapshot alloc] initWithSnapshot:_documentChange.document()];
|
||||
}
|
||||
|
||||
- (NSUInteger)oldIndex {
|
||||
return MakeIndex(_documentChange.old_index());
|
||||
}
|
||||
|
||||
- (NSUInteger)newIndex {
|
||||
return MakeIndex(_documentChange.new_index());
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRDocumentReference.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Firestore/core/src/api/api_fwd.h"
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
namespace model {
|
||||
class DocumentKey;
|
||||
class ResourcePath;
|
||||
} // namespace model
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
namespace model = firebase::firestore::model;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRDocumentReference (/* Init */)
|
||||
|
||||
- (instancetype)initWithReference:(api::DocumentReference &&)reference NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithPath:(model::ResourcePath)path
|
||||
firestore:(std::shared_ptr<api::Firestore>)firestore;
|
||||
|
||||
- (instancetype)initWithKey:(model::DocumentKey)key
|
||||
firestore:(std::shared_ptr<api::Firestore>)firestore;
|
||||
|
||||
@end
|
||||
|
||||
/** Internal FIRDocumentReference API we don't want exposed in our public header files. */
|
||||
@interface FIRDocumentReference (Internal)
|
||||
|
||||
- (const api::DocumentReference &)internalReference;
|
||||
- (const model::DocumentKey &)key;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* Copyright 2017 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRDocumentReference+Internal.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#import "FIRFirestoreErrors.h"
|
||||
#import "Firestore/Source/API/FIRCollectionReference+Internal.h"
|
||||
#import "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#import "Firestore/Source/API/FIRDocumentSnapshot+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFirestore+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFirestoreSource+Internal.h"
|
||||
#import "Firestore/Source/API/FIRListenerRegistration+Internal.h"
|
||||
#import "Firestore/Source/API/FSTUserDataReader.h"
|
||||
|
||||
#include "Firestore/core/src/api/collection_reference.h"
|
||||
#include "Firestore/core/src/api/document_reference.h"
|
||||
#include "Firestore/core/src/api/document_snapshot.h"
|
||||
#include "Firestore/core/src/api/source.h"
|
||||
#include "Firestore/core/src/core/event_listener.h"
|
||||
#include "Firestore/core/src/core/listen_options.h"
|
||||
#include "Firestore/core/src/core/user_data.h"
|
||||
#include "Firestore/core/src/model/document_key.h"
|
||||
#include "Firestore/core/src/model/document_set.h"
|
||||
#include "Firestore/core/src/model/resource_path.h"
|
||||
#include "Firestore/core/src/util/error_apple.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/status.h"
|
||||
#include "Firestore/core/src/util/statusor.h"
|
||||
#include "Firestore/core/src/util/string_apple.h"
|
||||
|
||||
using firebase::firestore::api::CollectionReference;
|
||||
using firebase::firestore::api::DocumentReference;
|
||||
using firebase::firestore::api::DocumentSnapshot;
|
||||
using firebase::firestore::api::DocumentSnapshotListener;
|
||||
using firebase::firestore::api::Firestore;
|
||||
using firebase::firestore::api::ListenerRegistration;
|
||||
using firebase::firestore::api::Source;
|
||||
using firebase::firestore::api::MakeSource;
|
||||
using firebase::firestore::core::EventListener;
|
||||
using firebase::firestore::core::ListenOptions;
|
||||
using firebase::firestore::core::ParsedSetData;
|
||||
using firebase::firestore::core::ParsedUpdateData;
|
||||
using firebase::firestore::model::DocumentKey;
|
||||
using firebase::firestore::model::ResourcePath;
|
||||
using firebase::firestore::util::MakeCallback;
|
||||
using firebase::firestore::util::MakeNSString;
|
||||
using firebase::firestore::util::MakeString;
|
||||
using firebase::firestore::util::StatusOr;
|
||||
using firebase::firestore::util::StatusOr;
|
||||
using firebase::firestore::util::StatusOrCallback;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - FIRDocumentReference
|
||||
|
||||
@implementation FIRDocumentReference {
|
||||
DocumentReference _documentReference;
|
||||
}
|
||||
|
||||
- (instancetype)initWithReference:(DocumentReference &&)reference {
|
||||
if (self = [super init]) {
|
||||
_documentReference = std::move(reference);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithPath:(ResourcePath)path firestore:(std::shared_ptr<Firestore>)firestore {
|
||||
if (path.size() % 2 != 0) {
|
||||
ThrowInvalidArgument("Invalid document reference. Document references must have an even "
|
||||
"number of segments, but %s has %s",
|
||||
path.CanonicalString(), path.size());
|
||||
}
|
||||
return [self initWithKey:DocumentKey{std::move(path)} firestore:firestore];
|
||||
}
|
||||
|
||||
- (instancetype)initWithKey:(DocumentKey)key firestore:(std::shared_ptr<Firestore>)firestore {
|
||||
DocumentReference delegate{std::move(key), firestore};
|
||||
return [self initWithReference:std::move(delegate)];
|
||||
}
|
||||
|
||||
#pragma mark - NSObject Methods
|
||||
|
||||
- (BOOL)isEqual:(nullable id)other {
|
||||
if (other == self) return YES;
|
||||
if (![[other class] isEqual:[self class]]) return NO;
|
||||
|
||||
return _documentReference == static_cast<FIRDocumentReference *>(other)->_documentReference;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return _documentReference.Hash();
|
||||
}
|
||||
|
||||
#pragma mark - Public Methods
|
||||
|
||||
@dynamic firestore;
|
||||
|
||||
- (FIRFirestore *)firestore {
|
||||
return [FIRFirestore recoverFromFirestore:_documentReference.firestore()];
|
||||
}
|
||||
|
||||
- (NSString *)documentID {
|
||||
return MakeNSString(_documentReference.document_id());
|
||||
}
|
||||
|
||||
- (FIRCollectionReference *)parent {
|
||||
return [[FIRCollectionReference alloc] initWithReference:_documentReference.Parent()];
|
||||
}
|
||||
|
||||
- (NSString *)path {
|
||||
return MakeNSString(_documentReference.Path());
|
||||
}
|
||||
|
||||
- (FIRCollectionReference *)collectionWithPath:(NSString *)collectionPath {
|
||||
if (!collectionPath) {
|
||||
ThrowInvalidArgument("Collection path cannot be nil.");
|
||||
}
|
||||
if (!collectionPath.length) {
|
||||
ThrowInvalidArgument("Collection path cannot be empty.");
|
||||
}
|
||||
|
||||
CollectionReference child = _documentReference.GetCollectionReference(MakeString(collectionPath));
|
||||
return [[FIRCollectionReference alloc] initWithReference:std::move(child)];
|
||||
}
|
||||
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData {
|
||||
[self setData:documentData merge:NO completion:nil];
|
||||
}
|
||||
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData merge:(BOOL)merge {
|
||||
[self setData:documentData merge:merge completion:nil];
|
||||
}
|
||||
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData
|
||||
mergeFields:(NSArray<id> *)mergeFields {
|
||||
[self setData:documentData mergeFields:mergeFields completion:nil];
|
||||
}
|
||||
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData
|
||||
completion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
[self setData:documentData merge:NO completion:completion];
|
||||
}
|
||||
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData
|
||||
merge:(BOOL)merge
|
||||
completion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
auto dataReader = self.firestore.dataReader;
|
||||
ParsedSetData parsed = merge ? [dataReader parsedMergeData:documentData fieldMask:nil]
|
||||
: [dataReader parsedSetData:documentData];
|
||||
_documentReference.SetData(std::move(parsed), MakeCallback(completion));
|
||||
}
|
||||
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData
|
||||
mergeFields:(NSArray<id> *)mergeFields
|
||||
completion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
ParsedSetData parsed = [self.firestore.dataReader parsedMergeData:documentData
|
||||
fieldMask:mergeFields];
|
||||
_documentReference.SetData(std::move(parsed), MakeCallback(completion));
|
||||
}
|
||||
|
||||
- (void)updateData:(NSDictionary<id, id> *)fields {
|
||||
[self updateData:fields completion:nil];
|
||||
}
|
||||
|
||||
- (void)updateData:(NSDictionary<id, id> *)fields
|
||||
completion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
ParsedUpdateData parsed = [self.firestore.dataReader parsedUpdateData:fields];
|
||||
_documentReference.UpdateData(std::move(parsed), MakeCallback(completion));
|
||||
}
|
||||
|
||||
- (void)deleteDocument {
|
||||
[self deleteDocumentWithCompletion:nil];
|
||||
}
|
||||
|
||||
- (void)deleteDocumentWithCompletion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
_documentReference.DeleteDocument(MakeCallback(completion));
|
||||
}
|
||||
|
||||
- (void)getDocumentWithCompletion:(FIRDocumentSnapshotBlock)completion {
|
||||
_documentReference.GetDocument(Source::Default, [self wrapDocumentSnapshotBlock:completion]);
|
||||
}
|
||||
|
||||
- (void)getDocumentWithSource:(FIRFirestoreSource)source
|
||||
completion:(FIRDocumentSnapshotBlock)completion {
|
||||
_documentReference.GetDocument(MakeSource(source), [self wrapDocumentSnapshotBlock:completion]);
|
||||
}
|
||||
|
||||
- (id<FIRListenerRegistration>)addSnapshotListener:(FIRDocumentSnapshotBlock)listener {
|
||||
return [self addSnapshotListenerWithIncludeMetadataChanges:NO listener:listener];
|
||||
}
|
||||
|
||||
- (id<FIRListenerRegistration>)
|
||||
addSnapshotListenerWithIncludeMetadataChanges:(BOOL)includeMetadataChanges
|
||||
listener:(FIRDocumentSnapshotBlock)listener {
|
||||
ListenOptions options = ListenOptions::FromIncludeMetadataChanges(includeMetadataChanges);
|
||||
return [self addSnapshotListenerInternalWithOptions:options listener:listener];
|
||||
}
|
||||
|
||||
- (id<FIRListenerRegistration>)addSnapshotListenerInternalWithOptions:(ListenOptions)internalOptions
|
||||
listener:(FIRDocumentSnapshotBlock)
|
||||
listener {
|
||||
std::unique_ptr<ListenerRegistration> result = _documentReference.AddSnapshotListener(
|
||||
std::move(internalOptions), [self wrapDocumentSnapshotBlock:listener]);
|
||||
return [[FSTListenerRegistration alloc] initWithRegistration:std::move(result)];
|
||||
}
|
||||
|
||||
- (DocumentSnapshotListener)wrapDocumentSnapshotBlock:(FIRDocumentSnapshotBlock)block {
|
||||
class Converter : public EventListener<DocumentSnapshot> {
|
||||
public:
|
||||
explicit Converter(FIRDocumentSnapshotBlock block) : block_(block) {
|
||||
}
|
||||
|
||||
void OnEvent(StatusOr<DocumentSnapshot> maybe_snapshot) override {
|
||||
if (maybe_snapshot.ok()) {
|
||||
FIRDocumentSnapshot *result =
|
||||
[[FIRDocumentSnapshot alloc] initWithSnapshot:std::move(maybe_snapshot).ValueOrDie()];
|
||||
block_(result, nil);
|
||||
} else {
|
||||
block_(nil, MakeNSError(maybe_snapshot.status()));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
FIRDocumentSnapshotBlock block_;
|
||||
};
|
||||
return absl::make_unique<Converter>(block);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - FIRDocumentReference (Internal)
|
||||
|
||||
@implementation FIRDocumentReference (Internal)
|
||||
|
||||
- (const api::DocumentReference &)internalReference {
|
||||
return _documentReference;
|
||||
}
|
||||
|
||||
- (const DocumentKey &)key {
|
||||
return _documentReference.key();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRDocumentSnapshot.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Firestore/core/src/api/api_fwd.h"
|
||||
#include "Firestore/core/src/model/model_fwd.h"
|
||||
|
||||
@class FIRFirestore;
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
namespace model = firebase::firestore::model;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRDocumentSnapshot (/* Init */)
|
||||
|
||||
- (instancetype)initWithSnapshot:(api::DocumentSnapshot &&)snapshot NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithFirestore:(FIRFirestore *)firestore
|
||||
documentKey:(model::DocumentKey)documentKey
|
||||
document:(const absl::optional<model::Document> &)document
|
||||
metadata:(api::SnapshotMetadata)metadata;
|
||||
|
||||
- (instancetype)initWithFirestore:(FIRFirestore *)firestore
|
||||
documentKey:(model::DocumentKey)documentKey
|
||||
document:(const absl::optional<model::Document> &)document
|
||||
fromCache:(bool)fromCache
|
||||
hasPendingWrites:(bool)hasPendingWrites;
|
||||
|
||||
@end
|
||||
|
||||
/** Internal FIRDocumentSnapshot API we don't want exposed in our public header files. */
|
||||
@interface FIRDocumentSnapshot (Internal)
|
||||
|
||||
- (const absl::optional<model::Document> &)internalDocument;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright 2017 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRDocumentSnapshot+Internal.h"
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Firestore/core/src/util/warnings.h"
|
||||
|
||||
#import "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFieldPath+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFirestore+Internal.h"
|
||||
#import "Firestore/Source/API/FIRGeoPoint+Internal.h"
|
||||
#import "Firestore/Source/API/FIRSnapshotMetadata+Internal.h"
|
||||
#import "Firestore/Source/API/FIRTimestamp+Internal.h"
|
||||
#import "Firestore/Source/API/FSTUserDataWriter.h"
|
||||
#import "Firestore/Source/API/converters.h"
|
||||
|
||||
#include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h"
|
||||
#include "Firestore/core/src/api/document_reference.h"
|
||||
#include "Firestore/core/src/api/document_snapshot.h"
|
||||
#include "Firestore/core/src/api/firestore.h"
|
||||
#include "Firestore/core/src/api/settings.h"
|
||||
#include "Firestore/core/src/model/database_id.h"
|
||||
#include "Firestore/core/src/model/document_key.h"
|
||||
#include "Firestore/core/src/model/field_path.h"
|
||||
#include "Firestore/core/src/nanopb/nanopb_util.h"
|
||||
#include "Firestore/core/src/remote/serializer.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/hard_assert.h"
|
||||
#include "Firestore/core/src/util/log.h"
|
||||
#include "Firestore/core/src/util/string_apple.h"
|
||||
|
||||
using firebase::firestore::google_firestore_v1_Value;
|
||||
using firebase::firestore::api::DocumentSnapshot;
|
||||
using firebase::firestore::api::Firestore;
|
||||
using firebase::firestore::api::MakeFIRGeoPoint;
|
||||
using firebase::firestore::api::MakeFIRTimestamp;
|
||||
using firebase::firestore::api::SnapshotMetadata;
|
||||
using firebase::firestore::model::DatabaseId;
|
||||
using firebase::firestore::model::Document;
|
||||
using firebase::firestore::model::DocumentKey;
|
||||
using firebase::firestore::model::FieldPath;
|
||||
using firebase::firestore::model::ObjectValue;
|
||||
using firebase::firestore::remote::Serializer;
|
||||
using firebase::firestore::nanopb::MakeNSData;
|
||||
using firebase::firestore::util::MakeNSString;
|
||||
using firebase::firestore::util::MakeString;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
using firebase::firestore::google_firestore_v1_Value;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation FIRDocumentSnapshot {
|
||||
DocumentSnapshot _snapshot;
|
||||
|
||||
std::unique_ptr<Serializer> _serializer;
|
||||
FIRSnapshotMetadata *_cachedMetadata;
|
||||
}
|
||||
|
||||
- (instancetype)initWithSnapshot:(DocumentSnapshot &&)snapshot {
|
||||
if (self = [super init]) {
|
||||
_snapshot = std::move(snapshot);
|
||||
_serializer.reset(new Serializer(_snapshot.firestore()->database_id()));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFirestore:(FIRFirestore *)firestore
|
||||
documentKey:(DocumentKey)documentKey
|
||||
document:(const absl::optional<Document> &)document
|
||||
metadata:(SnapshotMetadata)metadata {
|
||||
DocumentSnapshot wrapped;
|
||||
if (document.has_value()) {
|
||||
wrapped =
|
||||
DocumentSnapshot::FromDocument(firestore.wrapped, document.value(), std::move(metadata));
|
||||
} else {
|
||||
wrapped = DocumentSnapshot::FromNoDocument(firestore.wrapped, std::move(documentKey),
|
||||
std::move(metadata));
|
||||
}
|
||||
_serializer.reset(new Serializer(firestore.databaseID));
|
||||
return [self initWithSnapshot:std::move(wrapped)];
|
||||
}
|
||||
|
||||
- (instancetype)initWithFirestore:(FIRFirestore *)firestore
|
||||
documentKey:(DocumentKey)documentKey
|
||||
document:(const absl::optional<Document> &)document
|
||||
fromCache:(bool)fromCache
|
||||
hasPendingWrites:(bool)hasPendingWrites {
|
||||
return [self initWithFirestore:firestore
|
||||
documentKey:std::move(documentKey)
|
||||
document:document
|
||||
metadata:SnapshotMetadata(hasPendingWrites, fromCache)];
|
||||
}
|
||||
|
||||
// NSObject Methods
|
||||
- (BOOL)isEqual:(nullable id)other {
|
||||
if (other == self) return YES;
|
||||
// self class could be FIRDocumentSnapshot or subtype. So we compare with base type explicitly.
|
||||
if (![other isKindOfClass:[FIRDocumentSnapshot class]]) return NO;
|
||||
|
||||
return _snapshot == static_cast<FIRDocumentSnapshot *>(other)->_snapshot;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return _snapshot.Hash();
|
||||
}
|
||||
|
||||
@dynamic exists;
|
||||
|
||||
- (BOOL)exists {
|
||||
return _snapshot.exists();
|
||||
}
|
||||
|
||||
- (const absl::optional<Document> &)internalDocument {
|
||||
return _snapshot.internal_document();
|
||||
}
|
||||
|
||||
- (FIRDocumentReference *)reference {
|
||||
return [[FIRDocumentReference alloc] initWithReference:_snapshot.CreateReference()];
|
||||
}
|
||||
|
||||
- (NSString *)documentID {
|
||||
return MakeNSString(_snapshot.document_id());
|
||||
}
|
||||
|
||||
@dynamic metadata;
|
||||
|
||||
- (FIRSnapshotMetadata *)metadata {
|
||||
if (!_cachedMetadata) {
|
||||
_cachedMetadata = [[FIRSnapshotMetadata alloc] initWithMetadata:_snapshot.metadata()];
|
||||
}
|
||||
return _cachedMetadata;
|
||||
}
|
||||
|
||||
- (nullable NSDictionary<NSString *, id> *)data {
|
||||
return [self dataWithServerTimestampBehavior:FIRServerTimestampBehaviorNone];
|
||||
}
|
||||
|
||||
- (nullable NSDictionary<NSString *, id> *)dataWithServerTimestampBehavior:
|
||||
(FIRServerTimestampBehavior)serverTimestampBehavior {
|
||||
absl::optional<google_firestore_v1_Value> data = _snapshot.GetValue(FieldPath::EmptyPath());
|
||||
if (!data) return nil;
|
||||
|
||||
FSTUserDataWriter *dataWriter =
|
||||
[[FSTUserDataWriter alloc] initWithFirestore:_snapshot.firestore()
|
||||
serverTimestampBehavior:serverTimestampBehavior];
|
||||
return [dataWriter convertedValue:*data];
|
||||
}
|
||||
|
||||
- (nullable id)valueForField:(id)field {
|
||||
return [self valueForField:field serverTimestampBehavior:FIRServerTimestampBehaviorNone];
|
||||
}
|
||||
|
||||
- (nullable id)valueForField:(id)field
|
||||
serverTimestampBehavior:(FIRServerTimestampBehavior)serverTimestampBehavior {
|
||||
FieldPath fieldPath;
|
||||
if ([field isKindOfClass:[NSString class]]) {
|
||||
fieldPath = FieldPath::FromDotSeparatedString(MakeString(field));
|
||||
} else if ([field isKindOfClass:[FIRFieldPath class]]) {
|
||||
fieldPath = ((FIRFieldPath *)field).internalValue;
|
||||
} else {
|
||||
ThrowInvalidArgument("Subscript key must be an NSString or FIRFieldPath.");
|
||||
}
|
||||
absl::optional<google_firestore_v1_Value> fieldValue = _snapshot.GetValue(fieldPath);
|
||||
if (!fieldValue) return nil;
|
||||
FSTUserDataWriter *dataWriter =
|
||||
[[FSTUserDataWriter alloc] initWithFirestore:_snapshot.firestore()
|
||||
serverTimestampBehavior:serverTimestampBehavior];
|
||||
return [dataWriter convertedValue:*fieldValue];
|
||||
}
|
||||
|
||||
- (nullable id)objectForKeyedSubscript:(id)key {
|
||||
return [self valueForField:key];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRQueryDocumentSnapshot
|
||||
|
||||
- (NSDictionary<NSString *, id> *)data {
|
||||
NSDictionary<NSString *, id> *data = [super data];
|
||||
HARD_ASSERT(data, "Document in a QueryDocumentSnapshot should exist");
|
||||
return data;
|
||||
}
|
||||
|
||||
- (NSDictionary<NSString *, id> *)dataWithServerTimestampBehavior:
|
||||
(FIRServerTimestampBehavior)serverTimestampBehavior {
|
||||
NSDictionary<NSString *, id> *data =
|
||||
[super dataWithServerTimestampBehavior:serverTimestampBehavior];
|
||||
HARD_ASSERT(data, "Document in a QueryDocumentSnapshot should exist");
|
||||
return data;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRFieldPath.h"
|
||||
|
||||
#include "Firestore/core/src/model/model_fwd.h"
|
||||
|
||||
namespace model = firebase::firestore::model;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRFieldPath ()
|
||||
|
||||
/** Internal field path representation */
|
||||
- (const model::FieldPath &)internalValue;
|
||||
|
||||
- (instancetype)initPrivate:(model::FieldPath)path NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
/** Internal FIRFieldPath API we don't want exposed in our public header files. */
|
||||
@interface FIRFieldPath (Internal)
|
||||
|
||||
+ (instancetype)pathWithDotSeparatedString:(NSString *)path;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRFieldPath.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#import "Firestore/Source/API/FIRFieldPath+Internal.h"
|
||||
|
||||
#include "Firestore/core/src/model/field_path.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/hashing.h"
|
||||
#include "Firestore/core/src/util/string_apple.h"
|
||||
|
||||
using firebase::firestore::model::FieldPath;
|
||||
using firebase::firestore::util::Hash;
|
||||
using firebase::firestore::util::MakeString;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRFieldPath () {
|
||||
/** Internal field path representation */
|
||||
firebase::firestore::model::FieldPath _internalValue;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRFieldPath
|
||||
|
||||
- (instancetype)initWithFields:(NSArray<NSString *> *)fieldNames {
|
||||
if (fieldNames.count == 0) {
|
||||
ThrowInvalidArgument("Invalid field path. Provided names must not be empty.");
|
||||
}
|
||||
|
||||
std::vector<std::string> converted;
|
||||
converted.reserve(fieldNames.count);
|
||||
for (NSString *fieldName in fieldNames) {
|
||||
converted.emplace_back(MakeString(fieldName));
|
||||
}
|
||||
|
||||
return [self initPrivate:FieldPath::FromSegments(std::move(converted))];
|
||||
}
|
||||
|
||||
+ (instancetype)documentID {
|
||||
return [[FIRFieldPath alloc] initPrivate:FieldPath::KeyFieldPath()];
|
||||
}
|
||||
|
||||
- (instancetype)initPrivate:(FieldPath)fieldPath {
|
||||
if (self = [super init]) {
|
||||
_internalValue = std::move(fieldPath);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)pathWithDotSeparatedString:(NSString *)path {
|
||||
return [[FIRFieldPath alloc] initPrivate:FieldPath::FromDotSeparatedString(MakeString(path))];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(__unused NSZone *_Nullable)zone {
|
||||
return [[[self class] alloc] initPrivate:_internalValue];
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(nullable id)object {
|
||||
if (self == object) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (![object isKindOfClass:[FIRFieldPath class]]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
return _internalValue == ((FIRFieldPath *)object)->_internalValue;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return Hash(_internalValue);
|
||||
}
|
||||
|
||||
- (const firebase::firestore::model::FieldPath &)internalValue {
|
||||
return _internalValue;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRFieldValue.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRFieldValue (Internal)
|
||||
/**
|
||||
* The method name (e.g. "FieldValue.delete()") that was used to create this FIRFieldValue
|
||||
* instance, for use in error messages, etc.
|
||||
*/
|
||||
@property(nonatomic, strong, readonly) NSString *methodName;
|
||||
@end
|
||||
|
||||
/**
|
||||
* FIRFieldValue class for field deletes. Exposed internally so code can do isKindOfClass checks on
|
||||
* it.
|
||||
*/
|
||||
@interface FSTDeleteFieldValue : FIRFieldValue
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
@end
|
||||
|
||||
/**
|
||||
* FIRFieldValue class for server timestamps. Exposed internally so code can do isKindOfClass checks
|
||||
* on it.
|
||||
*/
|
||||
@interface FSTServerTimestampFieldValue : FIRFieldValue
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
@end
|
||||
|
||||
/** FIRFieldValue class for array unions. */
|
||||
@interface FSTArrayUnionFieldValue : FIRFieldValue
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
@property(strong, nonatomic, readonly) NSArray<id> *elements;
|
||||
@end
|
||||
|
||||
/** FIRFieldValue class for array removes. */
|
||||
@interface FSTArrayRemoveFieldValue : FIRFieldValue
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
@property(strong, nonatomic, readonly) NSArray<id> *elements;
|
||||
@end
|
||||
|
||||
/** FIRFieldValue class for number increments. */
|
||||
@interface FSTNumericIncrementFieldValue : FIRFieldValue
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
@property(strong, nonatomic, readonly) NSNumber *operand;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FIRFieldValue+Internal.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRFieldValue ()
|
||||
- (instancetype)initPrivate NS_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
#pragma mark - FSTDeleteFieldValue
|
||||
|
||||
@interface FSTDeleteFieldValue ()
|
||||
/** Returns a single shared instance of the class. */
|
||||
+ (instancetype)deleteFieldValue;
|
||||
@end
|
||||
|
||||
@implementation FSTDeleteFieldValue
|
||||
|
||||
- (instancetype)initPrivate {
|
||||
self = [super initPrivate];
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)deleteFieldValue {
|
||||
static FSTDeleteFieldValue *sharedInstance = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [[FSTDeleteFieldValue alloc] initPrivate];
|
||||
});
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (NSString *)methodName {
|
||||
return @"FieldValue.delete()";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - FSTServerTimestampFieldValue
|
||||
|
||||
@interface FSTServerTimestampFieldValue ()
|
||||
/** Returns a single shared instance of the class. */
|
||||
+ (instancetype)serverTimestampFieldValue;
|
||||
@end
|
||||
|
||||
@implementation FSTServerTimestampFieldValue
|
||||
|
||||
- (instancetype)initPrivate {
|
||||
self = [super initPrivate];
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)serverTimestampFieldValue {
|
||||
static FSTServerTimestampFieldValue *sharedInstance = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [[FSTServerTimestampFieldValue alloc] initPrivate];
|
||||
});
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (NSString *)methodName {
|
||||
return @"FieldValue.serverTimestamp()";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - FSTArrayUnionFieldValue
|
||||
|
||||
@interface FSTArrayUnionFieldValue ()
|
||||
- (instancetype)initWithElements:(NSArray<id> *)elements;
|
||||
@end
|
||||
|
||||
@implementation FSTArrayUnionFieldValue
|
||||
- (instancetype)initWithElements:(NSArray<id> *)elements {
|
||||
if (self = [super initPrivate]) {
|
||||
_elements = elements;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)methodName {
|
||||
return @"FieldValue.arrayUnion()";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - FSTArrayRemoveFieldValue
|
||||
|
||||
@interface FSTArrayRemoveFieldValue ()
|
||||
- (instancetype)initWithElements:(NSArray<id> *)elements;
|
||||
@end
|
||||
|
||||
@implementation FSTArrayRemoveFieldValue
|
||||
- (instancetype)initWithElements:(NSArray<id> *)elements {
|
||||
if (self = [super initPrivate]) {
|
||||
_elements = elements;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)methodName {
|
||||
return @"FieldValue.arrayRemove()";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - FSTNumericIncrementFieldValue
|
||||
|
||||
/* FieldValue class for increment() transforms. */
|
||||
@interface FSTNumericIncrementFieldValue ()
|
||||
- (instancetype)initWithOperand:(NSNumber *)operand;
|
||||
@end
|
||||
|
||||
@implementation FSTNumericIncrementFieldValue
|
||||
- (instancetype)initWithOperand:(NSNumber *)operand {
|
||||
if (self = [super initPrivate]) {
|
||||
_operand = operand;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)methodName {
|
||||
return @"FieldValue.increment()";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - FIRFieldValue
|
||||
|
||||
@implementation FIRFieldValue
|
||||
|
||||
- (instancetype)initPrivate {
|
||||
self = [super init];
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)fieldValueForDelete {
|
||||
return [FSTDeleteFieldValue deleteFieldValue];
|
||||
}
|
||||
|
||||
+ (instancetype)fieldValueForServerTimestamp {
|
||||
return [FSTServerTimestampFieldValue serverTimestampFieldValue];
|
||||
}
|
||||
|
||||
+ (instancetype)fieldValueForArrayUnion:(NSArray<id> *)elements {
|
||||
return [[FSTArrayUnionFieldValue alloc] initWithElements:elements];
|
||||
}
|
||||
|
||||
+ (instancetype)fieldValueForArrayRemove:(NSArray<id> *)elements {
|
||||
return [[FSTArrayRemoveFieldValue alloc] initWithElements:elements];
|
||||
}
|
||||
|
||||
+ (instancetype)fieldValueForDoubleIncrement:(double)d {
|
||||
return [[FSTNumericIncrementFieldValue alloc] initWithOperand:@(d)];
|
||||
}
|
||||
|
||||
+ (instancetype)fieldValueForIntegerIncrement:(int64_t)l {
|
||||
return [[FSTNumericIncrementFieldValue alloc] initWithOperand:@(l)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRFirestore.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "Firestore/core/src/api/firestore.h"
|
||||
#include "Firestore/core/src/credentials/credentials_provider.h"
|
||||
#include "Firestore/core/src/util/async_queue.h"
|
||||
|
||||
@class FIRApp;
|
||||
@class FSTFirestoreClient;
|
||||
@class FSTUserDataReader;
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
namespace remote {
|
||||
class FirebaseMetadataProvider;
|
||||
} // namespace remote
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
namespace credentials = firebase::firestore::credentials;
|
||||
namespace model = firebase::firestore::model;
|
||||
namespace remote = firebase::firestore::remote;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Provides a registry management interface for FIRFirestore instances. */
|
||||
@protocol FSTFirestoreInstanceRegistry
|
||||
|
||||
/** Removes the FIRFirestore instance with given database name from registry. */
|
||||
- (void)removeInstanceWithDatabase:(NSString *)database;
|
||||
|
||||
@end
|
||||
|
||||
@interface FIRFirestore (/* Init */)
|
||||
|
||||
/**
|
||||
* Initializes a Firestore object with all the required parameters directly. This exists so that
|
||||
* tests can create FIRFirestore objects without needing FIRApp.
|
||||
*/
|
||||
- (instancetype)initWithDatabaseID:(model::DatabaseId)databaseID
|
||||
persistenceKey:(std::string)persistenceKey
|
||||
authCredentialsProvider:
|
||||
(std::shared_ptr<credentials::AuthCredentialsProvider>)authCredentialsProvider
|
||||
appCheckCredentialsProvider:
|
||||
(std::shared_ptr<credentials::AppCheckCredentialsProvider>)appCheckCredentialsProvider
|
||||
workerQueue:
|
||||
(std::shared_ptr<firebase::firestore::util::AsyncQueue>)workerQueue
|
||||
firebaseMetadataProvider:
|
||||
(std::unique_ptr<remote::FirebaseMetadataProvider>)firebaseMetadataProvider
|
||||
firebaseApp:(FIRApp *)app
|
||||
instanceRegistry:(nullable id<FSTFirestoreInstanceRegistry>)registry;
|
||||
@end
|
||||
|
||||
/** Internal FIRFirestore API we don't want exposed in our public header files. */
|
||||
@interface FIRFirestore (Internal)
|
||||
|
||||
+ (FIRFirestore *)recoverFromFirestore:(std::shared_ptr<api::Firestore>)firestore;
|
||||
|
||||
- (void)terminateInternalWithCompletion:(nullable void (^)(NSError *_Nullable error))completion;
|
||||
|
||||
- (const std::shared_ptr<firebase::firestore::util::AsyncQueue> &)workerQueue;
|
||||
|
||||
@property(nonatomic, assign, readonly) std::shared_ptr<api::Firestore> wrapped;
|
||||
|
||||
@property(nonatomic, assign, readonly) const model::DatabaseId &databaseID;
|
||||
@property(nonatomic, strong, readonly) FSTUserDataReader *dataReader;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,495 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRFirestore+Internal.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#import "FIRFirestoreSettings+Internal.h"
|
||||
|
||||
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
|
||||
#import "Firestore/Source/API/FIRCollectionReference+Internal.h"
|
||||
#import "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#import "Firestore/Source/API/FIRListenerRegistration+Internal.h"
|
||||
#import "Firestore/Source/API/FIRLoadBundleTask+Internal.h"
|
||||
#import "Firestore/Source/API/FIRQuery+Internal.h"
|
||||
#import "Firestore/Source/API/FIRTransaction+Internal.h"
|
||||
#import "Firestore/Source/API/FIRWriteBatch+Internal.h"
|
||||
#import "Firestore/Source/API/FSTFirestoreComponent.h"
|
||||
#import "Firestore/Source/API/FSTUserDataReader.h"
|
||||
|
||||
#include "Firestore/core/src/api/collection_reference.h"
|
||||
#include "Firestore/core/src/api/document_reference.h"
|
||||
#include "Firestore/core/src/api/firestore.h"
|
||||
#include "Firestore/core/src/api/write_batch.h"
|
||||
#include "Firestore/core/src/core/database_info.h"
|
||||
#include "Firestore/core/src/core/event_listener.h"
|
||||
#include "Firestore/core/src/core/transaction.h"
|
||||
#include "Firestore/core/src/credentials/credentials_provider.h"
|
||||
#include "Firestore/core/src/model/database_id.h"
|
||||
#include "Firestore/core/src/remote/firebase_metadata_provider.h"
|
||||
#include "Firestore/core/src/util/async_queue.h"
|
||||
#include "Firestore/core/src/util/byte_stream_apple.h"
|
||||
#include "Firestore/core/src/util/config.h"
|
||||
#include "Firestore/core/src/util/empty.h"
|
||||
#include "Firestore/core/src/util/error_apple.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/exception_apple.h"
|
||||
#include "Firestore/core/src/util/executor_libdispatch.h"
|
||||
#include "Firestore/core/src/util/hard_assert.h"
|
||||
#include "Firestore/core/src/util/log.h"
|
||||
#include "Firestore/core/src/util/status.h"
|
||||
#include "Firestore/core/src/util/statusor.h"
|
||||
#include "Firestore/core/src/util/string_apple.h"
|
||||
#include "absl/memory/memory.h"
|
||||
|
||||
using firebase::firestore::api::DocumentReference;
|
||||
using firebase::firestore::api::Firestore;
|
||||
using firebase::firestore::api::ListenerRegistration;
|
||||
using firebase::firestore::core::EventListener;
|
||||
using firebase::firestore::credentials::AuthCredentialsProvider;
|
||||
using firebase::firestore::model::DatabaseId;
|
||||
using firebase::firestore::remote::FirebaseMetadataProvider;
|
||||
using firebase::firestore::util::AsyncQueue;
|
||||
using firebase::firestore::util::ByteStreamApple;
|
||||
using firebase::firestore::util::Empty;
|
||||
using firebase::firestore::util::Executor;
|
||||
using firebase::firestore::util::ExecutorLibdispatch;
|
||||
using firebase::firestore::util::LogSetLevel;
|
||||
using firebase::firestore::util::MakeCallback;
|
||||
using firebase::firestore::util::MakeNSError;
|
||||
using firebase::firestore::util::MakeNSString;
|
||||
using firebase::firestore::util::MakeString;
|
||||
using firebase::firestore::util::ObjcThrowHandler;
|
||||
using firebase::firestore::util::SetThrowHandler;
|
||||
using firebase::firestore::util::Status;
|
||||
using firebase::firestore::util::StatusOr;
|
||||
using firebase::firestore::util::ThrowIllegalState;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
using firebase::firestore::util::kLogLevelDebug;
|
||||
using firebase::firestore::util::kLogLevelNotice;
|
||||
|
||||
using UserUpdateBlock = id _Nullable (^)(FIRTransaction *, NSError **);
|
||||
using UserTransactionCompletion = void (^)(id _Nullable, NSError *_Nullable);
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - FIRFirestore
|
||||
|
||||
@interface FIRFirestore ()
|
||||
|
||||
@property(nonatomic, strong, readonly) FSTUserDataReader *dataReader;
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRFirestore {
|
||||
std::shared_ptr<Firestore> _firestore;
|
||||
FIRFirestoreSettings *_settings;
|
||||
__weak id<FSTFirestoreInstanceRegistry> _registry;
|
||||
}
|
||||
|
||||
+ (void)initialize {
|
||||
if (self == [FIRFirestore class]) {
|
||||
SetThrowHandler(ObjcThrowHandler);
|
||||
Firestore::SetClientLanguage("gl-objc/");
|
||||
}
|
||||
}
|
||||
|
||||
+ (instancetype)firestore {
|
||||
FIRApp *app = [FIRApp defaultApp];
|
||||
if (!app) {
|
||||
ThrowIllegalState("Failed to get FirebaseApp instance. Please call FirebaseApp.configure() "
|
||||
"before using Firestore");
|
||||
}
|
||||
return [self firestoreForApp:app database:MakeNSString(DatabaseId::kDefault)];
|
||||
}
|
||||
|
||||
+ (instancetype)firestoreForApp:(FIRApp *)app {
|
||||
return [self firestoreForApp:app database:MakeNSString(DatabaseId::kDefault)];
|
||||
}
|
||||
|
||||
// TODO(b/62410906): make this public
|
||||
+ (instancetype)firestoreForApp:(FIRApp *)app database:(NSString *)database {
|
||||
if (!app) {
|
||||
ThrowInvalidArgument("FirebaseApp instance may not be nil. Use FirebaseApp.app() if you'd like "
|
||||
"to use the default FirebaseApp instance.");
|
||||
}
|
||||
if (!database) {
|
||||
ThrowInvalidArgument("Database identifier may not be nil. Use '%s' if you want the default "
|
||||
"database",
|
||||
DatabaseId::kDefault);
|
||||
}
|
||||
|
||||
id<FSTFirestoreMultiDBProvider> provider =
|
||||
FIR_COMPONENT(FSTFirestoreMultiDBProvider, app.container);
|
||||
return [provider firestoreForDatabase:database];
|
||||
}
|
||||
|
||||
- (instancetype)initWithDatabaseID:(model::DatabaseId)databaseID
|
||||
persistenceKey:(std::string)persistenceKey
|
||||
authCredentialsProvider:
|
||||
(std::shared_ptr<credentials::AuthCredentialsProvider>)authCredentialsProvider
|
||||
appCheckCredentialsProvider:
|
||||
(std::shared_ptr<credentials::AppCheckCredentialsProvider>)appCheckCredentialsProvider
|
||||
workerQueue:(std::shared_ptr<AsyncQueue>)workerQueue
|
||||
firebaseMetadataProvider:
|
||||
(std::unique_ptr<FirebaseMetadataProvider>)firebaseMetadataProvider
|
||||
firebaseApp:(FIRApp *)app
|
||||
instanceRegistry:(nullable id<FSTFirestoreInstanceRegistry>)registry {
|
||||
if (self = [super init]) {
|
||||
_firestore = std::make_shared<Firestore>(
|
||||
std::move(databaseID), std::move(persistenceKey), std::move(authCredentialsProvider),
|
||||
std::move(appCheckCredentialsProvider), std::move(workerQueue),
|
||||
std::move(firebaseMetadataProvider), (__bridge void *)self);
|
||||
|
||||
_app = app;
|
||||
_registry = registry;
|
||||
|
||||
FSTPreConverterBlock block = ^id _Nullable(id _Nullable input) {
|
||||
if ([input isKindOfClass:[FIRDocumentReference class]]) {
|
||||
auto documentReference = (FIRDocumentReference *)input;
|
||||
return [[FSTDocumentKeyReference alloc] initWithKey:documentReference.key
|
||||
databaseID:documentReference.firestore.databaseID];
|
||||
} else {
|
||||
return input;
|
||||
}
|
||||
};
|
||||
|
||||
_dataReader = [[FSTUserDataReader alloc] initWithDatabaseID:_firestore->database_id()
|
||||
preConverter:block];
|
||||
// Use the property setter so the default settings get plumbed into _firestoreClient.
|
||||
self.settings = [[FIRFirestoreSettings alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRFirestoreSettings *)settings {
|
||||
// Disallow mutation of our internal settings
|
||||
return [_settings copy];
|
||||
}
|
||||
|
||||
- (void)setSettings:(FIRFirestoreSettings *)settings {
|
||||
if (![settings isEqual:_settings]) {
|
||||
_settings = settings;
|
||||
_firestore->set_settings([settings internalSettings]);
|
||||
|
||||
#if HAVE_LIBDISPATCH
|
||||
std::unique_ptr<Executor> user_executor =
|
||||
absl::make_unique<ExecutorLibdispatch>(settings.dispatchQueue);
|
||||
#else
|
||||
// It's possible to build without libdispatch on macOS for testing purposes.
|
||||
// In this case, avoid breaking the build.
|
||||
std::unique_ptr<Executor> user_executor =
|
||||
Executor::CreateSerial("com.google.firebase.firestore.user");
|
||||
#endif // HAVE_LIBDISPATCH
|
||||
|
||||
_firestore->set_user_executor(std::move(user_executor));
|
||||
}
|
||||
}
|
||||
|
||||
- (FIRCollectionReference *)collectionWithPath:(NSString *)collectionPath {
|
||||
if (!collectionPath) {
|
||||
ThrowInvalidArgument("Collection path cannot be nil.");
|
||||
}
|
||||
if (!collectionPath.length) {
|
||||
ThrowInvalidArgument("Collection path cannot be empty.");
|
||||
}
|
||||
if ([collectionPath containsString:@"//"]) {
|
||||
ThrowInvalidArgument("Invalid path (%s). Paths must not contain // in them.", collectionPath);
|
||||
}
|
||||
|
||||
return [[FIRCollectionReference alloc]
|
||||
initWithReference:_firestore->GetCollection(MakeString(collectionPath))];
|
||||
}
|
||||
|
||||
- (FIRDocumentReference *)documentWithPath:(NSString *)documentPath {
|
||||
if (!documentPath) {
|
||||
ThrowInvalidArgument("Document path cannot be nil.");
|
||||
}
|
||||
if (!documentPath.length) {
|
||||
ThrowInvalidArgument("Document path cannot be empty.");
|
||||
}
|
||||
if ([documentPath containsString:@"//"]) {
|
||||
ThrowInvalidArgument("Invalid path (%s). Paths must not contain // in them.", documentPath);
|
||||
}
|
||||
|
||||
DocumentReference documentReference = _firestore->GetDocument(MakeString(documentPath));
|
||||
return [[FIRDocumentReference alloc] initWithReference:std::move(documentReference)];
|
||||
}
|
||||
|
||||
- (FIRQuery *)collectionGroupWithID:(NSString *)collectionID {
|
||||
if (!collectionID) {
|
||||
ThrowInvalidArgument("Collection ID cannot be nil.");
|
||||
}
|
||||
if (!collectionID.length) {
|
||||
ThrowInvalidArgument("Collection ID cannot be empty.");
|
||||
}
|
||||
if ([collectionID containsString:@"/"]) {
|
||||
ThrowInvalidArgument("Invalid collection ID (%s). Collection IDs must not contain / in them.",
|
||||
collectionID);
|
||||
}
|
||||
|
||||
auto query = _firestore->GetCollectionGroup(MakeString(collectionID));
|
||||
return [[FIRQuery alloc] initWithQuery:std::move(query) firestore:_firestore];
|
||||
}
|
||||
|
||||
- (FIRWriteBatch *)batch {
|
||||
return [FIRWriteBatch writeBatchWithDataReader:self.dataReader writeBatch:_firestore->GetBatch()];
|
||||
}
|
||||
|
||||
- (void)runTransactionWithBlock:(UserUpdateBlock)updateBlock
|
||||
dispatchQueue:(dispatch_queue_t)queue
|
||||
completion:(UserTransactionCompletion)completion {
|
||||
if (!updateBlock) {
|
||||
ThrowInvalidArgument("Transaction block cannot be nil.");
|
||||
}
|
||||
if (!completion) {
|
||||
ThrowInvalidArgument("Transaction completion block cannot be nil.");
|
||||
}
|
||||
|
||||
class TransactionResult {
|
||||
public:
|
||||
TransactionResult(FIRFirestore *firestore,
|
||||
UserUpdateBlock update_block,
|
||||
dispatch_queue_t queue,
|
||||
UserTransactionCompletion completion)
|
||||
: firestore_(firestore),
|
||||
user_update_block_(update_block),
|
||||
queue_(queue),
|
||||
user_completion_(completion) {
|
||||
}
|
||||
|
||||
void RunUpdateBlock(std::shared_ptr<core::Transaction> internalTransaction,
|
||||
core::TransactionResultCallback internalCallback) {
|
||||
dispatch_async(queue_, ^{
|
||||
auto transaction = [FIRTransaction transactionWithInternalTransaction:internalTransaction
|
||||
firestore:firestore_];
|
||||
|
||||
NSError *_Nullable error = nil;
|
||||
user_result_ = user_update_block_(transaction, &error);
|
||||
|
||||
// If the user set an error, disregard the result.
|
||||
if (error) {
|
||||
// If the error is a user error, set flag to not retry the transaction.
|
||||
if (error.domain != FIRFirestoreErrorDomain) {
|
||||
internalTransaction->MarkPermanentlyFailed();
|
||||
}
|
||||
internalCallback(Status::FromNSError(error));
|
||||
} else {
|
||||
internalCallback(Status::OK());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void HandleFinalStatus(const Status &status) {
|
||||
if (!status.ok()) {
|
||||
user_completion_(nil, MakeNSError(status));
|
||||
return;
|
||||
}
|
||||
|
||||
user_completion_(user_result_, nil);
|
||||
}
|
||||
|
||||
private:
|
||||
FIRFirestore *firestore_;
|
||||
UserUpdateBlock user_update_block_;
|
||||
dispatch_queue_t queue_;
|
||||
UserTransactionCompletion user_completion_;
|
||||
|
||||
id _Nullable user_result_;
|
||||
};
|
||||
|
||||
auto result_capture = std::make_shared<TransactionResult>(self, updateBlock, queue, completion);
|
||||
|
||||
// Wrap the user-supplied updateBlock in a core C++ compatible callback. Wrap the result of the
|
||||
// updateBlock invocation up in a TransactionResult for tunneling through the internals of the
|
||||
// system.
|
||||
auto internalUpdateBlock = [result_capture](
|
||||
std::shared_ptr<core::Transaction> internalTransaction,
|
||||
core::TransactionResultCallback internalCallback) {
|
||||
result_capture->RunUpdateBlock(internalTransaction, internalCallback);
|
||||
};
|
||||
|
||||
// Unpacks the TransactionResult value and calls the user completion handler.
|
||||
//
|
||||
// PORTING NOTE: Other platforms where the user return value is internally representable don't
|
||||
// need this wrapper.
|
||||
auto objcTranslator = [result_capture](const Status &status) {
|
||||
result_capture->HandleFinalStatus(status);
|
||||
};
|
||||
|
||||
_firestore->RunTransaction(std::move(internalUpdateBlock), std::move(objcTranslator));
|
||||
}
|
||||
|
||||
- (void)runTransactionWithBlock:(id _Nullable (^)(FIRTransaction *, NSError **error))updateBlock
|
||||
completion:
|
||||
(void (^)(id _Nullable result, NSError *_Nullable error))completion {
|
||||
static dispatch_queue_t transactionDispatchQueue;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
transactionDispatchQueue = dispatch_queue_create("com.google.firebase.firestore.transaction",
|
||||
DISPATCH_QUEUE_CONCURRENT);
|
||||
});
|
||||
[self runTransactionWithBlock:updateBlock
|
||||
dispatchQueue:transactionDispatchQueue
|
||||
completion:completion];
|
||||
}
|
||||
|
||||
+ (void)enableLogging:(BOOL)logging {
|
||||
LogSetLevel(logging ? kLogLevelDebug : kLogLevelNotice);
|
||||
}
|
||||
|
||||
- (void)useEmulatorWithHost:(NSString *)host port:(NSInteger)port {
|
||||
if (!host.length) {
|
||||
ThrowInvalidArgument("Host cannot be nil or empty.");
|
||||
}
|
||||
if (!_settings.isUsingDefaultHost) {
|
||||
LOG_WARN("Overriding previously-set host value: %@", _settings.host);
|
||||
}
|
||||
// Use a new settings so the new settings are automatically plumbed
|
||||
// to the underlying Firestore objects.
|
||||
NSString *settingsHost = [NSString stringWithFormat:@"%@:%li", host, (long)port];
|
||||
FIRFirestoreSettings *newSettings = [_settings copy];
|
||||
newSettings.host = settingsHost;
|
||||
self.settings = newSettings;
|
||||
}
|
||||
|
||||
- (void)enableNetworkWithCompletion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
_firestore->EnableNetwork(MakeCallback(completion));
|
||||
}
|
||||
|
||||
- (void)disableNetworkWithCompletion:(nullable void (^)(NSError *_Nullable))completion {
|
||||
_firestore->DisableNetwork(MakeCallback(completion));
|
||||
}
|
||||
|
||||
- (void)clearPersistenceWithCompletion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
_firestore->ClearPersistence(MakeCallback(completion));
|
||||
}
|
||||
|
||||
- (void)waitForPendingWritesWithCompletion:(void (^)(NSError *_Nullable error))completion {
|
||||
_firestore->WaitForPendingWrites(MakeCallback(completion));
|
||||
}
|
||||
|
||||
- (void)terminateWithCompletion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
id<FSTFirestoreInstanceRegistry> strongRegistry = _registry;
|
||||
if (strongRegistry) {
|
||||
[strongRegistry
|
||||
removeInstanceWithDatabase:MakeNSString(_firestore->database_id().database_id())];
|
||||
}
|
||||
[self terminateInternalWithCompletion:completion];
|
||||
}
|
||||
|
||||
- (id<FIRListenerRegistration>)addSnapshotsInSyncListener:(void (^)(void))listener {
|
||||
std::unique_ptr<core::EventListener<Empty>> eventListener =
|
||||
core::EventListener<Empty>::Create([listener](const StatusOr<Empty> &) { listener(); });
|
||||
std::unique_ptr<ListenerRegistration> result =
|
||||
_firestore->AddSnapshotsInSyncListener(std::move(eventListener));
|
||||
return [[FSTListenerRegistration alloc] initWithRegistration:std::move(result)];
|
||||
}
|
||||
|
||||
- (FIRLoadBundleTask *)loadBundle:(nonnull NSData *)bundleData {
|
||||
auto stream = absl::make_unique<ByteStreamApple>([[NSInputStream alloc] initWithData:bundleData]);
|
||||
return [self loadBundleStream:[[NSInputStream alloc] initWithData:bundleData] completion:nil];
|
||||
}
|
||||
|
||||
- (FIRLoadBundleTask *)loadBundle:(NSData *)bundleData
|
||||
completion:(nullable void (^)(FIRLoadBundleTaskProgress *_Nullable progress,
|
||||
NSError *_Nullable error))completion {
|
||||
return [self loadBundleStream:[[NSInputStream alloc] initWithData:bundleData]
|
||||
completion:completion];
|
||||
}
|
||||
|
||||
- (FIRLoadBundleTask *)loadBundleStream:(NSInputStream *)bundleStream {
|
||||
return [self loadBundleStream:bundleStream completion:nil];
|
||||
}
|
||||
|
||||
- (FIRLoadBundleTask *)loadBundleStream:(NSInputStream *)bundleStream
|
||||
completion:
|
||||
(nullable void (^)(FIRLoadBundleTaskProgress *_Nullable progress,
|
||||
NSError *_Nullable error))completion {
|
||||
auto stream = absl::make_unique<ByteStreamApple>(bundleStream);
|
||||
std::shared_ptr<api::LoadBundleTask> task = _firestore->LoadBundle(std::move(stream));
|
||||
auto callback = [completion](api::LoadBundleTaskProgress progress) {
|
||||
if (!completion) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignoring `kInProgress` because we are setting up for completion callback.
|
||||
if (progress.state() == api::LoadBundleTaskState::kSuccess) {
|
||||
completion([[FIRLoadBundleTaskProgress alloc] initWithInternal:progress], nil);
|
||||
} else if (progress.state() == api::LoadBundleTaskState::kError) {
|
||||
NSError *error = nil;
|
||||
if (!progress.error_status().ok()) {
|
||||
LOG_WARN("Progress set to Error, but error_status() is ok()");
|
||||
error = MakeNSError(firebase::firestore::Error::kErrorUnknown,
|
||||
"Loading bundle failed with unknown error");
|
||||
} else {
|
||||
error = MakeNSError(progress.error_status());
|
||||
}
|
||||
completion([[FIRLoadBundleTaskProgress alloc] initWithInternal:progress], error);
|
||||
}
|
||||
};
|
||||
|
||||
task->SetLastObserver(callback);
|
||||
return [[FIRLoadBundleTask alloc] initWithTask:task];
|
||||
}
|
||||
|
||||
- (void)getQueryNamed:(NSString *)name completion:(void (^)(FIRQuery *_Nullable query))completion {
|
||||
auto firestore = _firestore;
|
||||
auto callback = [completion, firestore](core::Query query, bool found) {
|
||||
if (!completion) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
FIRQuery *firQuery = [[FIRQuery alloc] initWithQuery:std::move(query) firestore:firestore];
|
||||
completion(firQuery);
|
||||
} else {
|
||||
completion(nil);
|
||||
}
|
||||
};
|
||||
_firestore->GetNamedQuery(MakeString(name), callback);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRFirestore (Internal)
|
||||
|
||||
- (std::shared_ptr<Firestore>)wrapped {
|
||||
return _firestore;
|
||||
}
|
||||
|
||||
- (const std::shared_ptr<AsyncQueue> &)workerQueue {
|
||||
return _firestore->worker_queue();
|
||||
}
|
||||
|
||||
- (const DatabaseId &)databaseID {
|
||||
return _firestore->database_id();
|
||||
}
|
||||
|
||||
+ (FIRFirestore *)recoverFromFirestore:(std::shared_ptr<Firestore>)firestore {
|
||||
return (__bridge FIRFirestore *)firestore->extension();
|
||||
}
|
||||
|
||||
- (void)terminateInternalWithCompletion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
_firestore->Terminate(MakeCallback(completion));
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2019 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRFirestoreSettings.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "Firestore/core/src/api/settings.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRFirestoreSettings (Internal)
|
||||
|
||||
/** Returns whether or not the host has been set to a non-default value. */
|
||||
@property(nonatomic, readonly) BOOL isUsingDefaultHost;
|
||||
|
||||
/** Converts this FIRFirestoreSettings instance into an api::Settings object. */
|
||||
- (firebase::firestore::api::Settings)internalSettings;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright 2017 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRFirestoreSettings.h"
|
||||
|
||||
#include "Firestore/core/src/api/settings.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/string_apple.h"
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/memory/memory.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
using api::Settings;
|
||||
using firebase::firestore::util::MakeString;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
|
||||
// Public constant
|
||||
ABSL_CONST_INIT extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =
|
||||
Settings::CacheSizeUnlimited;
|
||||
|
||||
@implementation FIRFirestoreSettings
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
_host = [NSString stringWithUTF8String:Settings::DefaultHost];
|
||||
_sslEnabled = Settings::DefaultSslEnabled;
|
||||
_dispatchQueue = dispatch_get_main_queue();
|
||||
_persistenceEnabled = Settings::DefaultPersistenceEnabled;
|
||||
_cacheSizeBytes = Settings::DefaultCacheSizeBytes;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)other {
|
||||
if (self == other) {
|
||||
return YES;
|
||||
} else if (![other isKindOfClass:[FIRFirestoreSettings class]]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
FIRFirestoreSettings *otherSettings = (FIRFirestoreSettings *)other;
|
||||
return [self.host isEqual:otherSettings.host] &&
|
||||
self.isSSLEnabled == otherSettings.isSSLEnabled &&
|
||||
self.dispatchQueue == otherSettings.dispatchQueue &&
|
||||
self.isPersistenceEnabled == otherSettings.isPersistenceEnabled &&
|
||||
self.cacheSizeBytes == otherSettings.cacheSizeBytes;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
NSUInteger result = [self.host hash];
|
||||
result = 31 * result + (self.isSSLEnabled ? 1231 : 1237);
|
||||
// Ignore the dispatchQueue to avoid having to deal with sizeof(dispatch_queue_t).
|
||||
result = 31 * result + (self.isPersistenceEnabled ? 1231 : 1237);
|
||||
result = 31 * result + (NSUInteger)self.cacheSizeBytes;
|
||||
return result;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(__unused NSZone *_Nullable)zone {
|
||||
FIRFirestoreSettings *copy = [[FIRFirestoreSettings alloc] init];
|
||||
copy.host = _host;
|
||||
copy.sslEnabled = _sslEnabled;
|
||||
copy.dispatchQueue = _dispatchQueue;
|
||||
copy.persistenceEnabled = _persistenceEnabled;
|
||||
copy.cacheSizeBytes = _cacheSizeBytes;
|
||||
return copy;
|
||||
}
|
||||
|
||||
- (void)setHost:(NSString *)host {
|
||||
if (!host) {
|
||||
ThrowInvalidArgument("Host setting may not be nil. You should generally just use the default "
|
||||
"value (which is %s)",
|
||||
Settings::DefaultHost);
|
||||
}
|
||||
_host = [host mutableCopy];
|
||||
}
|
||||
|
||||
- (void)setDispatchQueue:(dispatch_queue_t)dispatchQueue {
|
||||
if (!dispatchQueue) {
|
||||
ThrowInvalidArgument(
|
||||
"Dispatch queue setting may not be nil. Create a new dispatch queue with "
|
||||
"dispatch_queue_create(\"com.example.MyQueue\", NULL) or just use the default (which is "
|
||||
"the main queue, returned from dispatch_get_main_queue())");
|
||||
}
|
||||
_dispatchQueue = dispatchQueue;
|
||||
}
|
||||
|
||||
- (void)setCacheSizeBytes:(int64_t)cacheSizeBytes {
|
||||
if (cacheSizeBytes != kFIRFirestoreCacheSizeUnlimited &&
|
||||
cacheSizeBytes < Settings::MinimumCacheSizeBytes) {
|
||||
ThrowInvalidArgument("Cache size must be set to at least %s bytes",
|
||||
Settings::MinimumCacheSizeBytes);
|
||||
}
|
||||
_cacheSizeBytes = cacheSizeBytes;
|
||||
}
|
||||
|
||||
- (BOOL)isUsingDefaultHost {
|
||||
NSString *defaultHost = [NSString stringWithUTF8String:Settings::DefaultHost];
|
||||
return [self.host isEqualToString:defaultHost];
|
||||
}
|
||||
|
||||
- (Settings)internalSettings {
|
||||
Settings settings;
|
||||
settings.set_host(MakeString(_host));
|
||||
settings.set_ssl_enabled(_sslEnabled);
|
||||
settings.set_persistence_enabled(_persistenceEnabled);
|
||||
settings.set_cache_size_bytes(_cacheSizeBytes);
|
||||
return settings;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2019 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRFirestoreSource.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
namespace api {
|
||||
|
||||
enum class Source;
|
||||
|
||||
Source MakeSource(FIRFirestoreSource source);
|
||||
|
||||
} // namespace api
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2019 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FIRFirestoreSource+Internal.h"
|
||||
|
||||
#include "Firestore/core/src/api/source.h"
|
||||
#include "Firestore/core/src/util/hard_assert.h"
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
namespace api {
|
||||
|
||||
Source MakeSource(FIRFirestoreSource source) {
|
||||
switch (source) {
|
||||
case FIRFirestoreSourceDefault:
|
||||
return Source::Default;
|
||||
case FIRFirestoreSourceServer:
|
||||
return Source::Server;
|
||||
case FIRFirestoreSourceCache:
|
||||
return Source::Cache;
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** Version for Firestore. */
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/** Version string for the Firebase Firestore SDK. */
|
||||
FOUNDATION_EXPORT const char *const FIRFirestoreVersionString;
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FIRFirestoreVersion.h"
|
||||
|
||||
#include "Firestore/core/include/firebase/firestore/firestore_version.h"
|
||||
|
||||
using firebase::firestore::kFirestoreVersionString;
|
||||
|
||||
// Because `kFirestoreVersionString` is subject to constant initialization, this
|
||||
// is not affected by static initialization order fiasco.
|
||||
extern "C" const char *const FIRFirestoreVersionString = kFirestoreVersionString;
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRGeoPoint.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Internal FIRGeoPoint API we don't want exposed in our public header files. */
|
||||
@interface FIRGeoPoint (Internal)
|
||||
|
||||
- (NSComparisonResult)compare:(FIRGeoPoint *)other;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FIRGeoPoint+Internal.h"
|
||||
|
||||
#include "Firestore/core/include/firebase/firestore/geo_point.h"
|
||||
#include "Firestore/core/src/util/comparison.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
using firebase::firestore::util::DoubleBitwiseEquals;
|
||||
using firebase::firestore::util::DoubleBitwiseHash;
|
||||
using firebase::firestore::util::WrapCompare;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation FIRGeoPoint
|
||||
|
||||
- (instancetype)initWithLatitude:(double)latitude longitude:(double)longitude {
|
||||
if (self = [super init]) {
|
||||
if (latitude < -90 || latitude > 90 || !isfinite(latitude)) {
|
||||
ThrowInvalidArgument("GeoPoint requires a latitude value in the range of [-90, 90], "
|
||||
"but was %s",
|
||||
latitude);
|
||||
}
|
||||
if (longitude < -180 || longitude > 180 || !isfinite(longitude)) {
|
||||
ThrowInvalidArgument("GeoPoint requires a longitude value in the range of [-180, 180], "
|
||||
"but was %s",
|
||||
longitude);
|
||||
}
|
||||
|
||||
_latitude = latitude;
|
||||
_longitude = longitude;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - NSObject methods
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"<FIRGeoPoint: (%f, %f)>", self.latitude, self.longitude];
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)other {
|
||||
if (self == other) {
|
||||
return YES;
|
||||
}
|
||||
if (![other isKindOfClass:[FIRGeoPoint class]]) {
|
||||
return NO;
|
||||
}
|
||||
FIRGeoPoint *otherGeoPoint = (FIRGeoPoint *)other;
|
||||
return DoubleBitwiseEquals(self.latitude, otherGeoPoint.latitude) &&
|
||||
DoubleBitwiseEquals(self.longitude, otherGeoPoint.longitude);
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return 31 * DoubleBitwiseHash(self.latitude) + DoubleBitwiseHash(self.longitude);
|
||||
}
|
||||
|
||||
/** Implements NSCopying without actually copying because geopoints are immutable. */
|
||||
- (id)copyWithZone:(__unused NSZone *_Nullable)zone {
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRGeoPoint (Internal)
|
||||
|
||||
- (NSComparisonResult)compare:(FIRGeoPoint *)other {
|
||||
NSComparisonResult result = WrapCompare<double>(self.latitude, other.latitude);
|
||||
if (result != NSOrderedSame) {
|
||||
return result;
|
||||
} else {
|
||||
return WrapCompare<double>(self.longitude, other.longitude);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#import "FIRListenerRegistration.h"
|
||||
|
||||
#include "Firestore/core/src/api/listener_registration.h"
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Private implementation of the FIRListenerRegistration protocol. */
|
||||
@interface FSTListenerRegistration : NSObject <FIRListenerRegistration>
|
||||
|
||||
- (instancetype)initWithRegistration:(std::unique_ptr<api::ListenerRegistration>)registration;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FIRListenerRegistration+Internal.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation FSTListenerRegistration {
|
||||
std::unique_ptr<api::ListenerRegistration> _registration;
|
||||
}
|
||||
|
||||
- (instancetype)initWithRegistration:(std::unique_ptr<api::ListenerRegistration>)registration {
|
||||
if (self = [super init]) {
|
||||
_registration = std::move(registration);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)remove {
|
||||
_registration->Remove();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <memory>
|
||||
|
||||
#import "FIRLoadBundleTask.h"
|
||||
|
||||
#include "Firestore/core/src/api/load_bundle_task.h"
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRLoadBundleTaskProgress (Internal)
|
||||
|
||||
- (instancetype)initWithInternal:(api::LoadBundleTaskProgress)progress;
|
||||
|
||||
@end
|
||||
|
||||
/** Private implementation of the FIRListenerRegistration protocol. */
|
||||
@interface FIRLoadBundleTask (Internal)
|
||||
|
||||
- (instancetype)initWithTask:(std::shared_ptr<api::LoadBundleTask>)task;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRLoadBundleTask.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#import "Firestore/Source/API/FIRLoadBundleTask+Internal.h"
|
||||
|
||||
#include "Firestore/core/src/api/load_bundle_task.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
namespace {
|
||||
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
|
||||
} // namespace
|
||||
|
||||
@implementation FIRLoadBundleTaskProgress {
|
||||
}
|
||||
|
||||
- (instancetype)initWithInternal:(api::LoadBundleTaskProgress)progress {
|
||||
if (self = [super init]) {
|
||||
_bytesLoaded = (NSInteger)progress.bytes_loaded();
|
||||
_documentsLoaded = progress.documents_loaded();
|
||||
_totalBytes = (NSInteger)progress.total_bytes();
|
||||
_totalDocuments = progress.total_documents();
|
||||
|
||||
switch (progress.state()) {
|
||||
case api::LoadBundleTaskState::kInProgress:
|
||||
_state = FIRLoadBundleTaskStateInProgress;
|
||||
break;
|
||||
case api::LoadBundleTaskState::kSuccess:
|
||||
_state = FIRLoadBundleTaskStateSuccess;
|
||||
break;
|
||||
case api::LoadBundleTaskState::kError:
|
||||
_state = FIRLoadBundleTaskStateError;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)other {
|
||||
if (self == other) {
|
||||
return YES;
|
||||
} else if (![other isKindOfClass:[FIRLoadBundleTaskProgress class]]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
FIRLoadBundleTaskProgress *otherProgress = (FIRLoadBundleTaskProgress *)other;
|
||||
return self.documentsLoaded == otherProgress.documentsLoaded &&
|
||||
self.totalDocuments == otherProgress.totalDocuments &&
|
||||
self.bytesLoaded == otherProgress.bytesLoaded &&
|
||||
self.totalBytes == otherProgress.totalBytes && self.state == otherProgress.state;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRLoadBundleTask {
|
||||
std::shared_ptr<api::LoadBundleTask> _task;
|
||||
}
|
||||
|
||||
- (instancetype)initWithTask:(std::shared_ptr<api::LoadBundleTask>)task {
|
||||
if (self = [super init]) {
|
||||
_task = std::move(task);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRLoadBundleObserverHandle)addObserver:(void (^)(FIRLoadBundleTaskProgress *progress))observer {
|
||||
if (!observer) {
|
||||
ThrowInvalidArgument("Handler cannot be nil");
|
||||
}
|
||||
|
||||
api::LoadBundleTask::ProgressObserver core_observer =
|
||||
[observer](api::LoadBundleTaskProgress internal_progress) {
|
||||
observer([[FIRLoadBundleTaskProgress alloc] initWithInternal:internal_progress]);
|
||||
};
|
||||
return (FIRLoadBundleObserverHandle)_task->Observe(std::move(core_observer));
|
||||
}
|
||||
|
||||
- (void)removeObserverWithHandle:(FIRLoadBundleObserverHandle)handle {
|
||||
_task->RemoveObserver(handle);
|
||||
}
|
||||
|
||||
- (void)removeAllObservers {
|
||||
_task->RemoveAllObservers();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRQuery.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Firestore/core/src/api/api_fwd.h"
|
||||
#include "Firestore/core/src/core/core_fwd.h"
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
namespace core = firebase::firestore::core;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRQuery (/* Init */)
|
||||
|
||||
- (instancetype)initWithQuery:(api::Query &&)query NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithQuery:(core::Query)query
|
||||
firestore:(std::shared_ptr<api::Firestore>)firestore;
|
||||
|
||||
@end
|
||||
|
||||
/** Internal FIRQuery API we don't want exposed in our public header files. */
|
||||
@interface FIRQuery (Internal)
|
||||
|
||||
- (const core::Query &)query;
|
||||
|
||||
- (const api::Query &)apiQuery;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+655
@@ -0,0 +1,655 @@
|
||||
/*
|
||||
* Copyright 2017 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRQuery.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#import "FIRDocumentReference.h"
|
||||
#import "FIRFirestoreErrors.h"
|
||||
#import "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#import "Firestore/Source/API/FIRDocumentSnapshot+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFieldPath+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFieldValue+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFirestore+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFirestoreSource+Internal.h"
|
||||
#import "Firestore/Source/API/FIRListenerRegistration+Internal.h"
|
||||
#import "Firestore/Source/API/FIRQuery+Internal.h"
|
||||
#import "Firestore/Source/API/FIRQuerySnapshot+Internal.h"
|
||||
#import "Firestore/Source/API/FIRSnapshotMetadata+Internal.h"
|
||||
#import "Firestore/Source/API/FSTUserDataReader.h"
|
||||
|
||||
#include "Firestore/core/src/api/query_core.h"
|
||||
#include "Firestore/core/src/api/query_listener_registration.h"
|
||||
#include "Firestore/core/src/api/query_snapshot.h"
|
||||
#include "Firestore/core/src/api/source.h"
|
||||
#include "Firestore/core/src/core/bound.h"
|
||||
#include "Firestore/core/src/core/direction.h"
|
||||
#include "Firestore/core/src/core/filter.h"
|
||||
#include "Firestore/core/src/core/firestore_client.h"
|
||||
#include "Firestore/core/src/core/listen_options.h"
|
||||
#include "Firestore/core/src/core/order_by.h"
|
||||
#include "Firestore/core/src/core/query.h"
|
||||
#include "Firestore/core/src/model/document_key.h"
|
||||
#include "Firestore/core/src/model/field_path.h"
|
||||
#include "Firestore/core/src/model/resource_path.h"
|
||||
#include "Firestore/core/src/model/server_timestamp_util.h"
|
||||
#include "Firestore/core/src/model/value_util.h"
|
||||
#include "Firestore/core/src/nanopb/message.h"
|
||||
#include "Firestore/core/src/nanopb/nanopb_util.h"
|
||||
#include "Firestore/core/src/util/error_apple.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/hard_assert.h"
|
||||
#include "Firestore/core/src/util/statusor.h"
|
||||
#include "Firestore/core/src/util/string_apple.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/match.h"
|
||||
|
||||
namespace nanopb = firebase::firestore::nanopb;
|
||||
using firebase::firestore::api::Firestore;
|
||||
using firebase::firestore::api::Query;
|
||||
using firebase::firestore::api::QueryListenerRegistration;
|
||||
using firebase::firestore::api::QuerySnapshot;
|
||||
using firebase::firestore::api::QuerySnapshotListener;
|
||||
using firebase::firestore::api::SnapshotMetadata;
|
||||
using firebase::firestore::api::Source;
|
||||
using firebase::firestore::core::AsyncEventListener;
|
||||
using firebase::firestore::core::Bound;
|
||||
using firebase::firestore::core::Direction;
|
||||
using firebase::firestore::core::EventListener;
|
||||
using firebase::firestore::core::Filter;
|
||||
using firebase::firestore::core::ListenOptions;
|
||||
using firebase::firestore::core::OrderBy;
|
||||
using firebase::firestore::core::OrderByList;
|
||||
using firebase::firestore::core::QueryListener;
|
||||
using firebase::firestore::core::ViewSnapshot;
|
||||
using firebase::firestore::google_firestore_v1_ArrayValue;
|
||||
using firebase::firestore::google_firestore_v1_Value;
|
||||
using firebase::firestore::google_firestore_v1_Value_fields;
|
||||
using firebase::firestore::model::DatabaseId;
|
||||
using firebase::firestore::model::DeepClone;
|
||||
using firebase::firestore::model::Document;
|
||||
using firebase::firestore::model::DocumentKey;
|
||||
using firebase::firestore::model::FieldPath;
|
||||
using firebase::firestore::model::GetTypeOrder;
|
||||
using firebase::firestore::model::IsServerTimestamp;
|
||||
using firebase::firestore::model::RefValue;
|
||||
using firebase::firestore::model::ResourcePath;
|
||||
using firebase::firestore::model::TypeOrder;
|
||||
using firebase::firestore::nanopb::CheckedSize;
|
||||
using firebase::firestore::nanopb::MakeArray;
|
||||
using firebase::firestore::nanopb::MakeString;
|
||||
using firebase::firestore::nanopb::Message;
|
||||
using firebase::firestore::nanopb::SharedMessage;
|
||||
using firebase::firestore::nanopb::MakeSharedMessage;
|
||||
using firebase::firestore::util::MakeNSError;
|
||||
using firebase::firestore::util::MakeString;
|
||||
using firebase::firestore::util::StatusOr;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
namespace {
|
||||
|
||||
FieldPath MakeFieldPath(NSString *field) {
|
||||
return FieldPath::FromDotSeparatedString(MakeString(field));
|
||||
}
|
||||
|
||||
FIRQuery *Wrap(Query &&query) {
|
||||
return [[FIRQuery alloc] initWithQuery:std::move(query)];
|
||||
}
|
||||
|
||||
int32_t SaturatedLimitValue(NSInteger limit) {
|
||||
int32_t internal_limit;
|
||||
if (limit == NSNotFound || limit >= core::Target::kNoLimit) {
|
||||
internal_limit = core::Target::kNoLimit;
|
||||
} else {
|
||||
internal_limit = static_cast<int32_t>(limit);
|
||||
}
|
||||
return internal_limit;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@implementation FIRQuery {
|
||||
Query _query;
|
||||
}
|
||||
|
||||
#pragma mark - Constructor Methods
|
||||
|
||||
- (instancetype)initWithQuery:(Query &&)query {
|
||||
if (self = [super init]) {
|
||||
_query = std::move(query);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithQuery:(core::Query)query firestore:(std::shared_ptr<Firestore>)firestore {
|
||||
return [self initWithQuery:Query{std::move(query), std::move(firestore)}];
|
||||
}
|
||||
|
||||
#pragma mark - NSObject Methods
|
||||
|
||||
- (BOOL)isEqual:(nullable id)other {
|
||||
if (other == self) return YES;
|
||||
if (![[other class] isEqual:[self class]]) return NO;
|
||||
|
||||
auto otherQuery = static_cast<FIRQuery *>(other);
|
||||
return _query == otherQuery->_query;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return _query.Hash();
|
||||
}
|
||||
|
||||
#pragma mark - Public Methods
|
||||
|
||||
- (FIRFirestore *)firestore {
|
||||
return [FIRFirestore recoverFromFirestore:_query.firestore()];
|
||||
}
|
||||
|
||||
- (void)getDocumentsWithCompletion:(void (^)(FIRQuerySnapshot *_Nullable snapshot,
|
||||
NSError *_Nullable error))completion {
|
||||
_query.GetDocuments(Source::Default, [self wrapQuerySnapshotBlock:completion]);
|
||||
}
|
||||
|
||||
- (void)getDocumentsWithSource:(FIRFirestoreSource)publicSource
|
||||
completion:(void (^)(FIRQuerySnapshot *_Nullable snapshot,
|
||||
NSError *_Nullable error))completion {
|
||||
Source source = api::MakeSource(publicSource);
|
||||
_query.GetDocuments(source, [self wrapQuerySnapshotBlock:completion]);
|
||||
}
|
||||
|
||||
- (id<FIRListenerRegistration>)addSnapshotListener:(FIRQuerySnapshotBlock)listener {
|
||||
return [self addSnapshotListenerWithIncludeMetadataChanges:NO listener:listener];
|
||||
}
|
||||
|
||||
- (id<FIRListenerRegistration>)
|
||||
addSnapshotListenerWithIncludeMetadataChanges:(BOOL)includeMetadataChanges
|
||||
listener:(FIRQuerySnapshotBlock)listener {
|
||||
auto options = ListenOptions::FromIncludeMetadataChanges(includeMetadataChanges);
|
||||
return [self addSnapshotListenerInternalWithOptions:options listener:listener];
|
||||
}
|
||||
|
||||
- (id<FIRListenerRegistration>)addSnapshotListenerInternalWithOptions:(ListenOptions)internalOptions
|
||||
listener:
|
||||
(FIRQuerySnapshotBlock)listener {
|
||||
std::shared_ptr<Firestore> firestore = self.firestore.wrapped;
|
||||
const core::Query &query = self.query;
|
||||
|
||||
// Convert from ViewSnapshots to QuerySnapshots.
|
||||
auto view_listener = EventListener<ViewSnapshot>::Create(
|
||||
[listener, firestore, query](StatusOr<ViewSnapshot> maybe_snapshot) {
|
||||
if (!maybe_snapshot.status().ok()) {
|
||||
listener(nil, MakeNSError(maybe_snapshot.status()));
|
||||
return;
|
||||
}
|
||||
|
||||
ViewSnapshot snapshot = std::move(maybe_snapshot).ValueOrDie();
|
||||
SnapshotMetadata metadata(snapshot.has_pending_writes(), snapshot.from_cache());
|
||||
|
||||
listener([[FIRQuerySnapshot alloc] initWithFirestore:firestore
|
||||
originalQuery:query
|
||||
snapshot:std::move(snapshot)
|
||||
metadata:std::move(metadata)],
|
||||
nil);
|
||||
});
|
||||
|
||||
// Call the view_listener on the user Executor.
|
||||
auto async_listener = AsyncEventListener<ViewSnapshot>::Create(
|
||||
firestore->client()->user_executor(), std::move(view_listener));
|
||||
|
||||
std::shared_ptr<QueryListener> query_listener =
|
||||
firestore->client()->ListenToQuery(query, internalOptions, async_listener);
|
||||
|
||||
return [[FSTListenerRegistration alloc]
|
||||
initWithRegistration:absl::make_unique<QueryListenerRegistration>(firestore->client(),
|
||||
std::move(async_listener),
|
||||
std::move(query_listener))];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field isEqualTo:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::Equal field:field value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path isEqualTo:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::Equal path:path.internalValue value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field isNotEqualTo:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::NotEqual field:field value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path isNotEqualTo:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::NotEqual
|
||||
path:path.internalValue
|
||||
value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field isLessThan:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::LessThan field:field value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path isLessThan:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::LessThan
|
||||
path:path.internalValue
|
||||
value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field isLessThanOrEqualTo:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::LessThanOrEqual field:field value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path isLessThanOrEqualTo:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::LessThanOrEqual
|
||||
path:path.internalValue
|
||||
value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field isGreaterThan:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::GreaterThan field:field value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path isGreaterThan:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::GreaterThan
|
||||
path:path.internalValue
|
||||
value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field arrayContains:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::ArrayContains field:field value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path arrayContains:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::ArrayContains
|
||||
path:path.internalValue
|
||||
value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field isGreaterThanOrEqualTo:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::GreaterThanOrEqual
|
||||
field:field
|
||||
value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path isGreaterThanOrEqualTo:(id)value {
|
||||
return [self queryWithFilterOperator:Filter::Operator::GreaterThanOrEqual
|
||||
path:path.internalValue
|
||||
value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field arrayContainsAny:(NSArray<id> *)values {
|
||||
return [self queryWithFilterOperator:Filter::Operator::ArrayContainsAny field:field value:values];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path arrayContainsAny:(NSArray<id> *)values {
|
||||
return [self queryWithFilterOperator:Filter::Operator::ArrayContainsAny
|
||||
path:path.internalValue
|
||||
value:values];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field in:(NSArray<id> *)values {
|
||||
return [self queryWithFilterOperator:Filter::Operator::In field:field value:values];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path in:(NSArray<id> *)values {
|
||||
return [self queryWithFilterOperator:Filter::Operator::In path:path.internalValue value:values];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereField:(NSString *)field notIn:(NSArray<id> *)values {
|
||||
return [self queryWithFilterOperator:Filter::Operator::NotIn field:field value:values];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path notIn:(NSArray<id> *)values {
|
||||
return [self queryWithFilterOperator:Filter::Operator::NotIn
|
||||
path:path.internalValue
|
||||
value:values];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryFilteredUsingComparisonPredicate:(NSPredicate *)predicate {
|
||||
NSComparisonPredicate *comparison = (NSComparisonPredicate *)predicate;
|
||||
if (comparison.comparisonPredicateModifier != NSDirectPredicateModifier) {
|
||||
ThrowInvalidArgument("Invalid query. Predicate cannot have an aggregate modifier.");
|
||||
}
|
||||
NSString *path;
|
||||
id value = nil;
|
||||
if ([comparison.leftExpression expressionType] == NSKeyPathExpressionType &&
|
||||
[comparison.rightExpression expressionType] == NSConstantValueExpressionType) {
|
||||
path = comparison.leftExpression.keyPath;
|
||||
value = comparison.rightExpression.constantValue;
|
||||
switch (comparison.predicateOperatorType) {
|
||||
case NSEqualToPredicateOperatorType:
|
||||
return [self queryWhereField:path isEqualTo:value];
|
||||
case NSLessThanPredicateOperatorType:
|
||||
return [self queryWhereField:path isLessThan:value];
|
||||
case NSLessThanOrEqualToPredicateOperatorType:
|
||||
return [self queryWhereField:path isLessThanOrEqualTo:value];
|
||||
case NSGreaterThanPredicateOperatorType:
|
||||
return [self queryWhereField:path isGreaterThan:value];
|
||||
case NSGreaterThanOrEqualToPredicateOperatorType:
|
||||
return [self queryWhereField:path isGreaterThanOrEqualTo:value];
|
||||
case NSNotEqualToPredicateOperatorType:
|
||||
return [self queryWhereField:path isNotEqualTo:value];
|
||||
case NSContainsPredicateOperatorType:
|
||||
return [self queryWhereField:path arrayContains:value];
|
||||
case NSInPredicateOperatorType:
|
||||
return [self queryWhereField:path in:value];
|
||||
default:; // Fallback below to throw assertion.
|
||||
}
|
||||
} else if ([comparison.leftExpression expressionType] == NSConstantValueExpressionType &&
|
||||
[comparison.rightExpression expressionType] == NSKeyPathExpressionType) {
|
||||
path = comparison.rightExpression.keyPath;
|
||||
value = comparison.leftExpression.constantValue;
|
||||
switch (comparison.predicateOperatorType) {
|
||||
case NSEqualToPredicateOperatorType:
|
||||
return [self queryWhereField:path isEqualTo:value];
|
||||
case NSLessThanPredicateOperatorType:
|
||||
return [self queryWhereField:path isGreaterThan:value];
|
||||
case NSLessThanOrEqualToPredicateOperatorType:
|
||||
return [self queryWhereField:path isGreaterThanOrEqualTo:value];
|
||||
case NSGreaterThanPredicateOperatorType:
|
||||
return [self queryWhereField:path isLessThan:value];
|
||||
case NSGreaterThanOrEqualToPredicateOperatorType:
|
||||
return [self queryWhereField:path isLessThanOrEqualTo:value];
|
||||
case NSNotEqualToPredicateOperatorType:
|
||||
return [self queryWhereField:path isNotEqualTo:value];
|
||||
case NSContainsPredicateOperatorType:
|
||||
return [self queryWhereField:path arrayContains:value];
|
||||
case NSInPredicateOperatorType:
|
||||
return [self queryWhereField:path in:value];
|
||||
default:; // Fallback below to throw assertion.
|
||||
}
|
||||
} else {
|
||||
ThrowInvalidArgument(
|
||||
"Invalid query. Predicate comparisons must include a key path and a constant.");
|
||||
}
|
||||
// Fallback cases of unsupported comparison operator.
|
||||
switch (comparison.predicateOperatorType) {
|
||||
case NSCustomSelectorPredicateOperatorType:
|
||||
ThrowInvalidArgument("Invalid query. Custom predicate filters are not supported.");
|
||||
break;
|
||||
default:
|
||||
ThrowInvalidArgument("Invalid query. Operator type %s is not supported.",
|
||||
comparison.predicateOperatorType);
|
||||
}
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryFilteredUsingCompoundPredicate:(NSPredicate *)predicate {
|
||||
NSCompoundPredicate *compound = (NSCompoundPredicate *)predicate;
|
||||
if (compound.compoundPredicateType != NSAndPredicateType || compound.subpredicates.count == 0) {
|
||||
ThrowInvalidArgument("Invalid query. Only compound queries using AND are supported.");
|
||||
}
|
||||
FIRQuery *query = self;
|
||||
for (NSPredicate *pred in compound.subpredicates) {
|
||||
query = [query queryFilteredUsingPredicate:pred];
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryFilteredUsingPredicate:(NSPredicate *)predicate {
|
||||
if ([predicate isKindOfClass:[NSComparisonPredicate class]]) {
|
||||
return [self queryFilteredUsingComparisonPredicate:predicate];
|
||||
} else if ([predicate isKindOfClass:[NSCompoundPredicate class]]) {
|
||||
return [self queryFilteredUsingCompoundPredicate:predicate];
|
||||
} else if ([predicate isKindOfClass:[[NSPredicate predicateWithBlock:^BOOL(id, NSDictionary *) {
|
||||
return true;
|
||||
}] class]]) {
|
||||
ThrowInvalidArgument("Invalid query. Block-based predicates are not supported. Please use "
|
||||
"predicateWithFormat to create predicates instead.");
|
||||
} else {
|
||||
ThrowInvalidArgument("Invalid query. Expect comparison or compound of comparison predicate. "
|
||||
"Please use predicateWithFormat to create predicates.");
|
||||
}
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryOrderedByField:(NSString *)field {
|
||||
return [self queryOrderedByField:field descending:NO];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryOrderedByFieldPath:(FIRFieldPath *)fieldPath {
|
||||
return [self queryOrderedByFieldPath:fieldPath descending:NO];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryOrderedByField:(NSString *)field descending:(BOOL)descending {
|
||||
return [self queryOrderedByFieldPath:MakeFieldPath(field)
|
||||
direction:Direction::FromDescending(descending)];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryOrderedByFieldPath:(FIRFieldPath *)fieldPath descending:(BOOL)descending {
|
||||
return [self queryOrderedByFieldPath:fieldPath.internalValue
|
||||
direction:Direction::FromDescending(descending)];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryOrderedByFieldPath:(model::FieldPath)fieldPath direction:(Direction)direction {
|
||||
return Wrap(_query.OrderBy(std::move(fieldPath), direction));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryLimitedTo:(NSInteger)limit {
|
||||
return Wrap(_query.LimitToFirst(SaturatedLimitValue(limit)));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryLimitedToLast:(NSInteger)limit {
|
||||
return Wrap(_query.LimitToLast(SaturatedLimitValue(limit)));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryStartingAtDocument:(FIRDocumentSnapshot *)snapshot {
|
||||
Bound bound = [self boundFromSnapshot:snapshot isBefore:YES];
|
||||
return Wrap(_query.StartAt(std::move(bound)));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryStartingAtValues:(NSArray *)fieldValues {
|
||||
Bound bound = [self boundFromFieldValues:fieldValues isBefore:YES];
|
||||
return Wrap(_query.StartAt(std::move(bound)));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryStartingAfterDocument:(FIRDocumentSnapshot *)snapshot {
|
||||
Bound bound = [self boundFromSnapshot:snapshot isBefore:NO];
|
||||
return Wrap(_query.StartAt(std::move(bound)));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryStartingAfterValues:(NSArray *)fieldValues {
|
||||
Bound bound = [self boundFromFieldValues:fieldValues isBefore:NO];
|
||||
return Wrap(_query.StartAt(std::move(bound)));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryEndingBeforeDocument:(FIRDocumentSnapshot *)snapshot {
|
||||
Bound bound = [self boundFromSnapshot:snapshot isBefore:YES];
|
||||
return Wrap(_query.EndAt(std::move(bound)));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryEndingBeforeValues:(NSArray *)fieldValues {
|
||||
Bound bound = [self boundFromFieldValues:fieldValues isBefore:YES];
|
||||
return Wrap(_query.EndAt(std::move(bound)));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryEndingAtDocument:(FIRDocumentSnapshot *)snapshot {
|
||||
Bound bound = [self boundFromSnapshot:snapshot isBefore:NO];
|
||||
return Wrap(_query.EndAt(std::move(bound)));
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryEndingAtValues:(NSArray *)fieldValues {
|
||||
Bound bound = [self boundFromFieldValues:fieldValues isBefore:NO];
|
||||
return Wrap(_query.EndAt(std::move(bound)));
|
||||
}
|
||||
|
||||
#pragma mark - Private Methods
|
||||
|
||||
- (Message<google_firestore_v1_Value>)parsedQueryValue:(id)value {
|
||||
return [self.firestore.dataReader parsedQueryValue:value];
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)parsedQueryValue:(id)value allowArrays:(bool)allowArrays {
|
||||
return [self.firestore.dataReader parsedQueryValue:value allowArrays:allowArrays];
|
||||
}
|
||||
|
||||
- (QuerySnapshotListener)wrapQuerySnapshotBlock:(FIRQuerySnapshotBlock)block {
|
||||
class Converter : public EventListener<QuerySnapshot> {
|
||||
public:
|
||||
explicit Converter(FIRQuerySnapshotBlock block) : block_(block) {
|
||||
}
|
||||
|
||||
void OnEvent(StatusOr<QuerySnapshot> maybe_snapshot) override {
|
||||
if (maybe_snapshot.ok()) {
|
||||
FIRQuerySnapshot *result =
|
||||
[[FIRQuerySnapshot alloc] initWithSnapshot:std::move(maybe_snapshot).ValueOrDie()];
|
||||
block_(result, nil);
|
||||
} else {
|
||||
block_(nil, MakeNSError(maybe_snapshot.status()));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
FIRQuerySnapshotBlock block_;
|
||||
};
|
||||
|
||||
return absl::make_unique<Converter>(block);
|
||||
}
|
||||
|
||||
/** Private helper for all of the queryWhereField: methods. */
|
||||
- (FIRQuery *)queryWithFilterOperator:(Filter::Operator)filterOperator
|
||||
field:(NSString *)field
|
||||
value:(id)value {
|
||||
return [self queryWithFilterOperator:filterOperator path:MakeFieldPath(field) value:value];
|
||||
}
|
||||
|
||||
- (FIRQuery *)queryWithFilterOperator:(Filter::Operator)filterOperator
|
||||
path:(const FieldPath &)fieldPath
|
||||
value:(id)value {
|
||||
Message<google_firestore_v1_Value> fieldValue =
|
||||
[self parsedQueryValue:value
|
||||
allowArrays:filterOperator == Filter::Operator::In ||
|
||||
filterOperator == Filter::Operator::NotIn];
|
||||
auto describer = [value] { return MakeString(NSStringFromClass([value class])); };
|
||||
return Wrap(_query.Filter(fieldPath, filterOperator, std::move(fieldValue), describer));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Bound from a query given the document.
|
||||
*
|
||||
* Note that the Bound will always include the key of the document and the position will be
|
||||
* unambiguous.
|
||||
*
|
||||
* Will throw if the document does not contain all fields of the order by of
|
||||
* the query or if any of the fields in the order by are an uncommitted server
|
||||
* timestamp.
|
||||
*/
|
||||
- (Bound)boundFromSnapshot:(FIRDocumentSnapshot *)snapshot isBefore:(BOOL)isBefore {
|
||||
if (![snapshot exists]) {
|
||||
ThrowInvalidArgument("Invalid query. You are trying to start or end a query using a document "
|
||||
"that doesn't exist.");
|
||||
}
|
||||
const Document &document = *snapshot.internalDocument;
|
||||
const DatabaseId &databaseID = self.firestore.databaseID;
|
||||
const OrderByList &order_bys = self.query.order_bys();
|
||||
|
||||
SharedMessage<google_firestore_v1_ArrayValue> components{{}};
|
||||
components->values_count = CheckedSize(order_bys.size());
|
||||
components->values = MakeArray<google_firestore_v1_Value>(components->values_count);
|
||||
|
||||
// Because people expect to continue/end a query at the exact document provided, we need to
|
||||
// use the implicit sort order rather than the explicit sort order, because it's guaranteed to
|
||||
// contain the document key. That way the position becomes unambiguous and the query
|
||||
// continues/ends exactly at the provided document. Without the key (by using the explicit sort
|
||||
// orders), multiple documents could match the position, yielding duplicate results.
|
||||
for (size_t i = 0; i < order_bys.size(); ++i) {
|
||||
if (order_bys[i].field() == FieldPath::KeyFieldPath()) {
|
||||
components->values[i] = *RefValue(databaseID, document->key()).release();
|
||||
} else {
|
||||
absl::optional<google_firestore_v1_Value> value = document->field(order_bys[i].field());
|
||||
|
||||
if (value) {
|
||||
if (IsServerTimestamp(*value)) {
|
||||
ThrowInvalidArgument(
|
||||
"Invalid query. You are trying to start or end a query using a document for which "
|
||||
"the field '%s' is an uncommitted server timestamp. (Since the value of this field "
|
||||
"is unknown, you cannot start/end a query with it.)",
|
||||
order_bys[i].field().CanonicalString());
|
||||
} else {
|
||||
components->values[i] = *DeepClone(*value).release();
|
||||
}
|
||||
} else {
|
||||
ThrowInvalidArgument(
|
||||
"Invalid query. You are trying to start or end a query using a document for which the "
|
||||
"field '%s' (used as the order by) does not exist.",
|
||||
order_bys[i].field().CanonicalString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return Bound::FromValue(std::move(components), isBefore);
|
||||
}
|
||||
|
||||
/** Converts a list of field values to an Bound. */
|
||||
- (Bound)boundFromFieldValues:(NSArray<id> *)fieldValues isBefore:(BOOL)isBefore {
|
||||
// Use explicit sort order because it has to match the query the user made
|
||||
const OrderByList &explicitSortOrders = self.query.explicit_order_bys();
|
||||
if (fieldValues.count > explicitSortOrders.size()) {
|
||||
ThrowInvalidArgument("Invalid query. You are trying to start or end a query using more values "
|
||||
"than were specified in the order by.");
|
||||
}
|
||||
|
||||
SharedMessage<google_firestore_v1_ArrayValue> components{{}};
|
||||
components->values_count = CheckedSize(fieldValues.count);
|
||||
components->values = MakeArray<google_firestore_v1_Value>(components->values_count);
|
||||
for (NSUInteger idx = 0, max = fieldValues.count; idx < max; ++idx) {
|
||||
id rawValue = fieldValues[idx];
|
||||
const OrderBy &sortOrder = explicitSortOrders[idx];
|
||||
|
||||
Message<google_firestore_v1_Value> fieldValue{[self parsedQueryValue:rawValue]};
|
||||
if (sortOrder.field().IsKeyFieldPath()) {
|
||||
if (GetTypeOrder(*fieldValue) != TypeOrder::kString) {
|
||||
ThrowInvalidArgument("Invalid query. Expected a string for the document ID.");
|
||||
}
|
||||
|
||||
std::string documentID = MakeString(fieldValue->string_value);
|
||||
if (!self.query.IsCollectionGroupQuery() && absl::StrContains(documentID, "/")) {
|
||||
ThrowInvalidArgument("Invalid query. When querying a collection and ordering by document "
|
||||
"ID, you must pass a plain document ID, but '%s' contains a slash.",
|
||||
documentID);
|
||||
}
|
||||
ResourcePath path = self.query.path().Append(ResourcePath::FromString(documentID));
|
||||
if (!DocumentKey::IsDocumentKey(path)) {
|
||||
ThrowInvalidArgument("Invalid query. When querying a collection group and ordering by "
|
||||
"document ID, you must pass a value that results in a valid document "
|
||||
"path, but '%s' is not because it contains an odd number of segments.",
|
||||
path.CanonicalString());
|
||||
}
|
||||
DocumentKey key{path};
|
||||
components->values[idx] = *RefValue(self.firestore.databaseID, key).release();
|
||||
} else {
|
||||
components->values[idx] = *fieldValue.release();
|
||||
}
|
||||
}
|
||||
|
||||
return Bound::FromValue(std::move(components), isBefore);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRQuery (Internal)
|
||||
|
||||
- (const core::Query &)query {
|
||||
return _query.query();
|
||||
}
|
||||
|
||||
- (const api::Query &)apiQuery {
|
||||
return _query;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRQuerySnapshot.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Firestore/core/src/api/api_fwd.h"
|
||||
#include "Firestore/core/src/core/core_fwd.h"
|
||||
|
||||
@class FIRFirestore;
|
||||
@class FIRSnapshotMetadata;
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
namespace core = firebase::firestore::core;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Internal FIRQuerySnapshot API we don't want exposed in our public header files. */
|
||||
@interface FIRQuerySnapshot (/* Init */)
|
||||
|
||||
- (instancetype)initWithSnapshot:(api::QuerySnapshot &&)snapshot NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithFirestore:(std::shared_ptr<api::Firestore>)firestore
|
||||
originalQuery:(core::Query)query
|
||||
snapshot:(core::ViewSnapshot &&)snapshot
|
||||
metadata:(api::SnapshotMetadata)metadata;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#import "Firestore/Source/API/FIRQuerySnapshot+Internal.h"
|
||||
|
||||
#import "FIRSnapshotMetadata.h"
|
||||
#import "Firestore/Source/API/FIRDocumentChange+Internal.h"
|
||||
#import "Firestore/Source/API/FIRDocumentSnapshot+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFirestore+Internal.h"
|
||||
#import "Firestore/Source/API/FIRQuery+Internal.h"
|
||||
#import "Firestore/Source/API/FIRSnapshotMetadata+Internal.h"
|
||||
|
||||
#include "Firestore/core/src/api/query_core.h"
|
||||
#include "Firestore/core/src/api/query_snapshot.h"
|
||||
#include "Firestore/core/src/core/view_snapshot.h"
|
||||
#include "Firestore/core/src/model/document_set.h"
|
||||
#include "Firestore/core/src/util/delayed_constructor.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
|
||||
using firebase::firestore::api::DocumentChange;
|
||||
using firebase::firestore::api::DocumentSnapshot;
|
||||
using firebase::firestore::api::Firestore;
|
||||
using firebase::firestore::api::QuerySnapshot;
|
||||
using firebase::firestore::api::SnapshotMetadata;
|
||||
using firebase::firestore::core::ViewSnapshot;
|
||||
using firebase::firestore::util::DelayedConstructor;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation FIRQuerySnapshot {
|
||||
DelayedConstructor<QuerySnapshot> _snapshot;
|
||||
|
||||
FIRSnapshotMetadata *_cached_metadata;
|
||||
|
||||
// Cached value of the documents property.
|
||||
NSArray<FIRQueryDocumentSnapshot *> *_documents;
|
||||
|
||||
// Cached value of the documentChanges property.
|
||||
NSArray<FIRDocumentChange *> *_documentChanges;
|
||||
BOOL _documentChangesIncludeMetadataChanges;
|
||||
}
|
||||
|
||||
- (instancetype)initWithSnapshot:(QuerySnapshot &&)snapshot {
|
||||
if (self = [super init]) {
|
||||
_snapshot.Init(std::move(snapshot));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFirestore:(std::shared_ptr<Firestore>)firestore
|
||||
originalQuery:(core::Query)query
|
||||
snapshot:(ViewSnapshot &&)snapshot
|
||||
metadata:(SnapshotMetadata)metadata {
|
||||
QuerySnapshot wrapped(firestore, std::move(query), std::move(snapshot), std::move(metadata));
|
||||
return [self initWithSnapshot:std::move(wrapped)];
|
||||
}
|
||||
|
||||
// NSObject Methods
|
||||
- (BOOL)isEqual:(nullable id)other {
|
||||
if (![other isKindOfClass:[FIRQuerySnapshot class]]) return NO;
|
||||
|
||||
FIRQuerySnapshot *otherSnapshot = other;
|
||||
return *_snapshot == *(otherSnapshot->_snapshot);
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return _snapshot->Hash();
|
||||
}
|
||||
|
||||
- (FIRQuery *)query {
|
||||
return [[FIRQuery alloc] initWithQuery:_snapshot->query()];
|
||||
}
|
||||
|
||||
- (FIRSnapshotMetadata *)metadata {
|
||||
if (!_cached_metadata) {
|
||||
_cached_metadata = [[FIRSnapshotMetadata alloc] initWithMetadata:_snapshot->metadata()];
|
||||
}
|
||||
return _cached_metadata;
|
||||
}
|
||||
|
||||
@dynamic empty;
|
||||
|
||||
- (BOOL)isEmpty {
|
||||
return _snapshot->empty();
|
||||
}
|
||||
|
||||
// This property is exposed as an NSInteger instead of an NSUInteger since (as of Xcode 8.1)
|
||||
// Swift bridges NSUInteger as UInt, and we want to avoid forcing Swift users to cast their ints
|
||||
// where we can. See cr/146959032 for additional context.
|
||||
- (NSInteger)count {
|
||||
return static_cast<NSInteger>(_snapshot->size());
|
||||
}
|
||||
|
||||
- (NSArray<FIRQueryDocumentSnapshot *> *)documents {
|
||||
if (!_documents) {
|
||||
NSMutableArray<FIRQueryDocumentSnapshot *> *result = [NSMutableArray array];
|
||||
_snapshot->ForEachDocument([&result](DocumentSnapshot snapshot) {
|
||||
[result addObject:[[FIRQueryDocumentSnapshot alloc] initWithSnapshot:std::move(snapshot)]];
|
||||
});
|
||||
|
||||
_documents = result;
|
||||
}
|
||||
return _documents;
|
||||
}
|
||||
|
||||
- (NSArray<FIRDocumentChange *> *)documentChanges {
|
||||
return [self documentChangesWithIncludeMetadataChanges:NO];
|
||||
}
|
||||
|
||||
- (NSArray<FIRDocumentChange *> *)documentChangesWithIncludeMetadataChanges:
|
||||
(BOOL)includeMetadataChanges {
|
||||
if (!_documentChanges || _documentChangesIncludeMetadataChanges != includeMetadataChanges) {
|
||||
NSMutableArray *documentChanges = [NSMutableArray array];
|
||||
_snapshot->ForEachChange(
|
||||
static_cast<bool>(includeMetadataChanges), [&documentChanges](DocumentChange change) {
|
||||
[documentChanges
|
||||
addObject:[[FIRDocumentChange alloc] initWithDocumentChange:std::move(change)]];
|
||||
});
|
||||
|
||||
_documentChanges = documentChanges;
|
||||
_documentChangesIncludeMetadataChanges = includeMetadataChanges;
|
||||
}
|
||||
return _documentChanges;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRSnapshotMetadata.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "Firestore/core/src/api/snapshot_metadata.h"
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRSnapshotMetadata (/* Init */)
|
||||
|
||||
- (instancetype)initWithMetadata:(api::SnapshotMetadata)metadata NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithPendingWrites:(bool)pendingWrites fromCache:(bool)fromCache;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRSnapshotMetadata.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#import "Firestore/Source/API/FIRSnapshotMetadata+Internal.h"
|
||||
|
||||
#include "Firestore/core/src/api/snapshot_metadata.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation FIRSnapshotMetadata {
|
||||
api::SnapshotMetadata _metadata;
|
||||
}
|
||||
|
||||
- (instancetype)initWithMetadata:(api::SnapshotMetadata)metadata {
|
||||
if (self = [super init]) {
|
||||
_metadata = std::move(metadata);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithPendingWrites:(bool)pendingWrites fromCache:(bool)fromCache {
|
||||
api::SnapshotMetadata wrapped(pendingWrites, fromCache);
|
||||
return [self initWithMetadata:std::move(wrapped)];
|
||||
}
|
||||
|
||||
// NSObject Methods
|
||||
- (BOOL)isEqual:(nullable id)other {
|
||||
if (other == self) return YES;
|
||||
if (![other isKindOfClass:[FIRSnapshotMetadata class]]) return NO;
|
||||
|
||||
FIRSnapshotMetadata *otherMetadata = other;
|
||||
return _metadata == otherMetadata->_metadata;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return _metadata.Hash();
|
||||
}
|
||||
|
||||
- (BOOL)hasPendingWrites {
|
||||
return _metadata.pending_writes();
|
||||
}
|
||||
|
||||
- (BOOL)isFromCache {
|
||||
return _metadata.from_cache();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2018 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRTimestamp.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Internal FIRTimestamp API we don't want exposed in our public header files. */
|
||||
@interface FIRTimestamp (Internal)
|
||||
|
||||
/**
|
||||
* Converts the given date to an ISO 8601 timestamp string, useful for rendering in JSON.
|
||||
*
|
||||
* ISO 8601 dates times in UTC look like this: "1912-04-14T23:40:00.000000000Z".
|
||||
*
|
||||
* @see http://www.ecma-international.org/ecma-262/6.0/#sec-date-time-string-format
|
||||
*/
|
||||
- (NSString *)ISO8601String;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FIRTimestamp+Internal.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
static const int kNanosPerSecond = 1000000000;
|
||||
|
||||
@implementation FIRTimestamp (Internal)
|
||||
|
||||
#pragma mark - Internal public methods
|
||||
|
||||
- (NSString *)ISO8601String {
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||||
formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss";
|
||||
formatter.timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
|
||||
NSDate *secondsDate = [NSDate dateWithTimeIntervalSince1970:self.seconds];
|
||||
NSString *secondsString = [formatter stringFromDate:secondsDate];
|
||||
if (secondsString.length != 19) {
|
||||
[NSException raise:@"Invalid ISO string" format:@"Invalid ISO string: %@", secondsString];
|
||||
}
|
||||
|
||||
NSString *nanosString = [NSString stringWithFormat:@"%09d", self.nanoseconds];
|
||||
return [NSString stringWithFormat:@"%@.%@Z", secondsString, nanosString];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRTimestamp
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
+ (instancetype)timestampWithDate:(NSDate *)date {
|
||||
double secondsDouble;
|
||||
double fraction = modf(date.timeIntervalSince1970, &secondsDouble);
|
||||
// GCP Timestamps always have non-negative nanos.
|
||||
if (fraction < 0) {
|
||||
fraction += 1.0;
|
||||
secondsDouble -= 1.0;
|
||||
}
|
||||
int64_t seconds = (int64_t)secondsDouble;
|
||||
int32_t nanos = (int32_t)(fraction * kNanosPerSecond);
|
||||
return [[FIRTimestamp alloc] initWithSeconds:seconds nanoseconds:nanos];
|
||||
}
|
||||
|
||||
+ (instancetype)timestampWithSeconds:(int64_t)seconds nanoseconds:(int32_t)nanoseconds {
|
||||
return [[FIRTimestamp alloc] initWithSeconds:seconds nanoseconds:nanoseconds];
|
||||
}
|
||||
|
||||
+ (instancetype)timestamp {
|
||||
return [FIRTimestamp timestampWithDate:[NSDate date]];
|
||||
}
|
||||
|
||||
- (instancetype)initWithSeconds:(int64_t)seconds nanoseconds:(int32_t)nanoseconds {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
if (nanoseconds < 0) {
|
||||
[NSException raise:@"Invalid timestamp"
|
||||
format:@"Timestamp nanoseconds out of range: %d", nanoseconds];
|
||||
}
|
||||
if (nanoseconds >= 1e9) {
|
||||
[NSException raise:@"Invalid timestamp"
|
||||
format:@"Timestamp nanoseconds out of range: %d", nanoseconds];
|
||||
}
|
||||
// Midnight at the beginning of 1/1/1 is the earliest timestamp supported.
|
||||
if (seconds < -62135596800L) {
|
||||
[NSException raise:@"Invalid timestamp"
|
||||
format:@"Timestamp seconds out of range: %lld", seconds];
|
||||
}
|
||||
// This will break in the year 10,000.
|
||||
if (seconds >= 253402300800L) {
|
||||
[NSException raise:@"Invalid timestamp"
|
||||
format:@"Timestamp seconds out of range: %lld", seconds];
|
||||
}
|
||||
|
||||
_seconds = seconds;
|
||||
_nanoseconds = nanoseconds;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - NSObject methods
|
||||
|
||||
- (BOOL)isEqual:(id)object {
|
||||
if (self == object) {
|
||||
return YES;
|
||||
}
|
||||
if (![object isKindOfClass:[FIRTimestamp class]]) {
|
||||
return NO;
|
||||
}
|
||||
return [self isEqualToTimestamp:(FIRTimestamp *)object];
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return (NSUInteger)((self.seconds >> 32) ^ self.seconds ^ self.nanoseconds);
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"<FIRTimestamp: seconds=%lld nanoseconds=%d>", self.seconds,
|
||||
self.nanoseconds];
|
||||
}
|
||||
|
||||
/** Implements NSCopying without actually copying because timestamps are immutable. */
|
||||
- (id)copyWithZone:(__unused NSZone *_Nullable)zone {
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Public methods
|
||||
|
||||
- (NSDate *)dateValue {
|
||||
NSTimeInterval interval = (NSTimeInterval)self.seconds + ((NSTimeInterval)self.nanoseconds) / 1e9;
|
||||
return [NSDate dateWithTimeIntervalSince1970:interval];
|
||||
}
|
||||
|
||||
- (NSComparisonResult)compare:(FIRTimestamp *)other {
|
||||
if (self.seconds < other.seconds) {
|
||||
return NSOrderedAscending;
|
||||
} else if (self.seconds > other.seconds) {
|
||||
return NSOrderedDescending;
|
||||
}
|
||||
|
||||
if (self.nanoseconds < other.nanoseconds) {
|
||||
return NSOrderedAscending;
|
||||
} else if (self.nanoseconds > other.nanoseconds) {
|
||||
return NSOrderedDescending;
|
||||
}
|
||||
return NSOrderedSame;
|
||||
}
|
||||
|
||||
#pragma mark - Private methods
|
||||
|
||||
- (BOOL)isEqualToTimestamp:(FIRTimestamp *)other {
|
||||
return [self compare:other] == NSOrderedSame;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRTransaction.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Firestore/core/src/core/transaction.h"
|
||||
|
||||
@class FIRFirestore;
|
||||
|
||||
namespace core = firebase::firestore::core;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRTransaction (Internal)
|
||||
|
||||
+ (instancetype)transactionWithInternalTransaction:(std::shared_ptr<core::Transaction>)transaction
|
||||
firestore:(FIRFirestore *)firestore;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRTransaction.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#import "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#import "Firestore/Source/API/FIRDocumentSnapshot+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFirestore+Internal.h"
|
||||
#import "Firestore/Source/API/FIRTransaction+Internal.h"
|
||||
#import "Firestore/Source/API/FSTUserDataReader.h"
|
||||
|
||||
#include "Firestore/core/src/core/transaction.h"
|
||||
#include "Firestore/core/src/core/user_data.h"
|
||||
#include "Firestore/core/src/model/document.h"
|
||||
#include "Firestore/core/src/util/error_apple.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/hard_assert.h"
|
||||
#include "Firestore/core/src/util/status.h"
|
||||
#include "Firestore/core/src/util/statusor.h"
|
||||
|
||||
using firebase::firestore::core::ParsedSetData;
|
||||
using firebase::firestore::core::ParsedUpdateData;
|
||||
using firebase::firestore::core::Transaction;
|
||||
using firebase::firestore::model::Document;
|
||||
using firebase::firestore::util::MakeNSError;
|
||||
using firebase::firestore::util::StatusOr;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - FIRTransaction
|
||||
|
||||
@interface FIRTransaction ()
|
||||
|
||||
- (instancetype)initWithTransaction:(std::shared_ptr<Transaction>)transaction
|
||||
firestore:(FIRFirestore *)firestore NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@property(nonatomic, strong, readonly) FIRFirestore *firestore;
|
||||
@end
|
||||
|
||||
@implementation FIRTransaction (Internal)
|
||||
|
||||
+ (instancetype)transactionWithInternalTransaction:(std::shared_ptr<Transaction>)transaction
|
||||
firestore:(FIRFirestore *)firestore {
|
||||
return [[FIRTransaction alloc] initWithTransaction:std::move(transaction) firestore:firestore];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRTransaction {
|
||||
std::shared_ptr<Transaction> _internalTransaction;
|
||||
}
|
||||
|
||||
- (instancetype)initWithTransaction:(std::shared_ptr<Transaction>)transaction
|
||||
firestore:(FIRFirestore *)firestore {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_internalTransaction = std::move(transaction);
|
||||
_firestore = firestore;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRTransaction *)setData:(NSDictionary<NSString *, id> *)data
|
||||
forDocument:(FIRDocumentReference *)document {
|
||||
return [self setData:data forDocument:document merge:NO];
|
||||
}
|
||||
|
||||
- (FIRTransaction *)setData:(NSDictionary<NSString *, id> *)data
|
||||
forDocument:(FIRDocumentReference *)document
|
||||
merge:(BOOL)merge {
|
||||
[self validateReference:document];
|
||||
ParsedSetData parsed = merge ? [self.firestore.dataReader parsedMergeData:data fieldMask:nil]
|
||||
: [self.firestore.dataReader parsedSetData:data];
|
||||
_internalTransaction->Set(document.key, std::move(parsed));
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRTransaction *)setData:(NSDictionary<NSString *, id> *)data
|
||||
forDocument:(FIRDocumentReference *)document
|
||||
mergeFields:(NSArray<id> *)mergeFields {
|
||||
[self validateReference:document];
|
||||
ParsedSetData parsed = [self.firestore.dataReader parsedMergeData:data fieldMask:mergeFields];
|
||||
_internalTransaction->Set(document.key, std::move(parsed));
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRTransaction *)updateData:(NSDictionary<id, id> *)fields
|
||||
forDocument:(FIRDocumentReference *)document {
|
||||
[self validateReference:document];
|
||||
ParsedUpdateData parsed = [self.firestore.dataReader parsedUpdateData:fields];
|
||||
_internalTransaction->Update(document.key, std::move(parsed));
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRTransaction *)deleteDocument:(FIRDocumentReference *)document {
|
||||
[self validateReference:document];
|
||||
_internalTransaction->Delete(document.key);
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)getDocument:(FIRDocumentReference *)document
|
||||
completion:(void (^)(FIRDocumentSnapshot *_Nullable document,
|
||||
NSError *_Nullable error))completion {
|
||||
[self validateReference:document];
|
||||
_internalTransaction->Lookup(
|
||||
{document.key},
|
||||
[self, document, completion](const StatusOr<std::vector<Document>> &maybe_documents) {
|
||||
if (!maybe_documents.ok()) {
|
||||
completion(nil, MakeNSError(maybe_documents.status()));
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &documents = maybe_documents.ValueOrDie();
|
||||
HARD_ASSERT(documents.size() == 1, "Mismatch in docs returned from document lookup.");
|
||||
const Document &internalDoc = documents.front();
|
||||
if (internalDoc->is_found_document()) {
|
||||
FIRDocumentSnapshot *doc =
|
||||
[[FIRDocumentSnapshot alloc] initWithFirestore:self.firestore
|
||||
documentKey:internalDoc->key()
|
||||
document:internalDoc
|
||||
fromCache:false
|
||||
hasPendingWrites:false];
|
||||
completion(doc, nil);
|
||||
} else if (internalDoc->is_no_document()) {
|
||||
FIRDocumentSnapshot *doc = [[FIRDocumentSnapshot alloc] initWithFirestore:self.firestore
|
||||
documentKey:document.key
|
||||
document:absl::nullopt
|
||||
fromCache:false
|
||||
hasPendingWrites:false];
|
||||
completion(doc, nil);
|
||||
} else {
|
||||
HARD_FAIL("BatchGetDocumentsRequest returned unexpected document type: %s",
|
||||
internalDoc.ToString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (FIRDocumentSnapshot *_Nullable)getDocument:(FIRDocumentReference *)document
|
||||
error:(NSError *__autoreleasing *)error {
|
||||
[self validateReference:document];
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
__block FIRDocumentSnapshot *result;
|
||||
// We have to explicitly assign the innerError into a local to cause it to retain correctly.
|
||||
__block NSError *outerError = nil;
|
||||
[self getDocument:document
|
||||
completion:^(FIRDocumentSnapshot *_Nullable snapshot, NSError *_Nullable innerError) {
|
||||
result = snapshot;
|
||||
outerError = innerError;
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||
if (error) {
|
||||
*error = outerError;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)validateReference:(FIRDocumentReference *)reference {
|
||||
if (reference.firestore != self.firestore) {
|
||||
ThrowInvalidArgument("Provided document reference is from a different Cloud Firestore "
|
||||
"instance.");
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRWriteBatch.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "Firestore/core/src/api/write_batch.h"
|
||||
|
||||
@class FSTUserDataReader;
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FIRWriteBatch (Internal)
|
||||
|
||||
+ (instancetype)writeBatchWithDataReader:(FSTUserDataReader *)dataReader
|
||||
writeBatch:(api::WriteBatch &&)writeBatch;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FIRWriteBatch+Internal.h"
|
||||
|
||||
#import "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#import "Firestore/Source/API/FSTUserDataReader.h"
|
||||
|
||||
#include "Firestore/core/src/api/write_batch.h"
|
||||
#include "Firestore/core/src/core/user_data.h"
|
||||
#include "Firestore/core/src/util/delayed_constructor.h"
|
||||
#include "Firestore/core/src/util/error_apple.h"
|
||||
|
||||
using firebase::firestore::core::ParsedSetData;
|
||||
using firebase::firestore::core::ParsedUpdateData;
|
||||
using firebase::firestore::util::DelayedConstructor;
|
||||
using firebase::firestore::util::MakeCallback;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - FIRWriteBatch
|
||||
|
||||
@interface FIRWriteBatch ()
|
||||
|
||||
- (instancetype)initWithDataReader:(FSTUserDataReader *)dataReader
|
||||
writeBatch:(api::WriteBatch &&)writeBatch NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@property(nonatomic, strong, readonly) FSTUserDataReader *dataReader;
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRWriteBatch (Internal)
|
||||
|
||||
+ (instancetype)writeBatchWithDataReader:(FSTUserDataReader *)dataReader
|
||||
writeBatch:(api::WriteBatch &&)writeBatch {
|
||||
return [[FIRWriteBatch alloc] initWithDataReader:dataReader writeBatch:std::move(writeBatch)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FIRWriteBatch {
|
||||
DelayedConstructor<api::WriteBatch> _writeBatch;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDataReader:(FSTUserDataReader *)dataReader
|
||||
writeBatch:(api::WriteBatch &&)writeBatch {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_dataReader = dataReader;
|
||||
_writeBatch.Init(std::move(writeBatch));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRWriteBatch *)setData:(NSDictionary<NSString *, id> *)data
|
||||
forDocument:(FIRDocumentReference *)document {
|
||||
return [self setData:data forDocument:document merge:NO];
|
||||
}
|
||||
|
||||
- (FIRWriteBatch *)setData:(NSDictionary<NSString *, id> *)data
|
||||
forDocument:(FIRDocumentReference *)document
|
||||
merge:(BOOL)merge {
|
||||
ParsedSetData parsed = merge ? [self.dataReader parsedMergeData:data fieldMask:nil]
|
||||
: [self.dataReader parsedSetData:data];
|
||||
_writeBatch->SetData(document.internalReference, std::move(parsed));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRWriteBatch *)setData:(NSDictionary<NSString *, id> *)data
|
||||
forDocument:(FIRDocumentReference *)document
|
||||
mergeFields:(NSArray<id> *)mergeFields {
|
||||
ParsedSetData parsed = [self.dataReader parsedMergeData:data fieldMask:mergeFields];
|
||||
_writeBatch->SetData(document.internalReference, std::move(parsed));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRWriteBatch *)updateData:(NSDictionary<id, id> *)fields
|
||||
forDocument:(FIRDocumentReference *)document {
|
||||
ParsedUpdateData parsed = [self.dataReader parsedUpdateData:fields];
|
||||
_writeBatch->UpdateData(document.internalReference, std::move(parsed));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (FIRWriteBatch *)deleteDocument:(FIRDocumentReference *)document {
|
||||
_writeBatch->DeleteData(document.internalReference);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)commit {
|
||||
[self commitWithCompletion:nil];
|
||||
}
|
||||
|
||||
- (void)commitWithCompletion:(nullable void (^)(NSError *_Nullable error))completion {
|
||||
_writeBatch->Commit(MakeCallback(completion));
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2018 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "Firestore/Source/API/FIRFirestore+Internal.h"
|
||||
|
||||
@class FIRApp;
|
||||
@class FIRFirestore;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// Provides and creates instances of Firestore based on a specific key. Used in the interop
|
||||
/// registration process to keep track of instances for `FIRApp` instances.
|
||||
@protocol FSTFirestoreMultiDBProvider
|
||||
|
||||
/// Cached instances of Firestore objects.
|
||||
@property(nonatomic, strong) NSMutableDictionary<NSString *, FIRFirestore *> *instances;
|
||||
|
||||
/// Default method for retrieving a Firestore instance, or creating one if it doesn't exist.
|
||||
- (FIRFirestore *)firestoreForDatabase:(NSString *)database;
|
||||
|
||||
@end
|
||||
|
||||
/// A concrete implementation for FSTInstanceProvider to create Firestore instances and register
|
||||
/// with Core's component system.
|
||||
@interface FSTFirestoreComponent
|
||||
: NSObject <FSTFirestoreInstanceRegistry, FSTFirestoreMultiDBProvider>
|
||||
|
||||
/// The FIRApp that instances will be set up with.
|
||||
@property(nonatomic, weak, readonly) FIRApp *app;
|
||||
|
||||
/// Cached instances of Firestore objects.
|
||||
@property(nonatomic, strong) NSMutableDictionary<NSString *, FIRFirestore *> *instances;
|
||||
|
||||
/// Default method for retrieving a Firestore instance, or creating one if it doesn't exist.
|
||||
- (FIRFirestore *)firestoreForDatabase:(NSString *)database;
|
||||
|
||||
- (void)removeInstanceWithDatabase:(NSString *)database;
|
||||
|
||||
/// Default initializer.
|
||||
- (instancetype)initWithApp:(FIRApp *)app NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright 2018 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FSTFirestoreComponent.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#import "FirebaseAppCheck/Sources/Interop/FIRAppCheckInterop.h"
|
||||
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
|
||||
#import "Firestore/Source/API/FIRFirestore+Internal.h"
|
||||
#import "Interop/Auth/Public/FIRAuthInterop.h"
|
||||
|
||||
#include "Firestore/core/include/firebase/firestore/firestore_version.h"
|
||||
#include "Firestore/core/src/api/firestore.h"
|
||||
#include "Firestore/core/src/credentials/credentials_provider.h"
|
||||
#include "Firestore/core/src/credentials/firebase_app_check_credentials_provider_apple.h"
|
||||
#include "Firestore/core/src/credentials/firebase_auth_credentials_provider_apple.h"
|
||||
#include "Firestore/core/src/remote/firebase_metadata_provider.h"
|
||||
#include "Firestore/core/src/remote/firebase_metadata_provider_apple.h"
|
||||
#include "Firestore/core/src/util/async_queue.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/executor.h"
|
||||
#include "Firestore/core/src/util/hard_assert.h"
|
||||
#include "absl/memory/memory.h"
|
||||
|
||||
using firebase::firestore::credentials::FirebaseAppCheckCredentialsProvider;
|
||||
using firebase::firestore::credentials::FirebaseAuthCredentialsProvider;
|
||||
using firebase::firestore::remote::FirebaseMetadataProviderApple;
|
||||
using firebase::firestore::util::AsyncQueue;
|
||||
using firebase::firestore::util::Executor;
|
||||
using firebase::firestore::util::MakeString;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FSTFirestoreComponent () <FIRComponentLifecycleMaintainer, FIRLibrary>
|
||||
@end
|
||||
|
||||
@implementation FSTFirestoreComponent
|
||||
|
||||
// Explicitly @synthesize because instances is part of the FSTInstanceProvider protocol.
|
||||
@synthesize instances = _instances;
|
||||
|
||||
#pragma mark - Initialization
|
||||
|
||||
- (instancetype)initWithApp:(FIRApp *)app {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_instances = [[NSMutableDictionary alloc] init];
|
||||
|
||||
HARD_ASSERT(app, "Cannot initialize Firestore with a nil FIRApp.");
|
||||
_app = app;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)keyForDatabase:(NSString *)database {
|
||||
return [NSString stringWithFormat:@"%@|%@", self.app.name, database];
|
||||
}
|
||||
|
||||
#pragma mark - FSTInstanceProvider Conformance
|
||||
|
||||
- (FIRFirestore *)firestoreForDatabase:(NSString *)database {
|
||||
if (!database) {
|
||||
ThrowInvalidArgument("Database identifier may not be nil.");
|
||||
}
|
||||
|
||||
NSString *projectID = self.app.options.projectID;
|
||||
if (!projectID) {
|
||||
ThrowInvalidArgument("FIROptions.projectID must be set to a valid project ID.");
|
||||
}
|
||||
|
||||
NSString *key = [self keyForDatabase:database];
|
||||
|
||||
// Get the component from the container.
|
||||
@synchronized(self.instances) {
|
||||
FIRFirestore *firestore = _instances[key];
|
||||
if (!firestore) {
|
||||
std::string queue_name{"com.google.firebase.firestore"};
|
||||
if (!self.app.isDefaultApp) {
|
||||
absl::StrAppend(&queue_name, ".", MakeString(self.app.name));
|
||||
}
|
||||
|
||||
auto executor = Executor::CreateSerial(queue_name.c_str());
|
||||
auto workerQueue = AsyncQueue::Create(std::move(executor));
|
||||
|
||||
id<FIRAuthInterop> auth = FIR_COMPONENT(FIRAuthInterop, self.app.container);
|
||||
id<FIRAppCheckInterop> app_check = FIR_COMPONENT(FIRAppCheckInterop, self.app.container);
|
||||
auto authCredentialsProvider =
|
||||
std::make_shared<FirebaseAuthCredentialsProvider>(self.app, auth);
|
||||
auto appCheckCredentialsProvider =
|
||||
std::make_shared<FirebaseAppCheckCredentialsProvider>(self.app, app_check);
|
||||
|
||||
auto firebaseMetadataProvider = absl::make_unique<FirebaseMetadataProviderApple>(self.app);
|
||||
|
||||
model::DatabaseId databaseID{MakeString(projectID), MakeString(database)};
|
||||
std::string persistenceKey = MakeString(self.app.name);
|
||||
firestore = [[FIRFirestore alloc] initWithDatabaseID:std::move(databaseID)
|
||||
persistenceKey:std::move(persistenceKey)
|
||||
authCredentialsProvider:std::move(authCredentialsProvider)
|
||||
appCheckCredentialsProvider:std::move(appCheckCredentialsProvider)
|
||||
workerQueue:std::move(workerQueue)
|
||||
firebaseMetadataProvider:std::move(firebaseMetadataProvider)
|
||||
firebaseApp:self.app
|
||||
instanceRegistry:self];
|
||||
_instances[key] = firestore;
|
||||
}
|
||||
return firestore;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeInstanceWithDatabase:(NSString *)database {
|
||||
@synchronized(_instances) {
|
||||
NSString *key = [self keyForDatabase:database];
|
||||
[_instances removeObjectForKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - FIRComponentLifecycleMaintainer
|
||||
|
||||
- (void)appWillBeDeleted:(__unused FIRApp *)app {
|
||||
NSDictionary<NSString *, FIRFirestore *> *instances;
|
||||
@synchronized(_instances) {
|
||||
instances = [_instances copy];
|
||||
[_instances removeAllObjects];
|
||||
}
|
||||
for (NSString *key in instances) {
|
||||
[instances[key] terminateInternalWithCompletion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
+ (void)load {
|
||||
[FIRApp registerInternalLibrary:(Class<FIRLibrary>)self withName:@"fire-fst"];
|
||||
}
|
||||
|
||||
#pragma mark - Interoperability
|
||||
|
||||
+ (NSArray<FIRComponent *> *)componentsToRegister {
|
||||
FIRDependency *auth = [FIRDependency dependencyWithProtocol:@protocol(FIRAuthInterop)
|
||||
isRequired:NO];
|
||||
FIRComponent *firestoreProvider = [FIRComponent
|
||||
componentWithProtocol:@protocol(FSTFirestoreMultiDBProvider)
|
||||
instantiationTiming:FIRInstantiationTimingLazy
|
||||
dependencies:@[ auth ]
|
||||
creationBlock:^id _Nullable(FIRComponentContainer *container, BOOL *isCacheable) {
|
||||
FSTFirestoreComponent *multiDBComponent =
|
||||
[[FSTFirestoreComponent alloc] initWithApp:container.app];
|
||||
*isCacheable = YES;
|
||||
return multiDBComponent;
|
||||
}];
|
||||
return @[ firestoreProvider ];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h"
|
||||
#include "Firestore/core/src/core/core_fwd.h"
|
||||
#include "Firestore/core/src/model/database_id.h"
|
||||
#include "Firestore/core/src/model/model_fwd.h"
|
||||
#include "Firestore/core/src/nanopb/message.h"
|
||||
|
||||
@class FIRTimestamp;
|
||||
|
||||
namespace core = firebase::firestore::core;
|
||||
namespace model = firebase::firestore::model;
|
||||
namespace nanopb = firebase::firestore::nanopb;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* An internal representation of FIRDocumentReference, representing a key in a specific database.
|
||||
* This is necessary because keys assume a database from context (usually the current one).
|
||||
* FSTDocumentKeyReference binds a key to a specific databaseID.
|
||||
*
|
||||
* TODO(b/64160088): Make DocumentKey aware of the specific databaseID it is tied to.
|
||||
*/
|
||||
@interface FSTDocumentKeyReference : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
- (instancetype)initWithKey:(model::DocumentKey)key
|
||||
databaseID:(model::DatabaseId)databaseID NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (const model::DocumentKey &)key;
|
||||
|
||||
@property(nonatomic, assign, readonly) const model::DatabaseId &databaseID;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* An interface that allows arbitrary pre-converting of user data.
|
||||
*
|
||||
* Returns the converted value (can return back the input to act as a no-op).
|
||||
*/
|
||||
typedef id _Nullable (^FSTPreConverterBlock)(id _Nullable);
|
||||
|
||||
/**
|
||||
* Helper for parsing raw user input (provided via the API) into internal model classes.
|
||||
*/
|
||||
@interface FSTUserDataReader : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)initWithDatabaseID:(model::DatabaseId)databaseID
|
||||
preConverter:(FSTPreConverterBlock)preConverter NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/** Parse document data from a non-merge setData call.*/
|
||||
- (core::ParsedSetData)parsedSetData:(id)input;
|
||||
|
||||
/** Parse document data from a setData call with `merge:YES`. */
|
||||
- (core::ParsedSetData)parsedMergeData:(id)input fieldMask:(nullable NSArray<id> *)fieldMask;
|
||||
|
||||
/** Parse update data from an updateData call. */
|
||||
- (core::ParsedUpdateData)parsedUpdateData:(id)input;
|
||||
|
||||
/** Parse a "query value" (e.g. value in a where filter or a value in a cursor bound). */
|
||||
- (nanopb::Message<firebase::firestore::google_firestore_v1_Value>)parsedQueryValue:(id)input;
|
||||
|
||||
/**
|
||||
* Parse a "query value" (e.g. value in a where filter or a value in a cursor bound).
|
||||
*
|
||||
* @param allowArrays Whether the query value is an array that may directly contain additional
|
||||
* arrays (e.g.) the operand of an `in` query).
|
||||
*/
|
||||
- (nanopb::Message<firebase::firestore::google_firestore_v1_Value>)parsedQueryValue:(id)input
|
||||
allowArrays:
|
||||
(bool)allowArrays;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,627 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "Firestore/Source/API/FSTUserDataReader.h"
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#import "FIRGeoPoint.h"
|
||||
#import "FIRTimestamp.h"
|
||||
|
||||
#import "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFieldPath+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFieldValue+Internal.h"
|
||||
#import "Firestore/Source/API/FIRFirestore+Internal.h"
|
||||
#import "Firestore/Source/API/FIRGeoPoint+Internal.h"
|
||||
#import "Firestore/Source/API/converters.h"
|
||||
#import "Firestore/core/include/firebase/firestore/geo_point.h"
|
||||
|
||||
#include "Firestore/core/src/core/user_data.h"
|
||||
#include "Firestore/core/src/model/database_id.h"
|
||||
#include "Firestore/core/src/model/document_key.h"
|
||||
#include "Firestore/core/src/model/field_mask.h"
|
||||
#include "Firestore/core/src/model/field_path.h"
|
||||
#include "Firestore/core/src/model/field_transform.h"
|
||||
#include "Firestore/core/src/model/object_value.h"
|
||||
#include "Firestore/core/src/model/precondition.h"
|
||||
#include "Firestore/core/src/model/resource_path.h"
|
||||
#include "Firestore/core/src/model/transform_operation.h"
|
||||
#include "Firestore/core/src/model/value_util.h"
|
||||
#include "Firestore/core/src/nanopb/nanopb_util.h"
|
||||
#include "Firestore/core/src/nanopb/reader.h"
|
||||
#include "Firestore/core/src/remote/serializer.h"
|
||||
#include "Firestore/core/src/timestamp_internal.h"
|
||||
#include "Firestore/core/src/util/exception.h"
|
||||
#include "Firestore/core/src/util/hard_assert.h"
|
||||
#include "Firestore/core/src/util/read_context.h"
|
||||
#include "Firestore/core/src/util/string_apple.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace nanopb = firebase::firestore::nanopb;
|
||||
using firebase::Timestamp;
|
||||
using firebase::TimestampInternal;
|
||||
using firebase::firestore::GeoPoint;
|
||||
using firebase::firestore::core::ParseAccumulator;
|
||||
using firebase::firestore::core::ParseContext;
|
||||
using firebase::firestore::core::ParsedSetData;
|
||||
using firebase::firestore::core::ParsedUpdateData;
|
||||
using firebase::firestore::core::UserDataSource;
|
||||
using firebase::firestore::model::ArrayTransform;
|
||||
using firebase::firestore::model::DatabaseId;
|
||||
using firebase::firestore::model::DocumentKey;
|
||||
using firebase::firestore::model::FieldMask;
|
||||
using firebase::firestore::model::FieldPath;
|
||||
using firebase::firestore::model::FieldTransform;
|
||||
using firebase::firestore::model::NullValue;
|
||||
using firebase::firestore::model::NumericIncrementTransform;
|
||||
using firebase::firestore::model::ObjectValue;
|
||||
using firebase::firestore::model::ResourcePath;
|
||||
using firebase::firestore::model::ServerTimestampTransform;
|
||||
using firebase::firestore::model::TransformOperation;
|
||||
using firebase::firestore::nanopb::CheckedSize;
|
||||
using firebase::firestore::nanopb::Message;
|
||||
using firebase::firestore::remote::Serializer;
|
||||
using firebase::firestore::util::MakeString;
|
||||
using firebase::firestore::util::ThrowInvalidArgument;
|
||||
using firebase::firestore::util::ReadContext;
|
||||
using firebase::firestore::google_firestore_v1_Value;
|
||||
using firebase::firestore::google_firestore_v1_MapValue;
|
||||
using firebase::firestore::google_firestore_v1_ArrayValue;
|
||||
using firebase::firestore::google_protobuf_NullValue_NULL_VALUE;
|
||||
using firebase::firestore::google_firestore_v1_MapValue_FieldsEntry;
|
||||
using firebase::firestore::google_type_LatLng;
|
||||
using firebase::firestore::google_protobuf_Timestamp;
|
||||
using nanopb::StringReader;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - FSTDocumentKeyReference
|
||||
|
||||
@implementation FSTDocumentKeyReference {
|
||||
DocumentKey _key;
|
||||
DatabaseId _databaseID;
|
||||
}
|
||||
|
||||
- (instancetype)initWithKey:(DocumentKey)key databaseID:(DatabaseId)databaseID {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_key = std::move(key);
|
||||
_databaseID = std::move(databaseID);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (const model::DocumentKey &)key {
|
||||
return _key;
|
||||
}
|
||||
|
||||
- (const model::DatabaseId &)databaseID {
|
||||
return _databaseID;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - FSTUserDataReader
|
||||
|
||||
@interface FSTUserDataReader ()
|
||||
@property(strong, nonatomic, readonly) FSTPreConverterBlock preConverter;
|
||||
@end
|
||||
|
||||
@implementation FSTUserDataReader {
|
||||
DatabaseId _databaseID;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDatabaseID:(DatabaseId)databaseID
|
||||
preConverter:(FSTPreConverterBlock)preConverter {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_databaseID = std::move(databaseID);
|
||||
_preConverter = preConverter;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (ParsedSetData)parsedSetData:(id)input {
|
||||
// NOTE: The public API is typed as NSDictionary but we type 'input' as 'id' since we can't trust
|
||||
// Obj-C to verify the type for us.
|
||||
if (![input isKindOfClass:[NSDictionary class]]) {
|
||||
ThrowInvalidArgument("Data to be written must be an NSDictionary.");
|
||||
}
|
||||
|
||||
ParseAccumulator accumulator{UserDataSource::Set};
|
||||
auto updateData = [self parseData:input context:accumulator.RootContext()];
|
||||
HARD_ASSERT(updateData.has_value(), "Parsed data should not be nil.");
|
||||
|
||||
return std::move(accumulator).SetData(ObjectValue{std::move(*updateData)});
|
||||
}
|
||||
|
||||
- (ParsedSetData)parsedMergeData:(id)input fieldMask:(nullable NSArray<id> *)fieldMask {
|
||||
// NOTE: The public API is typed as NSDictionary but we type 'input' as 'id' since we can't trust
|
||||
// Obj-C to verify the type for us.
|
||||
if (![input isKindOfClass:[NSDictionary class]]) {
|
||||
ThrowInvalidArgument("Data to be written must be an NSDictionary.");
|
||||
}
|
||||
|
||||
ParseAccumulator accumulator{UserDataSource::MergeSet};
|
||||
|
||||
auto updateData = [self parseData:input context:accumulator.RootContext()];
|
||||
HARD_ASSERT(updateData.has_value(), "Parsed data should not be nil.");
|
||||
|
||||
ObjectValue updateObject{std::move(*updateData)};
|
||||
|
||||
if (fieldMask) {
|
||||
std::set<FieldPath> validatedFieldPaths;
|
||||
for (id fieldPath in fieldMask) {
|
||||
FieldPath path;
|
||||
|
||||
if ([fieldPath isKindOfClass:[NSString class]]) {
|
||||
path = FieldPath::FromDotSeparatedString(MakeString(fieldPath));
|
||||
} else if ([fieldPath isKindOfClass:[FIRFieldPath class]]) {
|
||||
path = static_cast<FIRFieldPath *>(fieldPath).internalValue;
|
||||
} else {
|
||||
ThrowInvalidArgument("All elements in mergeFields: must be NSStrings or FIRFieldPaths.");
|
||||
}
|
||||
|
||||
// Verify that all elements specified in the field mask are part of the parsed context.
|
||||
if (!accumulator.Contains(path)) {
|
||||
ThrowInvalidArgument(
|
||||
"Field '%s' is specified in your field mask but missing from your input data.",
|
||||
path.CanonicalString());
|
||||
}
|
||||
|
||||
validatedFieldPaths.insert(path);
|
||||
}
|
||||
|
||||
return std::move(accumulator)
|
||||
.MergeData(std::move(updateObject), FieldMask{std::move(validatedFieldPaths)});
|
||||
|
||||
} else {
|
||||
return std::move(accumulator).MergeData(std::move(updateObject));
|
||||
}
|
||||
}
|
||||
|
||||
- (ParsedUpdateData)parsedUpdateData:(id)input {
|
||||
// NOTE: The public API is typed as NSDictionary but we type 'input' as 'id' since we can't trust
|
||||
// Obj-C to verify the type for us.
|
||||
if (![input isKindOfClass:[NSDictionary class]]) {
|
||||
ThrowInvalidArgument("Data to be written must be an NSDictionary.");
|
||||
}
|
||||
|
||||
NSDictionary *dict = input;
|
||||
|
||||
ParseAccumulator accumulator{UserDataSource::Update};
|
||||
__block ParseContext context = accumulator.RootContext();
|
||||
__block ObjectValue updateData;
|
||||
|
||||
[dict enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *) {
|
||||
FieldPath path;
|
||||
|
||||
if ([key isKindOfClass:[NSString class]]) {
|
||||
path = FieldPath::FromDotSeparatedString(MakeString(key));
|
||||
} else if ([key isKindOfClass:[FIRFieldPath class]]) {
|
||||
path = ((FIRFieldPath *)key).internalValue;
|
||||
} else {
|
||||
ThrowInvalidArgument("Dictionary keys in updateData: must be NSStrings or FIRFieldPaths.");
|
||||
}
|
||||
|
||||
value = self.preConverter(value);
|
||||
if ([value isKindOfClass:[FSTDeleteFieldValue class]]) {
|
||||
// Add it to the field mask, but don't add anything to updateData.
|
||||
context.AddToFieldMask(std::move(path));
|
||||
} else {
|
||||
auto parsedValue = [self parseData:value context:context.ChildContext(path)];
|
||||
if (parsedValue) {
|
||||
context.AddToFieldMask(path);
|
||||
updateData.Set(path, std::move(*parsedValue));
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
return std::move(accumulator).UpdateData(std::move(updateData));
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)parsedQueryValue:(id)input {
|
||||
return [self parsedQueryValue:input allowArrays:false];
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)parsedQueryValue:(id)input allowArrays:(bool)allowArrays {
|
||||
ParseAccumulator accumulator{allowArrays ? UserDataSource::ArrayArgument
|
||||
: UserDataSource::Argument};
|
||||
|
||||
auto parsed = [self parseData:input context:accumulator.RootContext()];
|
||||
HARD_ASSERT(parsed, "Parsed data should not be nil.");
|
||||
HARD_ASSERT(accumulator.field_transforms().empty(),
|
||||
"Field transforms should have been disallowed.");
|
||||
return std::move(*parsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal helper for parsing user data.
|
||||
*
|
||||
* @param input Data to be parsed.
|
||||
* @param context A context object representing the current path being parsed, the source of the
|
||||
* data being parsed, etc.
|
||||
*
|
||||
* @return The parsed value, or nil if the value was a FieldValue sentinel that should not be
|
||||
* included in the resulting parsed data.
|
||||
*/
|
||||
- (absl::optional<Message<google_firestore_v1_Value>>)parseData:(id)input
|
||||
context:(ParseContext &&)context {
|
||||
input = self.preConverter(input);
|
||||
if ([input isKindOfClass:[NSDictionary class]]) {
|
||||
return [self parseDictionary:(NSDictionary *)input context:std::move(context)];
|
||||
|
||||
} else if ([input isKindOfClass:[FIRFieldValue class]]) {
|
||||
// FieldValues usually parse into transforms (except FieldValue.delete()) in which case we
|
||||
// do not want to include this field in our parsed data (as doing so will overwrite the field
|
||||
// directly prior to the transform trying to transform it). So we don't call appendToFieldMask
|
||||
// and we return nil as our parsing result.
|
||||
[self parseSentinelFieldValue:(FIRFieldValue *)input context:std::move(context)];
|
||||
return absl::nullopt;
|
||||
|
||||
} else {
|
||||
// If context path is unset we are already inside an array and we don't support field mask paths
|
||||
// more granular than the top-level array.
|
||||
if (context.path()) {
|
||||
context.AddToFieldMask(*context.path());
|
||||
}
|
||||
|
||||
if ([input isKindOfClass:[NSArray class]]) {
|
||||
// TODO(b/34871131): Include the path containing the array in the error message.
|
||||
// In the case of IN queries, the parsed data is an array (representing the set of values to
|
||||
// be included for the IN query) that may directly contain additional arrays (each
|
||||
// representing an individual field value), so we disable this validation.
|
||||
if (context.array_element() && context.data_source() != UserDataSource::ArrayArgument) {
|
||||
ThrowInvalidArgument("Nested arrays are not supported");
|
||||
}
|
||||
return [self parseArray:(NSArray *)input context:std::move(context)];
|
||||
} else {
|
||||
return [self parseScalarValue:input context:std::move(context)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)parseDictionary:(NSDictionary<NSString *, id> *)dict
|
||||
context:(ParseContext &&)context {
|
||||
__block Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_map_value_tag;
|
||||
result->map_value = {};
|
||||
|
||||
if (dict.count == 0) {
|
||||
const FieldPath *path = context.path();
|
||||
if (path && !path->empty()) {
|
||||
context.AddToFieldMask(*path);
|
||||
}
|
||||
} else {
|
||||
// Compute the final size of the fields array, which contains an entry for
|
||||
// all fields that are not FieldValue sentinels
|
||||
__block pb_size_t count = 0;
|
||||
[dict enumerateKeysAndObjectsUsingBlock:^(NSString *, id value, BOOL *) {
|
||||
if (![value isKindOfClass:[FIRFieldValue class]]) {
|
||||
++count;
|
||||
}
|
||||
}];
|
||||
|
||||
result->map_value.fields_count = count;
|
||||
result->map_value.fields = nanopb::MakeArray<google_firestore_v1_MapValue_FieldsEntry>(count);
|
||||
|
||||
__block pb_size_t index = 0;
|
||||
[dict enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *) {
|
||||
auto parsedValue = [self parseData:value context:context.ChildContext(MakeString(key))];
|
||||
if (parsedValue) {
|
||||
result->map_value.fields[index].key = nanopb::MakeBytesArray(MakeString(key));
|
||||
result->map_value.fields[index].value = *parsedValue->release();
|
||||
++index;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)parseArray:(NSArray<id> *)array
|
||||
context:(ParseContext &&)context {
|
||||
__block Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_array_value_tag;
|
||||
result->array_value.values_count = CheckedSize([array count]);
|
||||
result->array_value.values =
|
||||
nanopb::MakeArray<google_firestore_v1_Value>(result->array_value.values_count);
|
||||
|
||||
[array enumerateObjectsUsingBlock:^(id entry, NSUInteger idx, BOOL *) {
|
||||
auto parsedEntry = [self parseData:entry context:context.ChildContext(idx)];
|
||||
if (!parsedEntry) {
|
||||
// Just include nulls in the array for fields being replaced with a sentinel.
|
||||
parsedEntry = NullValue();
|
||||
}
|
||||
result->array_value.values[idx] = *parsedEntry->release();
|
||||
}];
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* "Parses" the provided FIRFieldValue, adding any necessary transforms to
|
||||
* context.fieldTransforms.
|
||||
*/
|
||||
- (void)parseSentinelFieldValue:(FIRFieldValue *)fieldValue context:(ParseContext &&)context {
|
||||
// Sentinels are only supported with writes, and not within arrays.
|
||||
if (!context.write()) {
|
||||
ThrowInvalidArgument("%s can only be used with updateData() and setData()%s",
|
||||
fieldValue.methodName, context.FieldDescription());
|
||||
}
|
||||
if (!context.path()) {
|
||||
ThrowInvalidArgument("%s is not currently supported inside arrays", fieldValue.methodName);
|
||||
}
|
||||
|
||||
if ([fieldValue isKindOfClass:[FSTDeleteFieldValue class]]) {
|
||||
if (context.data_source() == UserDataSource::MergeSet) {
|
||||
// No transform to add for a delete, but we need to add it to our fieldMask so it gets
|
||||
// deleted.
|
||||
context.AddToFieldMask(*context.path());
|
||||
|
||||
} else if (context.data_source() == UserDataSource::Update) {
|
||||
HARD_ASSERT(!context.path()->empty(),
|
||||
"FieldValue.delete() at the top level should have already been handled.");
|
||||
ThrowInvalidArgument("FieldValue.delete() can only appear at the top level of your "
|
||||
"update data%s",
|
||||
context.FieldDescription());
|
||||
} else {
|
||||
// We shouldn't encounter delete sentinels for queries or non-merge setData calls.
|
||||
ThrowInvalidArgument(
|
||||
"FieldValue.delete() can only be used with updateData() and setData() with merge:true%s",
|
||||
context.FieldDescription());
|
||||
}
|
||||
|
||||
} else if ([fieldValue isKindOfClass:[FSTServerTimestampFieldValue class]]) {
|
||||
context.AddToFieldTransforms(*context.path(), ServerTimestampTransform());
|
||||
|
||||
} else if ([fieldValue isKindOfClass:[FSTArrayUnionFieldValue class]]) {
|
||||
auto parsedElements =
|
||||
[self parseArrayTransformElements:((FSTArrayUnionFieldValue *)fieldValue).elements];
|
||||
ArrayTransform arrayUnion(TransformOperation::Type::ArrayUnion, std::move(parsedElements));
|
||||
context.AddToFieldTransforms(*context.path(), std::move(arrayUnion));
|
||||
|
||||
} else if ([fieldValue isKindOfClass:[FSTArrayRemoveFieldValue class]]) {
|
||||
auto parsedElements =
|
||||
[self parseArrayTransformElements:((FSTArrayRemoveFieldValue *)fieldValue).elements];
|
||||
ArrayTransform arrayRemove(TransformOperation::Type::ArrayRemove, std::move(parsedElements));
|
||||
context.AddToFieldTransforms(*context.path(), std::move(arrayRemove));
|
||||
|
||||
} else if ([fieldValue isKindOfClass:[FSTNumericIncrementFieldValue class]]) {
|
||||
auto *numericIncrementFieldValue = (FSTNumericIncrementFieldValue *)fieldValue;
|
||||
auto operand = [self parsedQueryValue:numericIncrementFieldValue.operand];
|
||||
NumericIncrementTransform numeric_increment(std::move(operand));
|
||||
|
||||
context.AddToFieldTransforms(*context.path(), std::move(numeric_increment));
|
||||
|
||||
} else {
|
||||
HARD_FAIL("Unknown FIRFieldValue type: %s", NSStringFromClass([fieldValue class]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to parse a scalar value (i.e. not an NSDictionary, NSArray, or FIRFieldValue).
|
||||
*
|
||||
* Note that it handles all NSNumber values that are encodable as int64_t or doubles
|
||||
* (depending on the underlying type of the NSNumber). Unsigned integer values are handled though
|
||||
* any value outside what is representable by int64_t (a signed 64-bit value) will throw an
|
||||
* exception.
|
||||
*
|
||||
* @return The parsed value.
|
||||
*/
|
||||
- (Message<google_firestore_v1_Value>)parseScalarValue:(nullable id)input
|
||||
context:(ParseContext &&)context {
|
||||
if (!input || [input isMemberOfClass:[NSNull class]]) {
|
||||
return NullValue();
|
||||
|
||||
} else if ([input isKindOfClass:[NSNumber class]]) {
|
||||
// Recover the underlying type of the number, using the method described here:
|
||||
// http://stackoverflow.com/questions/2518761/get-type-of-nsnumber
|
||||
const char *cType = [input objCType];
|
||||
|
||||
// Type Encoding values taken from
|
||||
// https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/
|
||||
// Articles/ocrtTypeEncodings.html
|
||||
switch (cType[0]) {
|
||||
case 'q':
|
||||
return [self encodeInteger:[input longLongValue]];
|
||||
|
||||
case 'i': // Falls through.
|
||||
case 's': // Falls through.
|
||||
case 'l': // Falls through.
|
||||
case 'I': // Falls through.
|
||||
case 'S':
|
||||
// Coerce integer values that aren't long long. Allow unsigned integer types that are
|
||||
// guaranteed small enough to skip a length check.
|
||||
return [self encodeInteger:[input longLongValue]];
|
||||
|
||||
case 'L': // Falls through.
|
||||
case 'Q':
|
||||
// Unsigned integers that could be too large. Note that the 'L' (long) case is handled here
|
||||
// because when compiled for LP64, unsigned long is 64 bits and could overflow int64_t.
|
||||
{
|
||||
unsigned long long extended = [input unsignedLongLongValue];
|
||||
|
||||
if (extended > LLONG_MAX) {
|
||||
ThrowInvalidArgument("NSNumber (%s) is too large%s", [input unsignedLongLongValue],
|
||||
context.FieldDescription());
|
||||
|
||||
} else {
|
||||
return [self encodeInteger:static_cast<int64_t>(extended)];
|
||||
}
|
||||
}
|
||||
|
||||
case 'f':
|
||||
return [self encodeDouble:[input doubleValue]];
|
||||
|
||||
case 'd':
|
||||
// Double values are already the right type, so just reuse the existing boxed double.
|
||||
//
|
||||
// Note that NSNumber already performs NaN normalization to a single shared instance
|
||||
// so there's no need to treat NaN specially here.
|
||||
return [self encodeDouble:[input doubleValue]];
|
||||
|
||||
case 'B': // Falls through.
|
||||
case 'c': // Falls through.
|
||||
case 'C':
|
||||
// Boolean values are weird.
|
||||
//
|
||||
// On arm64, objCType of a BOOL-valued NSNumber will be "c", even though @encode(BOOL)
|
||||
// returns "B". "c" is the same as @encode(signed char). Unfortunately this means that
|
||||
// legitimate usage of signed chars is impossible, but this should be rare.
|
||||
//
|
||||
// Additionally, for consistency, map unsigned chars to bools in the same way.
|
||||
return [self encodeBoolean:[input boolValue]];
|
||||
|
||||
default:
|
||||
// All documented codes should be handled above, so this shouldn't happen.
|
||||
HARD_FAIL("Unknown NSNumber objCType %s on %s", cType, input);
|
||||
}
|
||||
|
||||
} else if ([input isKindOfClass:[NSString class]]) {
|
||||
std::string inputString = MakeString(input);
|
||||
return [self encodeStringValue:inputString];
|
||||
|
||||
} else if ([input isKindOfClass:[NSDate class]]) {
|
||||
NSDate *inputDate = input;
|
||||
return [self encodeTimestampValue:api::MakeTimestamp(inputDate)];
|
||||
|
||||
} else if ([input isKindOfClass:[FIRTimestamp class]]) {
|
||||
FIRTimestamp *inputTimestamp = input;
|
||||
Timestamp timestamp = TimestampInternal::Truncate(api::MakeTimestamp(inputTimestamp));
|
||||
return [self encodeTimestampValue:timestamp];
|
||||
|
||||
} else if ([input isKindOfClass:[FIRGeoPoint class]]) {
|
||||
return [self encodeGeoPoint:api::MakeGeoPoint(input)];
|
||||
} else if ([input isKindOfClass:[NSData class]]) {
|
||||
NSData *inputData = input;
|
||||
return [self encodeBlob:(nanopb::MakeByteString(inputData))];
|
||||
|
||||
} else if ([input isKindOfClass:[FSTDocumentKeyReference class]]) {
|
||||
FSTDocumentKeyReference *reference = input;
|
||||
if (reference.databaseID != _databaseID) {
|
||||
const DatabaseId &other = reference.databaseID;
|
||||
ThrowInvalidArgument(
|
||||
"Document Reference is for database %s/%s but should be for database %s/%s%s",
|
||||
other.project_id(), other.database_id(), _databaseID.project_id(),
|
||||
_databaseID.database_id(), context.FieldDescription());
|
||||
}
|
||||
return [self encodeReference:_databaseID key:reference.key];
|
||||
|
||||
} else {
|
||||
ThrowInvalidArgument("Unsupported type: %s%s", NSStringFromClass([input class]),
|
||||
context.FieldDescription());
|
||||
}
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)encodeBoolean:(bool)value {
|
||||
Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_boolean_value_tag;
|
||||
result->boolean_value = value;
|
||||
return result;
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)encodeInteger:(int64_t)value {
|
||||
Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_integer_value_tag;
|
||||
result->integer_value = value;
|
||||
return result;
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)encodeDouble:(double)value {
|
||||
Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_double_value_tag;
|
||||
result->double_value = value;
|
||||
return result;
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)encodeTimestampValue:(Timestamp)value {
|
||||
Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_timestamp_value_tag;
|
||||
result->timestamp_value.seconds = value.seconds();
|
||||
result->timestamp_value.nanos = value.nanoseconds();
|
||||
return result;
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)encodeStringValue:(const std::string &)value {
|
||||
Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_string_value_tag;
|
||||
result->string_value = nanopb::MakeBytesArray(value);
|
||||
return result;
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)encodeBlob:(const nanopb::ByteString &)value {
|
||||
Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_bytes_value_tag;
|
||||
// Copy the blob so that pb_release can do the right thing.
|
||||
result->bytes_value = nanopb::CopyBytesArray(value.get());
|
||||
return result;
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)encodeReference:(const DatabaseId &)databaseId
|
||||
key:(const DocumentKey &)key {
|
||||
HARD_ASSERT(_databaseID == databaseId, "Database %s cannot encode reference from %s",
|
||||
_databaseID.ToString(), databaseId.ToString());
|
||||
|
||||
std::string referenceName = ResourcePath({"projects", databaseId.project_id(), "databases",
|
||||
databaseId.database_id(), "documents", key.ToString()})
|
||||
.CanonicalString();
|
||||
|
||||
Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_reference_value_tag;
|
||||
result->reference_value = nanopb::MakeBytesArray(referenceName);
|
||||
return result;
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_Value>)encodeGeoPoint:(const GeoPoint &)value {
|
||||
Message<google_firestore_v1_Value> result;
|
||||
result->which_value_type = google_firestore_v1_Value_geo_point_value_tag;
|
||||
result->geo_point_value.latitude = value.latitude();
|
||||
result->geo_point_value.longitude = value.longitude();
|
||||
return result;
|
||||
}
|
||||
|
||||
- (Message<google_firestore_v1_ArrayValue>)parseArrayTransformElements:(NSArray<id> *)elements {
|
||||
ParseAccumulator accumulator{UserDataSource::Argument};
|
||||
|
||||
Message<google_firestore_v1_ArrayValue> array_value;
|
||||
array_value->values_count = CheckedSize(elements.count);
|
||||
array_value->values = nanopb::MakeArray<google_firestore_v1_Value>(array_value->values_count);
|
||||
|
||||
for (NSUInteger i = 0; i < elements.count; i++) {
|
||||
id element = elements[i];
|
||||
// Although array transforms are used with writes, the actual elements being unioned or removed
|
||||
// are not considered writes since they cannot contain any FieldValue sentinels, etc.
|
||||
ParseContext context = accumulator.RootContext();
|
||||
|
||||
auto parsedElement = [self parseData:element context:context.ChildContext(i)];
|
||||
HARD_ASSERT(parsedElement && accumulator.field_transforms().empty(),
|
||||
"Failed to properly parse array transform element: %s", element);
|
||||
array_value->values[i] = *parsedElement->release();
|
||||
}
|
||||
return array_value;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h"
|
||||
#include "Firestore/Source/API/FIRDocumentSnapshot+Internal.h"
|
||||
#include "Firestore/core/src/api/api_fwd.h"
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
|
||||
/**
|
||||
* Converts Firestore's internal types to the API types that we expose to the
|
||||
* user.
|
||||
*/
|
||||
@interface FSTUserDataWriter : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
- (instancetype)initWithFirestore:(std::shared_ptr<api::Firestore>)firestore
|
||||
serverTimestampBehavior:(FIRServerTimestampBehavior)serverTimestampBehavior;
|
||||
|
||||
- (id)convertedValue:(const firebase::firestore::google_firestore_v1_Value&)value;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,166 @@
|
||||
// Copyright 2021 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "Firestore/Source/API/FSTUserDataWriter.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h"
|
||||
#include "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#include "Firestore/Source/API/converters.h"
|
||||
#include "Firestore/core/include/firebase/firestore/geo_point.h"
|
||||
#include "Firestore/core/include/firebase/firestore/timestamp.h"
|
||||
#include "Firestore/core/src/api/firestore.h"
|
||||
#include "Firestore/core/src/model/database_id.h"
|
||||
#include "Firestore/core/src/model/document_key.h"
|
||||
#include "Firestore/core/src/model/server_timestamp_util.h"
|
||||
#include "Firestore/core/src/model/value_util.h"
|
||||
#include "Firestore/core/src/nanopb/nanopb_util.h"
|
||||
#include "Firestore/core/src/util/hard_assert.h"
|
||||
#include "Firestore/core/src/util/log.h"
|
||||
#include "Firestore/core/src/util/string_apple.h"
|
||||
|
||||
@class FIRTimestamp;
|
||||
|
||||
namespace api = firebase::firestore::api;
|
||||
namespace model = firebase::firestore::model;
|
||||
namespace nanopb = firebase::firestore::nanopb;
|
||||
|
||||
using api::MakeFIRDocumentReference;
|
||||
using api::MakeFIRGeoPoint;
|
||||
using api::MakeFIRTimestamp;
|
||||
using firebase::firestore::GeoPoint;
|
||||
using firebase::firestore::google_firestore_v1_ArrayValue;
|
||||
using firebase::firestore::google_firestore_v1_MapValue;
|
||||
using firebase::firestore::google_firestore_v1_Value;
|
||||
using firebase::firestore::google_protobuf_Timestamp;
|
||||
using firebase::firestore::util::MakeNSString;
|
||||
using model::DatabaseId;
|
||||
using model::DocumentKey;
|
||||
using model::GetLocalWriteTime;
|
||||
using model::GetPreviousValue;
|
||||
using model::GetTypeOrder;
|
||||
using model::TypeOrder;
|
||||
using nanopb::MakeByteString;
|
||||
using nanopb::MakeBytesArray;
|
||||
using nanopb::MakeNSData;
|
||||
using nanopb::MakeString;
|
||||
using nanopb::MakeStringView;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation FSTUserDataWriter {
|
||||
std::shared_ptr<api::Firestore> _firestore;
|
||||
FIRServerTimestampBehavior _serverTimestampBehavior;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFirestore:(std::shared_ptr<api::Firestore>)firestore
|
||||
serverTimestampBehavior:(FIRServerTimestampBehavior)serverTimestampBehavior {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_firestore = std::move(firestore);
|
||||
_serverTimestampBehavior = serverTimestampBehavior;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)convertedValue:(const google_firestore_v1_Value &)value {
|
||||
switch (GetTypeOrder(value)) {
|
||||
case TypeOrder::kMap:
|
||||
return [self convertedObject:value.map_value];
|
||||
case TypeOrder::kArray:
|
||||
return [self convertedArray:value.array_value];
|
||||
case TypeOrder::kReference:
|
||||
return [self convertedReference:value];
|
||||
case TypeOrder::kTimestamp:
|
||||
return [self convertedTimestamp:value.timestamp_value];
|
||||
case TypeOrder::kServerTimestamp:
|
||||
return [self convertedServerTimestamp:value];
|
||||
case TypeOrder::kNull:
|
||||
return [NSNull null];
|
||||
case TypeOrder::kBoolean:
|
||||
return value.boolean_value ? @YES : @NO;
|
||||
case TypeOrder::kNumber:
|
||||
return value.which_value_type == google_firestore_v1_Value_integer_value_tag
|
||||
? @(value.integer_value)
|
||||
: @(value.double_value);
|
||||
case TypeOrder::kString:
|
||||
return MakeNSString(MakeStringView(value.string_value));
|
||||
case TypeOrder::kBlob:
|
||||
return MakeNSData(value.bytes_value);
|
||||
case TypeOrder::kGeoPoint:
|
||||
return MakeFIRGeoPoint(
|
||||
GeoPoint(value.geo_point_value.latitude, value.geo_point_value.longitude));
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
- (NSDictionary<NSString *, id> *)convertedObject:(const google_firestore_v1_MapValue &)mapValue {
|
||||
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
||||
for (pb_size_t i = 0; i < mapValue.fields_count; ++i) {
|
||||
absl::string_view key = MakeStringView(mapValue.fields[i].key);
|
||||
const google_firestore_v1_Value &value = mapValue.fields[i].value;
|
||||
result[MakeNSString(key)] = [self convertedValue:value];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSArray<id> *)convertedArray:(const google_firestore_v1_ArrayValue &)arrayValue {
|
||||
NSMutableArray *result = [NSMutableArray arrayWithCapacity:arrayValue.values_count];
|
||||
for (pb_size_t i = 0; i < arrayValue.values_count; ++i) {
|
||||
[result addObject:[self convertedValue:arrayValue.values[i]]];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
- (id)convertedServerTimestamp:(const google_firestore_v1_Value &)serverTimestampValue {
|
||||
switch (_serverTimestampBehavior) {
|
||||
case FIRServerTimestampBehavior::FIRServerTimestampBehaviorNone:
|
||||
return [NSNull null];
|
||||
case FIRServerTimestampBehavior::FIRServerTimestampBehaviorEstimate:
|
||||
return [self convertedTimestamp:GetLocalWriteTime(serverTimestampValue)];
|
||||
case FIRServerTimestampBehavior::FIRServerTimestampBehaviorPrevious: {
|
||||
auto previous_value = GetPreviousValue(serverTimestampValue);
|
||||
return previous_value ? [self convertedValue:*previous_value] : [NSNull null];
|
||||
}
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
- (FIRTimestamp *)convertedTimestamp:(const google_protobuf_Timestamp &)value {
|
||||
return MakeFIRTimestamp(firebase::Timestamp{value.seconds, value.nanos});
|
||||
}
|
||||
|
||||
- (FIRDocumentReference *)convertedReference:(const google_firestore_v1_Value &)value {
|
||||
std::string ref = MakeString(value.reference_value);
|
||||
DatabaseId databaseID = DatabaseId::FromName(ref);
|
||||
DocumentKey key = DocumentKey::FromName(ref);
|
||||
if (databaseID != _firestore->database_id()) {
|
||||
LOG_WARN("Document reference is for a different database (%s/%s) which "
|
||||
"is not supported. It will be treated as a reference within the current database "
|
||||
"(%s/%s) instead.",
|
||||
databaseID.project_id(), databaseID.database_id(), databaseID.project_id(),
|
||||
databaseID.database_id());
|
||||
}
|
||||
return MakeFIRDocumentReference(key, _firestore);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2019 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FIRESTORE_SOURCE_API_CONVERTERS_H_
|
||||
#define FIRESTORE_SOURCE_API_CONVERTERS_H_
|
||||
|
||||
#if !defined(__OBJC__)
|
||||
#error "This header only supports Objective-C++"
|
||||
#endif // !defined(__OBJC__)
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@class FIRGeoPoint;
|
||||
@class FIRTimestamp;
|
||||
@class FIRDocumentReference;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
namespace firebase {
|
||||
|
||||
class Timestamp;
|
||||
|
||||
namespace firestore {
|
||||
|
||||
class GeoPoint;
|
||||
|
||||
namespace model {
|
||||
class DocumentKey;
|
||||
}
|
||||
|
||||
namespace api {
|
||||
|
||||
class Firestore;
|
||||
|
||||
/** Converts a user-supplied FIRGeoPoint to the equivalent C++ GeoPoint. */
|
||||
GeoPoint MakeGeoPoint(FIRGeoPoint* geo_point);
|
||||
|
||||
/** Converts a C++ GeoPoint to the equivalent Objective-C FIRGeoPoint. */
|
||||
FIRGeoPoint* MakeFIRGeoPoint(const GeoPoint& geo_point);
|
||||
|
||||
/** Converts a user-supplied FIRTimestamp to the equivalent C++ Timestamp. */
|
||||
Timestamp MakeTimestamp(FIRTimestamp* timestamp);
|
||||
Timestamp MakeTimestamp(NSDate* date);
|
||||
|
||||
FIRTimestamp* MakeFIRTimestamp(const Timestamp& timestamp);
|
||||
|
||||
FIRDocumentReference* MakeFIRDocumentReference(const model::DocumentKey& document_key,
|
||||
std::shared_ptr<Firestore> firestore);
|
||||
|
||||
} // namespace api
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#endif // FIRESTORE_SOURCE_API_CONVERTERS_H_
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2019 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "Firestore/Source/API/converters.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#import "FIRGeoPoint.h"
|
||||
#import "FIRTimestamp.h"
|
||||
|
||||
#include "Firestore/Source/API/FIRDocumentReference+Internal.h"
|
||||
#include "Firestore/core/include/firebase/firestore/geo_point.h"
|
||||
#include "Firestore/core/include/firebase/firestore/timestamp.h"
|
||||
#include "Firestore/core/src/api/firestore.h"
|
||||
#include "Firestore/core/src/model/document_key.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
namespace firebase {
|
||||
namespace firestore {
|
||||
namespace api {
|
||||
|
||||
GeoPoint MakeGeoPoint(FIRGeoPoint* geo_point) {
|
||||
return GeoPoint(geo_point.latitude, geo_point.longitude);
|
||||
}
|
||||
|
||||
FIRGeoPoint* MakeFIRGeoPoint(const GeoPoint& geo_point) {
|
||||
return [[FIRGeoPoint alloc] initWithLatitude:geo_point.latitude()
|
||||
longitude:geo_point.longitude()];
|
||||
}
|
||||
|
||||
Timestamp MakeTimestamp(FIRTimestamp* timestamp) {
|
||||
return Timestamp(timestamp.seconds, timestamp.nanoseconds);
|
||||
}
|
||||
|
||||
Timestamp MakeTimestamp(NSDate* date) {
|
||||
FIRTimestamp* timestamp = [FIRTimestamp timestampWithDate:date];
|
||||
return MakeTimestamp(timestamp);
|
||||
}
|
||||
|
||||
FIRTimestamp* MakeFIRTimestamp(const Timestamp& timestamp) {
|
||||
return [[FIRTimestamp alloc] initWithSeconds:timestamp.seconds()
|
||||
nanoseconds:timestamp.nanoseconds()];
|
||||
}
|
||||
|
||||
FIRDocumentReference* MakeFIRDocumentReference(const model::DocumentKey& key,
|
||||
std::shared_ptr<Firestore> firestore) {
|
||||
return [[FIRDocumentReference alloc] initWithKey:key firestore:std::move(firestore)];
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
} // namespace firestore
|
||||
} // namespace firebase
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "FIRQuery.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class FIRDocumentReference;
|
||||
|
||||
/**
|
||||
* A `FIRCollectionReference` object can be used for adding documents, getting document references,
|
||||
* and querying for documents (using the methods inherited from `FIRQuery`).
|
||||
*/
|
||||
NS_SWIFT_NAME(CollectionReference)
|
||||
@interface FIRCollectionReference : FIRQuery
|
||||
|
||||
/** :nodoc: */
|
||||
- (id)init __attribute__((unavailable("FIRCollectionReference cannot be created directly.")));
|
||||
|
||||
/** ID of the referenced collection. */
|
||||
@property(nonatomic, strong, readonly) NSString *collectionID;
|
||||
|
||||
/**
|
||||
* For subcollections, `parent` returns the containing `FIRDocumentReference`. For root
|
||||
* collections, nil is returned.
|
||||
*/
|
||||
@property(nonatomic, strong, nullable, readonly) FIRDocumentReference *parent;
|
||||
|
||||
/**
|
||||
* A string containing the slash-separated path to this this `FIRCollectionReference` (relative to
|
||||
* the root of the database).
|
||||
*/
|
||||
@property(nonatomic, strong, readonly) NSString *path;
|
||||
|
||||
/**
|
||||
* Returns a FIRDocumentReference pointing to a new document with an auto-generated ID.
|
||||
*
|
||||
* @return A FIRDocumentReference pointing to a new document with an auto-generated ID.
|
||||
*/
|
||||
- (FIRDocumentReference *)documentWithAutoID NS_SWIFT_NAME(document());
|
||||
|
||||
/**
|
||||
* Gets a `FIRDocumentReference` referring to the document at the specified path, relative to this
|
||||
* collection's own path.
|
||||
*
|
||||
* @param documentPath The slash-separated relative path of the document for which to get a
|
||||
* `FIRDocumentReference`.
|
||||
*
|
||||
* @return The `FIRDocumentReference` for the specified document path.
|
||||
*/
|
||||
- (FIRDocumentReference *)documentWithPath:(NSString *)documentPath NS_SWIFT_NAME(document(_:));
|
||||
|
||||
/**
|
||||
* Adds a new document to this collection with the specified data, assigning it a document ID
|
||||
* automatically.
|
||||
*
|
||||
* @param data An `NSDictionary` containing the data for the new document.
|
||||
*
|
||||
* @return A `FIRDocumentReference` pointing to the newly created document.
|
||||
*/
|
||||
- (FIRDocumentReference *)addDocumentWithData:(NSDictionary<NSString *, id> *)data
|
||||
NS_SWIFT_NAME(addDocument(data:));
|
||||
|
||||
/**
|
||||
* Adds a new document to this collection with the specified data, assigning it a document ID
|
||||
* automatically.
|
||||
*
|
||||
* @param data An `NSDictionary` containing the data for the new document.
|
||||
* @param completion A block to execute once the document has been successfully written to
|
||||
* the server. This block will not be called while the client is offline, though local
|
||||
* changes will be visible immediately.
|
||||
*
|
||||
* @return A `FIRDocumentReference` pointing to the newly created document.
|
||||
*/
|
||||
// clang-format off
|
||||
// clang-format breaks the NS_SWIFT_NAME attribute
|
||||
- (FIRDocumentReference *)addDocumentWithData:(NSDictionary<NSString *, id> *)data
|
||||
completion:
|
||||
(nullable void (^)(NSError *_Nullable error))completion
|
||||
NS_SWIFT_NAME(addDocument(data:completion:));
|
||||
// clang-format on
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class FIRQueryDocumentSnapshot;
|
||||
|
||||
#if defined(NS_CLOSED_ENUM)
|
||||
/** An enumeration of document change types. */
|
||||
typedef NS_CLOSED_ENUM(NSInteger, FIRDocumentChangeType)
|
||||
#else
|
||||
/** An enumeration of document change types. */
|
||||
typedef NS_ENUM(NSInteger, FIRDocumentChangeType)
|
||||
#endif
|
||||
{
|
||||
/** Indicates a new document was added to the set of documents matching the query. */
|
||||
FIRDocumentChangeTypeAdded,
|
||||
/** Indicates a document within the query was modified. */
|
||||
FIRDocumentChangeTypeModified,
|
||||
/**
|
||||
* Indicates a document within the query was removed (either deleted or no longer matches
|
||||
* the query.
|
||||
*/
|
||||
FIRDocumentChangeTypeRemoved
|
||||
} NS_SWIFT_NAME(DocumentChangeType);
|
||||
|
||||
/**
|
||||
* A `FIRDocumentChange` represents a change to the documents matching a query. It contains the
|
||||
* document affected and the type of change that occurred (added, modified, or removed).
|
||||
*/
|
||||
NS_SWIFT_NAME(DocumentChange)
|
||||
@interface FIRDocumentChange : NSObject
|
||||
|
||||
/** :nodoc: */
|
||||
- (id)init __attribute__((unavailable("FIRDocumentChange cannot be created directly.")));
|
||||
|
||||
/** The type of change that occurred (added, modified, or removed). */
|
||||
@property(nonatomic, readonly) FIRDocumentChangeType type;
|
||||
|
||||
/** The document affected by this change. */
|
||||
@property(nonatomic, strong, readonly) FIRQueryDocumentSnapshot *document;
|
||||
|
||||
/**
|
||||
* The index of the changed document in the result set immediately prior to this FIRDocumentChange
|
||||
* (i.e. supposing that all prior FIRDocumentChange objects have been applied). NSNotFound for
|
||||
* FIRDocumentChangeTypeAdded events.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSUInteger oldIndex;
|
||||
|
||||
/**
|
||||
* The index of the changed document in the result set immediately after this FIRDocumentChange
|
||||
* (i.e. supposing that all prior FIRDocumentChange objects and the current FIRDocumentChange object
|
||||
* have been applied). NSNotFound for FIRDocumentChangeTypeRemoved events.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSUInteger newIndex;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+264
@@ -0,0 +1,264 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "FIRFirestoreSource.h"
|
||||
#import "FIRListenerRegistration.h"
|
||||
|
||||
@class FIRCollectionReference;
|
||||
@class FIRDocumentSnapshot;
|
||||
@class FIRFirestore;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A block type used to handle snapshot updates.
|
||||
*/
|
||||
typedef void (^FIRDocumentSnapshotBlock)(FIRDocumentSnapshot *_Nullable snapshot,
|
||||
NSError *_Nullable error);
|
||||
|
||||
/**
|
||||
* A `FIRDocumentReference` refers to a document location in a Firestore database and can be
|
||||
* used to write, read, or listen to the location. The document at the referenced location
|
||||
* may or may not exist. A `FIRDocumentReference` can also be used to create a
|
||||
* `FIRCollectionReference` to a subcollection.
|
||||
*/
|
||||
NS_SWIFT_NAME(DocumentReference)
|
||||
@interface FIRDocumentReference : NSObject
|
||||
|
||||
/** :nodoc: */
|
||||
- (instancetype)init
|
||||
__attribute__((unavailable("FIRDocumentReference cannot be created directly.")));
|
||||
|
||||
/** The ID of the document referred to. */
|
||||
@property(nonatomic, strong, readonly) NSString *documentID;
|
||||
|
||||
/** A reference to the collection to which this `DocumentReference` belongs. */
|
||||
@property(nonatomic, strong, readonly) FIRCollectionReference *parent;
|
||||
|
||||
/** The `FIRFirestore` for the Firestore database (useful for performing transactions, etc.). */
|
||||
@property(nonatomic, strong, readonly) FIRFirestore *firestore;
|
||||
|
||||
/**
|
||||
* A string representing the path of the referenced document (relative to the root of the
|
||||
* database).
|
||||
*/
|
||||
@property(nonatomic, strong, readonly) NSString *path;
|
||||
|
||||
/**
|
||||
* Gets a `FIRCollectionReference` referring to the collection at the specified
|
||||
* path, relative to this document.
|
||||
*
|
||||
* @param collectionPath The slash-separated relative path of the collection for which to get a
|
||||
* `FIRCollectionReference`.
|
||||
*
|
||||
* @return The `FIRCollectionReference` at the specified _collectionPath_.
|
||||
*/
|
||||
- (FIRCollectionReference *)collectionWithPath:(NSString *)collectionPath
|
||||
NS_SWIFT_NAME(collection(_:));
|
||||
|
||||
#pragma mark - Writing Data
|
||||
|
||||
/**
|
||||
* Writes to the document referred to by `FIRDocumentReference`. If the document doesn't yet exist,
|
||||
* this method creates it and then sets the data. If the document exists, this method overwrites
|
||||
* the document data with the new values.
|
||||
*
|
||||
* @param documentData An `NSDictionary` that contains the fields and data to write to the
|
||||
* document.
|
||||
*/
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData;
|
||||
|
||||
/**
|
||||
* Writes to the document referred to by this DocumentReference. If the document does not yet
|
||||
* exist, it will be created. If you pass `merge:YES`, the provided data will be merged into
|
||||
* any existing document.
|
||||
*
|
||||
* @param documentData An `NSDictionary` that contains the fields and data to write to the
|
||||
* document.
|
||||
* @param merge Whether to merge the provided data into any existing document.
|
||||
*/
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData merge:(BOOL)merge;
|
||||
|
||||
/**
|
||||
* Writes to the document referred to by `document` and only replace the fields
|
||||
* specified under `mergeFields`. Any field that is not specified in `mergeFields`
|
||||
* is ignored and remains untouched. If the document doesn't yet exist,
|
||||
* this method creates it and then sets the data.
|
||||
*
|
||||
* It is an error to include a field in `mergeFields` that does not have a corresponding
|
||||
* value in the `data` dictionary.
|
||||
*
|
||||
* @param documentData An `NSDictionary` containing the fields that make up the document
|
||||
* to be written.
|
||||
* @param mergeFields An `NSArray` that contains a list of `NSString` or `FIRFieldPath` elements
|
||||
* specifying which fields to merge. Fields can contain dots to reference nested fields within
|
||||
* the document.
|
||||
*/
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData mergeFields:(NSArray<id> *)mergeFields;
|
||||
|
||||
/**
|
||||
* Overwrites the document referred to by this `FIRDocumentReference`. If no document exists, it
|
||||
* is created. If a document already exists, it is overwritten.
|
||||
*
|
||||
* @param documentData An `NSDictionary` containing the fields that make up the document
|
||||
* to be written.
|
||||
* @param completion A block to execute once the document has been successfully written to the
|
||||
* server. This block will not be called while the client is offline, though local
|
||||
* changes will be visible immediately.
|
||||
*/
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData
|
||||
completion:(nullable void (^)(NSError *_Nullable error))completion;
|
||||
|
||||
/**
|
||||
* Writes to the document referred to by this DocumentReference. If the document does not yet
|
||||
* exist, it will be created. If you pass `merge:YES`, the provided data will be merged into
|
||||
* any existing document.
|
||||
*
|
||||
* @param documentData An `NSDictionary` containing the fields that make up the document
|
||||
* to be written.
|
||||
* @param merge Whether to merge the provided data into any existing document.
|
||||
* @param completion A block to execute once the document has been successfully written to the
|
||||
* server. This block will not be called while the client is offline, though local
|
||||
* changes will be visible immediately.
|
||||
*/
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData
|
||||
merge:(BOOL)merge
|
||||
completion:(nullable void (^)(NSError *_Nullable error))completion;
|
||||
|
||||
/**
|
||||
* Writes to the document referred to by `document` and only replace the fields
|
||||
* specified under `mergeFields`. Any field that is not specified in `mergeFields`
|
||||
* is ignored and remains untouched. If the document doesn't yet exist,
|
||||
* this method creates it and then sets the data.
|
||||
*
|
||||
* It is an error to include a field in `mergeFields` that does not have a corresponding
|
||||
* value in the `data` dictionary.
|
||||
*
|
||||
* @param documentData An `NSDictionary` containing the fields that make up the document
|
||||
* to be written.
|
||||
* @param mergeFields An `NSArray` that contains a list of `NSString` or `FIRFieldPath` elements
|
||||
* specifying which fields to merge. Fields can contain dots to reference nested fields within
|
||||
* the document.
|
||||
* @param completion A block to execute once the document has been successfully written to the
|
||||
* server. This block will not be called while the client is offline, though local
|
||||
* changes will be visible immediately.
|
||||
*/
|
||||
- (void)setData:(NSDictionary<NSString *, id> *)documentData
|
||||
mergeFields:(NSArray<id> *)mergeFields
|
||||
completion:(nullable void (^)(NSError *_Nullable error))completion;
|
||||
|
||||
/**
|
||||
* Updates fields in the document referred to by this `FIRDocumentReference`.
|
||||
* If the document does not exist, the update fails (specify a completion block to be notified).
|
||||
*
|
||||
* @param fields An `NSDictionary` containing the fields (expressed as an `NSString` or
|
||||
* `FIRFieldPath`) and values with which to update the document.
|
||||
*/
|
||||
- (void)updateData:(NSDictionary<id, id> *)fields;
|
||||
|
||||
/**
|
||||
* Updates fields in the document referred to by this `FIRDocumentReference`. If the document
|
||||
* does not exist, the update fails and the specified completion block receives an error.
|
||||
*
|
||||
* @param fields An `NSDictionary` containing the fields (expressed as an `NSString` or
|
||||
* `FIRFieldPath`) and values with which to update the document.
|
||||
* @param completion A block to execute when the update is complete. If the update is successful the
|
||||
* error parameter will be nil, otherwise it will give an indication of how the update failed.
|
||||
* This block will only execute when the client is online and the commit has completed against
|
||||
* the server. The completion handler will not be called when the device is offline, though
|
||||
* local changes will be visible immediately.
|
||||
*/
|
||||
- (void)updateData:(NSDictionary<id, id> *)fields
|
||||
completion:(nullable void (^)(NSError *_Nullable error))completion;
|
||||
|
||||
// NOTE: this is named 'deleteDocument' because 'delete' is a keyword in Objective-C++.
|
||||
/** Deletes the document referred to by this `FIRDocumentReference`. */
|
||||
// clang-format off
|
||||
- (void)deleteDocument NS_SWIFT_NAME(delete());
|
||||
// clang-format on
|
||||
|
||||
/**
|
||||
* Deletes the document referred to by this `FIRDocumentReference`.
|
||||
*
|
||||
* @param completion A block to execute once the document has been successfully written to the
|
||||
* server. This block will not be called while the client is offline, though local
|
||||
* changes will be visible immediately.
|
||||
*/
|
||||
// clang-format off
|
||||
- (void)deleteDocumentWithCompletion:(nullable void (^)(NSError *_Nullable error))completion
|
||||
NS_SWIFT_NAME(delete(completion:));
|
||||
// clang-format on
|
||||
|
||||
#pragma mark - Retrieving Data
|
||||
|
||||
/**
|
||||
* Reads the document referenced by this `FIRDocumentReference`.
|
||||
*
|
||||
* This method attempts to provide up-to-date data when possible by waiting for
|
||||
* data from the server, but it may return cached data or fail if you are
|
||||
* offline and the server cannot be reached. See the
|
||||
* `getDocument(source:completion:)` method to change this behavior.
|
||||
*
|
||||
* @param completion a block to execute once the document has been successfully read.
|
||||
*/
|
||||
- (void)getDocumentWithCompletion:(FIRDocumentSnapshotBlock)completion
|
||||
NS_SWIFT_NAME(getDocument(completion:));
|
||||
|
||||
/**
|
||||
* Reads the document referenced by this `FIRDocumentReference`.
|
||||
*
|
||||
* @param source indicates whether the results should be fetched from the cache
|
||||
* only (`Source.cache`), the server only (`Source.server`), or to attempt
|
||||
* the server and fall back to the cache (`Source.default`).
|
||||
* @param completion a block to execute once the document has been successfully read.
|
||||
*/
|
||||
// clang-format off
|
||||
- (void)getDocumentWithSource:(FIRFirestoreSource)source
|
||||
completion:(FIRDocumentSnapshotBlock)completion
|
||||
NS_SWIFT_NAME(getDocument(source:completion:));
|
||||
// clang-format on
|
||||
|
||||
/**
|
||||
* Attaches a listener for DocumentSnapshot events.
|
||||
*
|
||||
* @param listener The listener to attach.
|
||||
*
|
||||
* @return A FIRListenerRegistration that can be used to remove this listener.
|
||||
*/
|
||||
- (id<FIRListenerRegistration>)addSnapshotListener:(FIRDocumentSnapshotBlock)listener
|
||||
NS_SWIFT_NAME(addSnapshotListener(_:));
|
||||
|
||||
/**
|
||||
* Attaches a listener for DocumentSnapshot events.
|
||||
*
|
||||
* @param includeMetadataChanges Whether metadata-only changes (i.e. only
|
||||
* `FIRDocumentSnapshot.metadata` changed) should trigger snapshot events.
|
||||
* @param listener The listener to attach.
|
||||
*
|
||||
* @return A FIRListenerRegistration that can be used to remove this listener.
|
||||
*/
|
||||
// clang-format off
|
||||
- (id<FIRListenerRegistration>)
|
||||
addSnapshotListenerWithIncludeMetadataChanges:(BOOL)includeMetadataChanges
|
||||
listener:(FIRDocumentSnapshotBlock)listener
|
||||
NS_SWIFT_NAME(addSnapshotListener(includeMetadataChanges:listener:));
|
||||
// clang-format on
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class FIRDocumentReference;
|
||||
@class FIRSnapshotMetadata;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Controls the return value for server timestamps that have not yet been set to
|
||||
* their final value.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, FIRServerTimestampBehavior) {
|
||||
/**
|
||||
* Return `NSNull` for `FieldValue.serverTimestamp()` fields that have not yet
|
||||
* been set to their final value.
|
||||
*/
|
||||
FIRServerTimestampBehaviorNone,
|
||||
|
||||
/**
|
||||
* Return a local estimates for `FieldValue.serverTimestamp()`
|
||||
* fields that have not yet been set to their final value. This estimate will
|
||||
* likely differ from the final value and may cause these pending values to
|
||||
* change once the server result becomes available.
|
||||
*/
|
||||
FIRServerTimestampBehaviorEstimate,
|
||||
|
||||
/**
|
||||
* Return the previous value for `FieldValue.serverTimestamp()` fields that
|
||||
* have not yet been set to their final value.
|
||||
*/
|
||||
FIRServerTimestampBehaviorPrevious
|
||||
} NS_SWIFT_NAME(ServerTimestampBehavior);
|
||||
|
||||
/**
|
||||
* A `FIRDocumentSnapshot` contains data read from a document in your Firestore database. The data
|
||||
* can be extracted with the `data` property or by using subscript syntax to access a specific
|
||||
* field.
|
||||
*
|
||||
* For a `FIRDocumentSnapshot` that points to a non-existing document, any data access will return
|
||||
* `nil`. You can use the `exists` property to explicitly verify a documents existence.
|
||||
*/
|
||||
NS_SWIFT_NAME(DocumentSnapshot)
|
||||
@interface FIRDocumentSnapshot : NSObject
|
||||
|
||||
/** :nodoc: */
|
||||
- (instancetype)init
|
||||
__attribute__((unavailable("FIRDocumentSnapshot cannot be created directly.")));
|
||||
|
||||
/** True if the document exists. */
|
||||
@property(nonatomic, assign, readonly) BOOL exists;
|
||||
|
||||
/** A `FIRDocumentReference` to the document location. */
|
||||
@property(nonatomic, strong, readonly) FIRDocumentReference *reference;
|
||||
|
||||
/** The ID of the document for which this `FIRDocumentSnapshot` contains data. */
|
||||
@property(nonatomic, copy, readonly) NSString *documentID;
|
||||
|
||||
/** Metadata about this snapshot concerning its source and if it has local modifications. */
|
||||
@property(nonatomic, strong, readonly) FIRSnapshotMetadata *metadata;
|
||||
|
||||
/**
|
||||
* Retrieves all fields in the document as an `NSDictionary`. Returns `nil` if the document doesn't
|
||||
* exist.
|
||||
*
|
||||
* Server-provided timestamps that have not yet been set to their final value will be returned as
|
||||
* `NSNull`. You can use `dataWithServerTimestampBehavior()` to configure this behavior.
|
||||
*
|
||||
* @return An `NSDictionary` containing all fields in the document or `nil` if the document doesn't
|
||||
* exist.
|
||||
*/
|
||||
- (nullable NSDictionary<NSString *, id> *)data;
|
||||
|
||||
/**
|
||||
* Retrieves all fields in the document as a `Dictionary`. Returns `nil` if the document doesn't
|
||||
* exist.
|
||||
*
|
||||
* @param serverTimestampBehavior Configures how server timestamps that have not yet been set to
|
||||
* their final value are returned from the snapshot.
|
||||
* @return A `Dictionary` containing all fields in the document or `nil` if the document doesn't
|
||||
* exist.
|
||||
*/
|
||||
- (nullable NSDictionary<NSString *, id> *)dataWithServerTimestampBehavior:
|
||||
(FIRServerTimestampBehavior)serverTimestampBehavior;
|
||||
|
||||
/**
|
||||
* Retrieves a specific field from the document. Returns `nil` if the document or the field doesn't
|
||||
* exist.
|
||||
*
|
||||
* The timestamps that have not yet been set to their final value will be returned as `NSNull`. The
|
||||
* can use `get(_:serverTimestampBehavior:)` to configure this behavior.
|
||||
*
|
||||
* @param field The field to retrieve.
|
||||
* @return The value contained in the field or `nil` if the document or field doesn't exist.
|
||||
*/
|
||||
- (nullable id)valueForField:(id)field NS_SWIFT_NAME(get(_:));
|
||||
|
||||
/**
|
||||
* Retrieves a specific field from the document. Returns `nil` if the document or the field doesn't
|
||||
* exist.
|
||||
*
|
||||
* The timestamps that have not yet been set to their final value will be returned as `NSNull`. The
|
||||
* can use `get(_:serverTimestampBehavior:)` to configure this behavior.
|
||||
*
|
||||
* @param field The field to retrieve.
|
||||
* @param serverTimestampBehavior Configures how server timestamps that have not yet been set to
|
||||
* their final value are returned from the snapshot.
|
||||
* @return The value contained in the field or `nil` if the document or field doesn't exist.
|
||||
*/
|
||||
// clang-format off
|
||||
- (nullable id)valueForField:(id)field
|
||||
serverTimestampBehavior:(FIRServerTimestampBehavior)serverTimestampBehavior
|
||||
NS_SWIFT_NAME(get(_:serverTimestampBehavior:));
|
||||
// clang-format on
|
||||
|
||||
/**
|
||||
* Retrieves a specific field from the document.
|
||||
*
|
||||
* @param key The field to retrieve.
|
||||
*
|
||||
* @return The value contained in the field or `nil` if the document or field doesn't exist.
|
||||
*/
|
||||
- (nullable id)objectForKeyedSubscript:(id)key;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* A `FIRQueryDocumentSnapshot` contains data read from a document in your Firestore database as
|
||||
* part of a query. The document is guaranteed to exist and its data can be extracted with the
|
||||
* `data` property or by using subscript syntax to access a specific field.
|
||||
*
|
||||
* A `FIRQueryDocumentSnapshot` offers the same API surface as a `FIRDocumentSnapshot`. As
|
||||
* deleted documents are not returned from queries, its `exists` property will always be true and
|
||||
* `data:` will never return `nil`.
|
||||
*/
|
||||
NS_SWIFT_NAME(QueryDocumentSnapshot)
|
||||
@interface FIRQueryDocumentSnapshot : FIRDocumentSnapshot
|
||||
|
||||
/** :nodoc: */
|
||||
- (instancetype)init
|
||||
__attribute__((unavailable("FIRQueryDocumentSnapshot cannot be created directly.")));
|
||||
|
||||
/**
|
||||
* Retrieves all fields in the document as an `NSDictionary`.
|
||||
*
|
||||
* Server-provided timestamps that have not yet been set to their final value will be returned as
|
||||
* `NSNull`. You can use `dataWithServerTimestampBehavior()` to configure this behavior.
|
||||
*
|
||||
* @return An `NSDictionary` containing all fields in the document.
|
||||
*/
|
||||
- (NSDictionary<NSString *, id> *)data;
|
||||
|
||||
/**
|
||||
* Retrieves all fields in the document as a `Dictionary`.
|
||||
*
|
||||
* @param serverTimestampBehavior Configures how server timestamps that have not yet been set to
|
||||
* their final value are returned from the snapshot.
|
||||
* @return A `Dictionary` containing all fields in the document.
|
||||
*/
|
||||
- (NSDictionary<NSString *, id> *)dataWithServerTimestampBehavior:
|
||||
(FIRServerTimestampBehavior)serverTimestampBehavior;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A `FieldPath` refers to a field in a document. The path may consist of a single field name
|
||||
* (referring to a top level field in the document), or a list of field names (referring to a nested
|
||||
* field in the document).
|
||||
*/
|
||||
NS_SWIFT_NAME(FieldPath)
|
||||
@interface FIRFieldPath : NSObject <NSCopying>
|
||||
|
||||
/** :nodoc: */
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Creates a `FieldPath` from the provided field names. If more than one field name is provided, the
|
||||
* path will point to a nested field in a document.
|
||||
*
|
||||
* @param fieldNames A list of field names.
|
||||
* @return A `FieldPath` that points to a field location in a document.
|
||||
*/
|
||||
- (instancetype)initWithFields:(NSArray<NSString *> *)fieldNames NS_SWIFT_NAME(init(_:));
|
||||
|
||||
/**
|
||||
* A special sentinel `FieldPath` to refer to the ID of a document. It can be used in queries to
|
||||
* sort or filter by the document ID.
|
||||
*/
|
||||
+ (instancetype)documentID;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user