diff --git a/librarian.yaml b/librarian.yaml index 1a538d4e020e..de3662ef4bb1 100644 --- a/librarian.yaml +++ b/librarian.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. language: nodejs -version: v0.24.0 +version: v0.25.0 repo: googleapis/google-cloud-node sources: googleapis: @@ -926,6 +926,15 @@ libraries: copyright_year: "2026" nodejs: default_version: v1 + - name: google-cloud-firestore-api + version: 1.0.0 + apis: + - path: google/firestore/v1 + - path: google/firestore/admin/v1 + - path: google/firestore/v1beta1 + copyright_year: "2026" + nodejs: + package_name: '@google-cloud/firestore-api' - name: google-cloud-functions version: 4.2.2 apis: diff --git a/packages/google-cloud-firestore-api/.gitignore b/packages/google-cloud-firestore-api/.gitignore new file mode 100644 index 000000000000..d4f03a0df2e8 --- /dev/null +++ b/packages/google-cloud-firestore-api/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +/.coverage +/coverage +/.nyc_output +/docs/ +/out/ +/build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/packages/google-cloud-firestore-api/.jsdoc.js b/packages/google-cloud-firestore-api/.jsdoc.js new file mode 100644 index 000000000000..98cd8c6ba9e5 --- /dev/null +++ b/packages/google-cloud-firestore-api/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2026 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/firestore-api', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-firestore-api/.nycrc b/packages/google-cloud-firestore-api/.nycrc new file mode 100644 index 000000000000..81a95fc94b00 --- /dev/null +++ b/packages/google-cloud-firestore-api/.nycrc @@ -0,0 +1,24 @@ +{ + "report-dir": "./.coverage", + "reporter": ["text", "lcov"], + "exclude": [ + "**/*-test", + "**/.coverage", + "**/apis", + "**/benchmark", + "**/conformance", + "**/docs", + "**/samples", + "**/scripts", + "**/protos", + "**/test", + "**/*.d.ts", + ".jsdoc.js", + "**/.jsdoc.js", + "karma.conf.js", + "webpack-tests.config.js", + "webpack.config.js" + ], + "exclude-after-remap": false, + "all": true +} \ No newline at end of file diff --git a/packages/google-cloud-firestore-api/.repo-metadata.json b/packages/google-cloud-firestore-api/.repo-metadata.json new file mode 100644 index 000000000000..da79c86fe86f --- /dev/null +++ b/packages/google-cloud-firestore-api/.repo-metadata.json @@ -0,0 +1,16 @@ +{ + "api_description": "Accesses the NoSQL document database built for automatic scaling, high\nperformance, and ease of application development.", + "api_id": "firestore.googleapis.com", + "api_shortname": "firestore", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/firestore-api/latest", + "default_version": "v1", + "distribution_name": "@google-cloud/firestore-api", + "issue_tracker": "https://issuetracker.google.com/savedsearches/5337669", + "language": "nodejs", + "library_type": "GAPIC_AUTO", + "name": "firestore", + "name_pretty": "Cloud Firestore", + "product_documentation": "https://cloud.google.com/firestore/docs", + "release_level": "stable", + "repo": "googleapis/google-cloud-node" +} \ No newline at end of file diff --git a/packages/google-cloud-firestore-api/README.md b/packages/google-cloud-firestore-api/README.md new file mode 100644 index 000000000000..aea84b990053 --- /dev/null +++ b/packages/google-cloud-firestore-api/README.md @@ -0,0 +1,108 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "The comments you see below are used to generate those parts of the template in later states." +Google Cloud Platform logo + +# [Cloud Firestore API: Nodejs Client][homepage] + +[//]: # "releaseLevel" + +[![npm version](https://img.shields.io/npm/v/@google-cloud/firestore-api.svg)](https://www.npmjs.org/package/@google-cloud/firestore-api) + +Cloud Firestore API client for Node.js + +[//]: # "partials.introduction" + +A comprehensive list of changes in each version may be found in +[the CHANGELOG][homepage_changelog]. + +* [Cloud Firestore API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/admin/latest) + + +Read more about the client libraries for Cloud APIs, including the older +Google APIs Client Libraries, in [Client Libraries Explained][explained]. + +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained + +**Table of contents:** + +* [Quickstart](#quickstart) + * [Before you begin](#before-you-begin) + * [Installing the client library](#installing-the-client-library) + +* [Versioning](#versioning) +* [Contributing](#contributing) +* [License](#license) + +## Quickstart +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Cloud Firestore API API][enable_api]. +1. [Set up authentication][auth] so you can access the + API from your local workstation. +### Installing the client library + +```bash +npm install @google-cloud/firestore-api +``` + +[//]: # "partials.body" + +## Samples + +Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. + +[//]: # "samples" + +## Supported Node.js Versions + +Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). +Libraries are compatible with all current _active_ and _maintenance_ versions of +Node.js. +If you are using an end-of-life version of Node.js, we recommend that you update +as soon as possible to an actively supported LTS version. + +Google's client libraries support legacy versions of Node.js runtimes on a +best-efforts basis with the following warnings: + +* Legacy versions are not tested in continuous integration. +* Some security patches and features cannot be backported. +* Dependencies cannot be kept up-to-date. + +Client libraries targeting some end-of-life versions of Node.js are available, and +can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. +For example, `npm install @google-cloud/firestore-api@legacy-8` installs client libraries +for versions compatible with Node.js 8. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + +More Information: [Google Cloud Platform Launch Stages][launch_stages] + +[launch_stages]: https://cloud.google.com/terms/launch-stages + +## Contributing + +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). + +Please note that this `README.md` +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) +are generated from a central template. + +## License + +Apache Version 2.0 + +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) + +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[projects]: https://console.cloud.google.com/project +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=firestore.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local +[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-firestore-admin/samples +[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-firestore-admin/CHANGELOG.md +[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-firestore-admin diff --git a/packages/google-cloud-firestore-api/package.json b/packages/google-cloud-firestore-api/package.json new file mode 100644 index 000000000000..77fb88ac5a5d --- /dev/null +++ b/packages/google-cloud-firestore-api/package.json @@ -0,0 +1,62 @@ +{ + "name": "@google-cloud/firestore-api", + "version": "0.1.0", + "description": "Admin client for Node.js", + "repository": { + "type": "git", + "directory": "packages/google-cloud-firestore-api", + "url": "https://github.com/googleapis/google-cloud-node.git" + }, + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google admin", + "admin", + "firestore admin" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha --config ../../.mocharc.cjs --no-parallel build/system-test", + "test": "c8 mocha --config ../../.mocharc.cjs build/test" + }, + "dependencies": { + "google-gax": "^5.1.1-rc.1" + }, + "devDependencies": { + "@types/mocha": "^10.0.10", + "@types/node": "^22.18.12", + "@types/sinon": "^20.0.0", + "c8": "^10.1.3", + "gapic-tools": "^1.0.3", + "gts": "^6.0.2", + "jsdoc": "^4.0.5", + "jsdoc-fresh": "^5.0.2", + "jsdoc-region-tag": "^4.0.1", + "mocha": "^11.7.4", + "pack-n-play": "^4.2.1", + "typescript": "5.8.3", + "sinon": "^20.0.0" + }, + "engines": { + "node": ">=18" + } +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/backup.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/backup.proto new file mode 100644 index 000000000000..f4ff835d0dbe --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/backup.proto @@ -0,0 +1,112 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "BackupProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// A Backup of a Cloud Firestore Database. +// +// The backup contains all documents and index configurations for the given +// database at a specific point in time. +message Backup { + option (google.api.resource) = { + type: "firestore.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/backups/{backup}" + }; + + // Backup specific statistics. + message Stats { + // Output only. Summation of the size of all documents and index entries in + // the backup, measured in bytes. + int64 size_bytes = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total number of documents contained in the backup. + int64 document_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The total number of index entries contained in the backup. + int64 index_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Indicate the current state of the backup. + enum State { + // The state is unspecified. + STATE_UNSPECIFIED = 0; + + // The pending backup is still being created. Operations on the + // backup will be rejected in this state. + CREATING = 1; + + // The backup is complete and ready to use. + READY = 2; + + // The backup is not available at this moment. + NOT_AVAILABLE = 3; + } + + // Output only. The unique resource name of the Backup. + // + // Format is `projects/{project}/locations/{location}/backups/{backup}`. + // + // The location in the name will be the Standard Managed Multi-Region (SMMR) + // location (e.g. `us`) if the backup was created with an SMMR location, or + // the Google Managed Multi-Region (GMMR) location (e.g. `nam5`) if the backup + // was created with a GMMR location. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the Firestore database that the backup is from. + // + // Format is `projects/{project}/databases/{database}`. + string database = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + } + ]; + + // Output only. The system-generated UUID4 for the Firestore database that the + // backup is from. + string database_uid = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The backup contains an externally consistent copy of the + // database at this time. + google.protobuf.Timestamp snapshot_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp at which this backup expires. + google.protobuf.Timestamp expire_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Statistics about the backup. + // + // This data only becomes available after the backup is fully materialized to + // secondary storage. This field will be empty till then. + Stats stats = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the backup. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/database.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/database.proto new file mode 100644 index 000000000000..39f69e7e9071 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/database.proto @@ -0,0 +1,403 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/firestore/admin/v1/realtime_updates.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "DatabaseProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; +option (google.api.resource_definition) = { + type: "firestore.googleapis.com/Operation" + pattern: "projects/{project}/databases/{database}/operations/{operation}" +}; + +// A Cloud Firestore Database. +message Database { + option (google.api.resource) = { + type: "firestore.googleapis.com/Database" + pattern: "projects/{project}/databases/{database}" + style: DECLARATIVE_FRIENDLY + }; + + // The type of the database. + // See https://cloud.google.com/datastore/docs/firestore-or-datastore for + // information about how to choose. + // + // Mode changes are only allowed if the database is empty. + enum DatabaseType { + // Not used. + DATABASE_TYPE_UNSPECIFIED = 0; + + // Firestore Native Mode + FIRESTORE_NATIVE = 1; + + // Firestore in Datastore Mode. + DATASTORE_MODE = 2; + } + + // The type of concurrency control mode for transactions. + enum ConcurrencyMode { + // Not used. + CONCURRENCY_MODE_UNSPECIFIED = 0; + + // Use optimistic concurrency control by default. This mode is available + // for Cloud Firestore databases. + // + // This is the default setting for Cloud Firestore Enterprise Edition + // databases. + OPTIMISTIC = 1; + + // Use pessimistic concurrency control by default. This mode is available + // for Cloud Firestore databases. + // + // This is the default setting for Cloud Firestore Standard Edition + // databases. + PESSIMISTIC = 2; + + // Use optimistic concurrency control with entity groups by default. + // + // This mode is enabled for some databases that were automatically upgraded + // from Cloud Datastore to Cloud Firestore with Datastore Mode. + // + // It is not recommended for any new databases, and not supported for + // Firestore Native databases. + OPTIMISTIC_WITH_ENTITY_GROUPS = 3; + } + + // Point In Time Recovery feature enablement. + enum PointInTimeRecoveryEnablement { + // Not used. + POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED = 0; + + // Reads are supported on selected versions of the data from within the past + // 7 days: + // + // * Reads against any timestamp within the past hour + // * Reads against 1-minute snapshots beyond 1 hour and within 7 days + // + // `version_retention_period` and `earliest_version_time` can be + // used to determine the supported versions. + POINT_IN_TIME_RECOVERY_ENABLED = 1; + + // Reads are supported on any version of the data from within the past 1 + // hour. + POINT_IN_TIME_RECOVERY_DISABLED = 2; + } + + // The type of App Engine integration mode. + enum AppEngineIntegrationMode { + // Not used. + APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED = 0; + + // If an App Engine application exists in the same region as this database, + // App Engine configuration will impact this database. This includes + // disabling of the application & database, as well as disabling writes to + // the database. + ENABLED = 1; + + // App Engine has no effect on the ability of this database to serve + // requests. + // + // This is the default setting for databases created with the Firestore API. + DISABLED = 2; + } + + // The delete protection state of the database. + enum DeleteProtectionState { + // The default value. Delete protection type is not specified + DELETE_PROTECTION_STATE_UNSPECIFIED = 0; + + // Delete protection is disabled + DELETE_PROTECTION_DISABLED = 1; + + // Delete protection is enabled + DELETE_PROTECTION_ENABLED = 2; + } + + // The CMEK (Customer Managed Encryption Key) configuration for a Firestore + // database. If not present, the database is secured by the default Google + // encryption key. + message CmekConfig { + // Required. Only keys in the same location as this database are allowed to + // be used for encryption. + // + // For Firestore's nam5 multi-region, this corresponds to Cloud KMS + // multi-region us. For Firestore's eur3 multi-region, this corresponds to + // Cloud KMS multi-region europe. See + // https://cloud.google.com/kms/docs/locations. + // + // The expected format is + // `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Currently in-use [KMS key + // versions](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions). + // During [key rotation](https://cloud.google.com/kms/docs/key-rotation), + // there can be multiple in-use key versions. + // + // The expected format is + // `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{key_version}`. + repeated string active_key_version = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Information about the provenance of this database. + message SourceInfo { + // Information about a backup that was used to restore a database. + message BackupSource { + // The resource name of the backup that was used to restore this + // database. Format: + // `projects/{project}/locations/{location}/backups/{backup}`. + string backup = 1 [(google.api.resource_reference) = { + type: "firestore.googleapis.com/Backup" + }]; + } + + // The source from which this database is derived. + oneof source { + // If set, this database was restored from the specified backup (or a + // snapshot thereof). + BackupSource backup = 1; + } + + // The associated long-running operation. This field may not be set after + // the operation has completed. Format: + // `projects/{project}/databases/{database}/operations/{operation}`. + string operation = 3 [(google.api.resource_reference) = { + type: "firestore.googleapis.com/Operation" + }]; + } + + // Encryption configuration for a new database being created from another + // source. + // + // The source could be a [Backup][google.firestore.admin.v1.Backup] or a + // [PitrSnapshot][google.firestore.admin.v1.PitrSnapshot]. + message EncryptionConfig { + // The configuration options for using Google default encryption. + message GoogleDefaultEncryptionOptions {} + + // The configuration options for using the same encryption method as the + // source. + message SourceEncryptionOptions {} + + // The configuration options for using CMEK (Customer Managed Encryption + // Key) encryption. + message CustomerManagedEncryptionOptions { + // Required. Only keys in the same location as the database are allowed to + // be used for encryption. + // + // For Firestore's nam5 multi-region, this corresponds to Cloud KMS + // multi-region us. For Firestore's eur3 multi-region, this corresponds to + // Cloud KMS multi-region europe. See + // https://cloud.google.com/kms/docs/locations. + // + // The expected format is + // `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // The method for encrypting the database. + oneof encryption_type { + // Use Google default encryption. + GoogleDefaultEncryptionOptions google_default_encryption = 1; + + // The database will use the same encryption configuration as the source. + SourceEncryptionOptions use_source_encryption = 2; + + // Use Customer Managed Encryption Keys (CMEK) for encryption. + CustomerManagedEncryptionOptions customer_managed_encryption = 3; + } + } + + // The edition of the database. + enum DatabaseEdition { + // Not used. + DATABASE_EDITION_UNSPECIFIED = 0; + + // Standard edition. + // + // This is the default setting if not specified. + STANDARD = 1; + + // Enterprise edition. + ENTERPRISE = 2; + } + + // The data access mode. + enum DataAccessMode { + // Not Used. + DATA_ACCESS_MODE_UNSPECIFIED = 0; + + // Accessing the database through the API is allowed. + DATA_ACCESS_MODE_ENABLED = 1; + + // Accessing the database through the API is disallowed. + DATA_ACCESS_MODE_DISABLED = 2; + } + + // The resource name of the Database. + // Format: `projects/{project}/databases/{database}` + string name = 1; + + // Output only. The system-generated UUID4 for this Database. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp at which this database was created. Databases + // created before 2016 do not populate create_time. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp at which this database was most recently + // updated. Note this only includes updates to the database resource and not + // data contained by the database. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp at which this database was deleted. Only set if + // the database has been deleted. + google.protobuf.Timestamp delete_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The location of the database. Available locations are listed at + // https://cloud.google.com/firestore/docs/locations. + string location_id = 9; + + // The type of the database. + // See https://cloud.google.com/datastore/docs/firestore-or-datastore for + // information about how to choose. + DatabaseType type = 10; + + // The concurrency control mode to use for this database. + // + // If unspecified in a CreateDatabase request, this will default based on the + // database edition: Optimistic for Enterprise and Pessimistic for all other + // databases. + ConcurrencyMode concurrency_mode = 15; + + // Output only. The period during which past versions of data are retained in + // the database. + // + // Any [read][google.firestore.v1.GetDocumentRequest.read_time] + // or [query][google.firestore.v1.ListDocumentsRequest.read_time] can specify + // a `read_time` within this window, and will read the state of the database + // at that time. + // + // If the PITR feature is enabled, the retention period is 7 days. Otherwise, + // the retention period is 1 hour. + google.protobuf.Duration version_retention_period = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The earliest timestamp at which older versions of the data can + // be read from the database. See [version_retention_period] above; this field + // is populated with `now - version_retention_period`. + // + // This value is continuously updated, and becomes stale the moment it is + // queried. If you are using this value to recover data, make sure to account + // for the time from the moment when the value is queried to the moment when + // you initiate the recovery. + google.protobuf.Timestamp earliest_version_time = 18 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Whether to enable the PITR feature on this database. + PointInTimeRecoveryEnablement point_in_time_recovery_enablement = 21; + + // The App Engine integration mode to use for this database. + AppEngineIntegrationMode app_engine_integration_mode = 19; + + // Output only. The key_prefix for this database. This key_prefix is used, in + // combination with the project ID ("~") to construct + // the application ID that is returned from the Cloud Datastore APIs in Google + // App Engine first generation runtimes. + // + // This value may be empty in which case the appid to use for URL-encoded keys + // is the project_id (eg: foo instead of v~foo). + string key_prefix = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // State of delete protection for the database. + DeleteProtectionState delete_protection_state = 22; + + // Optional. Presence indicates CMEK is enabled for this database. + CmekConfig cmek_config = 23 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The database resource's prior database ID. This field is only + // populated for deleted databases. + string previous_id = 25 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Information about the provenance of this database. + SourceInfo source_info = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Input only. Immutable. Tag keys/values directly bound to this + // resource. For example: + // "123/environment": "production", + // "123/costCenter": "marketing" + map tags = 29 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; + + // Output only. Background: Free tier is the ability of a Firestore database + // to use a small amount of resources every day without being charged. Once + // usage exceeds the free tier limit further usage is charged. + // + // Whether this database can make use of the free tier. Only one database + // per project can be eligible for the free tier. + // + // The first (or next) database that is created in a project without a free + // tier database will be marked as eligible for the free tier. Databases that + // are created while there is a free tier database will not be eligible for + // the free tier. + optional bool free_tier = 30 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // This checksum is computed by the server based on the value of other + // fields, and may be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 99; + + // Immutable. The edition of the database. + DatabaseEdition database_edition = 28 + [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The default Realtime Updates mode to use for this database. + RealtimeUpdatesMode realtime_updates_mode = 31 + [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. The Firestore API data access mode to use for this database. If + // not set on write: + // - the default value is DATA_ACCESS_MODE_DISABLED for Enterprise Edition. + // - the default value is DATA_ACCESS_MODE_ENABLED for Standard Edition. + DataAccessMode firestore_data_access_mode = 33 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The MongoDB compatible API data access mode to use for this + // database. If not set on write, the default value is + // DATA_ACCESS_MODE_ENABLED for Enterprise Edition. The value is always + // DATA_ACCESS_MODE_DISABLED for Standard Edition. + DataAccessMode mongodb_compatible_data_access_mode = 34 + [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/field.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/field.proto new file mode 100644 index 000000000000..239d791c01fb --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/field.proto @@ -0,0 +1,154 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/firestore/admin/v1/index.proto"; +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "FieldProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// Represents a single field in the database. +// +// Fields are grouped by their "Collection Group", which represent all +// collections in the database with the same ID. +message Field { + option (google.api.resource) = { + type: "firestore.googleapis.com/Field" + pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}" + }; + + // The index configuration for this field. + message IndexConfig { + // The indexes supported for this field. + repeated Index indexes = 1; + + // Output only. When true, the `Field`'s index configuration is set from the + // configuration specified by the `ancestor_field`. + // When false, the `Field`'s index configuration is defined explicitly. + bool uses_ancestor_config = 2; + + // Output only. Specifies the resource name of the `Field` from which this + // field's index configuration is set (when `uses_ancestor_config` is true), + // or from which it *would* be set if this field had no index configuration + // (when `uses_ancestor_config` is false). + string ancestor_field = 3; + + // Output only + // When true, the `Field`'s index configuration is in the process of being + // reverted. Once complete, the index config will transition to the same + // state as the field specified by `ancestor_field`, at which point + // `uses_ancestor_config` will be `true` and `reverting` will be `false`. + bool reverting = 4; + } + + // The TTL (time-to-live) configuration for documents that have this `Field` + // set. + // + // A timestamp stored in a TTL-enabled field will be used to determine the + // expiration time of the document. The expiration time is the sum + // of the timestamp value and the `expiration_offset`. + // + // For Enterprise edition databases, the timestamp value may alternatively be + // stored in an array value in the TTL-enabled field. + // + // An expiration time in the past indicates that the document is eligible for + // immediate expiration. Using any other data type or leaving the field absent + // will disable expiration for the individual document. + message TtlConfig { + // The state of applying the TTL configuration to all documents. + enum State { + // The state is unspecified or unknown. + STATE_UNSPECIFIED = 0; + + // The TTL is being applied. There is an active long-running operation to + // track the change. Newly written documents will have TTLs applied as + // requested. Requested TTLs on existing documents are still being + // processed. When TTLs on all existing documents have been processed, the + // state will move to 'ACTIVE'. + CREATING = 1; + + // The TTL is active for all documents. + ACTIVE = 2; + + // The TTL configuration could not be enabled for all existing documents. + // Newly written documents will continue to have their TTL applied. + // The LRO returned when last attempting to enable TTL for this `Field` + // has failed, and may have more details. + NEEDS_REPAIR = 3; + } + + // Output only. The state of the TTL configuration. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The offset, relative to the timestamp value from the + // TTL-enabled field, used to determine the document's expiration time. + // + // `expiration_offset.seconds` must be between 0 and 2,147,483,647 + // inclusive. Values more precise than seconds are rejected. + // + // If unset, defaults to 0, in which case the expiration time is the same + // as the timestamp value from the TTL-enabled field. + google.protobuf.Duration expiration_offset = 3 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. A field name of the form: + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` + // + // A field path can be a simple field name, e.g. `address` or a path to fields + // within `map_value` , e.g. `address.city`, + // or a special field path. The only valid special field is `*`, which + // represents any field. + // + // Field paths can be quoted using `` ` `` (backtick). The only character that + // must be escaped within a quoted field path is the backtick character + // itself, escaped using a backslash. Special characters in field paths that + // must be quoted include: `*`, `.`, + // `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters. + // + // Examples: + // `` `address.city` `` represents a field named `address.city`, not the map + // key `city` in the field `address`. `` `*` `` represents a field named `*`, + // not any field. + // + // A special `Field` contains the default indexing settings for all fields. + // This field's resource name is: + // `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*` + // Indexes defined on this `Field` will be applied to all fields which do not + // have their own `Field` index configuration. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The index configuration for this field. If unset, field indexing will + // revert to the configuration defined by the `ancestor_field`. To + // explicitly remove all indexes for this field, specify an index config + // with an empty list of indexes. + IndexConfig index_config = 2; + + // The TTL configuration for this `Field`. + // Setting or unsetting this will enable or disable the TTL for + // documents that have this `Field`. + TtlConfig ttl_config = 3; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/firestore_admin.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/firestore_admin.proto new file mode 100644 index 000000000000..1dbf0cec1e0b --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/firestore_admin.proto @@ -0,0 +1,1229 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/api/routing.proto"; +import "google/firestore/admin/v1/backup.proto"; +import "google/firestore/admin/v1/database.proto"; +import "google/firestore/admin/v1/field.proto"; +import "google/firestore/admin/v1/index.proto"; +import "google/firestore/admin/v1/operation.proto"; +import "google/firestore/admin/v1/schedule.proto"; +import "google/firestore/admin/v1/snapshot.proto"; +import "google/firestore/admin/v1/user_creds.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "FirestoreAdminProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; +option (google.api.resource_definition) = { + type: "firestore.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; +option (google.api.resource_definition) = { + type: "firestore.googleapis.com/CollectionGroup" + pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}" +}; + +// The Cloud Firestore Admin API. +// +// This API provides several administrative services for Cloud Firestore. +// +// Project, Database, Namespace, Collection, Collection Group, and Document are +// used as defined in the Google Cloud Firestore API. +// +// Operation: An Operation represents work being performed in the background. +// +// The index service manages Cloud Firestore indexes. +// +// Index creation is performed asynchronously. +// An Operation resource is created for each such asynchronous operation. +// The state of the operation (including any errors encountered) +// may be queried via the Operation resource. +// +// The Operations collection provides a record of actions performed for the +// specified Project (including any Operations in progress). Operations are not +// created directly but through calls on other collections or resources. +// +// An Operation that is done may be deleted so that it is no longer listed as +// part of the Operation collection. Operations are garbage collected after +// 30 days. By default, ListOperations will only return in progress and failed +// operations. To list completed operation, issue a ListOperations request with +// the filter `done: true`. +// +// Operations are created by service `FirestoreAdmin`, but are accessed via +// service `google.longrunning.Operations`. +service FirestoreAdmin { + option (google.api.default_host) = "firestore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/datastore"; + + // Creates a composite index. This returns a + // [google.longrunning.Operation][google.longrunning.Operation] which may be + // used to track the status of the creation. The metadata for the operation + // will be the type + // [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata]. + rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes" + body: "index" + }; + option (google.api.method_signature) = "parent,index"; + option (google.longrunning.operation_info) = { + response_type: "Index" + metadata_type: "IndexOperationMetadata" + }; + } + + // Lists composite indexes. + rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a composite index. + rpc GetIndex(GetIndexRequest) returns (Index) { + option (google.api.http) = { + get: "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a composite index. + rpc DeleteIndex(DeleteIndexRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the metadata and configuration for a Field. + rpc GetField(GetFieldRequest) returns (Field) { + option (google.api.http) = { + get: "/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a field configuration. Currently, field updates apply only to + // single field index configuration. However, calls to + // [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField] + // should provide a field mask to avoid changing any configuration that the + // caller isn't aware of. The field mask should be specified as: `{ paths: + // "index_config" }`. + // + // This call returns a + // [google.longrunning.Operation][google.longrunning.Operation] which may be + // used to track the status of the field update. The metadata for the + // operation will be the type + // [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata]. + // + // To configure the default field settings for the database, use + // the special `Field` with resource name: + // `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. + rpc UpdateField(UpdateFieldRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}" + body: "field" + }; + option (google.api.method_signature) = "field"; + option (google.longrunning.operation_info) = { + response_type: "Field" + metadata_type: "FieldOperationMetadata" + }; + } + + // Lists the field configuration and metadata for this database. + // + // Currently, + // [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] + // only supports listing fields that have been explicitly overridden. To issue + // this query, call + // [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] + // with the filter set to `indexConfig.usesAncestorConfig:false` or + // `ttlConfig:*`. + rpc ListFields(ListFieldsRequest) returns (ListFieldsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields" + }; + option (google.api.method_signature) = "parent"; + } + + // Exports a copy of all or a subset of documents from Google Cloud Firestore + // to another storage system, such as Google Cloud Storage. Recent updates to + // documents may not be reflected in the export. The export occurs in the + // background and its progress can be monitored and managed via the + // Operation resource that is created. The output of an export may only be + // used once the associated operation is done. If an export operation is + // cancelled before completion it may leave partial data behind in Google + // Cloud Storage. + // + // For more details on export behavior and output format, refer to: + // https://cloud.google.com/firestore/docs/manage-data/export-import + rpc ExportDocuments(ExportDocumentsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/databases/*}:exportDocuments" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "ExportDocumentsResponse" + metadata_type: "ExportDocumentsMetadata" + }; + } + + // Imports documents into Google Cloud Firestore. Existing documents with the + // same name are overwritten. The import occurs in the background and its + // progress can be monitored and managed via the Operation resource that is + // created. If an ImportDocuments operation is cancelled, it is possible + // that a subset of the data has already been imported to Cloud Firestore. + rpc ImportDocuments(ImportDocumentsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/databases/*}:importDocuments" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "ImportDocumentsMetadata" + }; + } + + // Bulk deletes a subset of documents from Google Cloud Firestore. + // Documents created or updated after the underlying system starts to process + // the request will not be deleted. The bulk delete occurs in the background + // and its progress can be monitored and managed via the Operation resource + // that is created. + // + // For more details on bulk delete behavior, refer to: + // https://cloud.google.com/firestore/docs/manage-data/bulk-delete + rpc BulkDeleteDocuments(BulkDeleteDocumentsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/databases/*}:bulkDeleteDocuments" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "BulkDeleteDocumentsResponse" + metadata_type: "BulkDeleteDocumentsMetadata" + }; + } + + // Create a database. + rpc CreateDatabase(CreateDatabaseRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/databases" + body: "database" + }; + option (google.api.method_signature) = "parent,database,database_id"; + option (google.longrunning.operation_info) = { + response_type: "Database" + metadata_type: "CreateDatabaseMetadata" + }; + } + + // Gets information about a database. + rpc GetDatabase(GetDatabaseRequest) returns (Database) { + option (google.api.http) = { + get: "/v1/{name=projects/*/databases/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List all the databases in the project. + rpc ListDatabases(ListDatabasesRequest) returns (ListDatabasesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/databases" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a database. + rpc UpdateDatabase(UpdateDatabaseRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{database.name=projects/*/databases/*}" + body: "database" + }; + option (google.api.method_signature) = "database,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Database" + metadata_type: "UpdateDatabaseMetadata" + }; + } + + // Deletes a database. + rpc DeleteDatabase(DeleteDatabaseRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/databases/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Database" + metadata_type: "DeleteDatabaseMetadata" + }; + } + + // Create a user creds. + rpc CreateUserCreds(CreateUserCredsRequest) returns (UserCreds) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/databases/*}/userCreds" + body: "user_creds" + }; + option (google.api.method_signature) = "parent,user_creds,user_creds_id"; + } + + // Gets a user creds resource. Note that the returned resource does not + // contain the secret value itself. + rpc GetUserCreds(GetUserCredsRequest) returns (UserCreds) { + option (google.api.http) = { + get: "/v1/{name=projects/*/databases/*/userCreds/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List all user creds in the database. Note that the returned resource + // does not contain the secret value itself. + rpc ListUserCreds(ListUserCredsRequest) returns (ListUserCredsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/databases/*}/userCreds" + }; + option (google.api.method_signature) = "parent"; + } + + // Enables a user creds. No-op if the user creds are already enabled. + rpc EnableUserCreds(EnableUserCredsRequest) returns (UserCreds) { + option (google.api.http) = { + post: "/v1/{name=projects/*/databases/*/userCreds/*}:enable" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Disables a user creds. No-op if the user creds are already disabled. + rpc DisableUserCreds(DisableUserCredsRequest) returns (UserCreds) { + option (google.api.http) = { + post: "/v1/{name=projects/*/databases/*/userCreds/*}:disable" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Resets the password of a user creds. + rpc ResetUserPassword(ResetUserPasswordRequest) returns (UserCreds) { + option (google.api.http) = { + post: "/v1/{name=projects/*/databases/*/userCreds/*}:resetPassword" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a user creds. + rpc DeleteUserCreds(DeleteUserCredsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/databases/*/userCreds/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets information about a backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all the backups. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new database by restoring from an existing backup. + // + // The new database must be in the same cloud region or multi-region location + // as the existing backup. This behaves similar to + // [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase] + // except instead of creating a new empty database, a new database is created + // with the database type, index configuration, and documents from an existing + // backup. + // + // The [long-running operation][google.longrunning.Operation] can be used to + // track the progress of the restore, with the Operation's + // [metadata][google.longrunning.Operation.metadata] field type being the + // [RestoreDatabaseMetadata][google.firestore.admin.v1.RestoreDatabaseMetadata]. + // The [response][google.longrunning.Operation.response] type is the + // [Database][google.firestore.admin.v1.Database] if the restore was + // successful. The new database is not readable or writeable until the LRO has + // completed. + rpc RestoreDatabase(RestoreDatabaseRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/databases:restore" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Database" + metadata_type: "RestoreDatabaseMetadata" + }; + } + + // Creates a backup schedule on a database. + // At most two backup schedules can be configured on a database, one daily + // backup schedule and one weekly backup schedule. + rpc CreateBackupSchedule(CreateBackupScheduleRequest) + returns (BackupSchedule) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/databases/*}/backupSchedules" + body: "backup_schedule" + }; + option (google.api.method_signature) = "parent,backup_schedule"; + } + + // Gets information about a backup schedule. + rpc GetBackupSchedule(GetBackupScheduleRequest) returns (BackupSchedule) { + option (google.api.http) = { + get: "/v1/{name=projects/*/databases/*/backupSchedules/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List backup schedules. + rpc ListBackupSchedules(ListBackupSchedulesRequest) + returns (ListBackupSchedulesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/databases/*}/backupSchedules" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a backup schedule. + rpc UpdateBackupSchedule(UpdateBackupScheduleRequest) + returns (BackupSchedule) { + option (google.api.http) = { + patch: "/v1/{backup_schedule.name=projects/*/databases/*/backupSchedules/*}" + body: "backup_schedule" + }; + option (google.api.method_signature) = "backup_schedule,update_mask"; + } + + // Deletes a backup schedule. + rpc DeleteBackupSchedule(DeleteBackupScheduleRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/databases/*/backupSchedules/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new database by cloning an existing one. + // + // The new database must be in the same cloud region or multi-region location + // as the existing database. This behaves similar to + // [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase] + // except instead of creating a new empty database, a new database is created + // with the database type, index configuration, and documents from an existing + // database. + // + // The [long-running operation][google.longrunning.Operation] can be used to + // track the progress of the clone, with the Operation's + // [metadata][google.longrunning.Operation.metadata] field type being the + // [CloneDatabaseMetadata][google.firestore.admin.v1.CloneDatabaseMetadata]. + // The [response][google.longrunning.Operation.response] type is the + // [Database][google.firestore.admin.v1.Database] if the clone was + // successful. The new database is not readable or writeable until the LRO has + // completed. + rpc CloneDatabase(CloneDatabaseRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/databases:clone" + body: "*" + }; + option (google.api.routing) = { + routing_parameters { + field: "pitr_snapshot.database" + path_template: "projects/{project_id=*}/**" + } + routing_parameters { + field: "pitr_snapshot.database" + path_template: "projects/*/databases/{database_id=*}/**" + } + }; + option (google.longrunning.operation_info) = { + response_type: "Database" + metadata_type: "CloneDatabaseMetadata" + }; + } +} + +// A request to list the Firestore Databases in all locations for a project. +message ListDatabasesRequest { + // Required. A parent name of the form + // `projects/{project_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "firestore.googleapis.com/Database" + } + ]; + + // If true, also returns deleted resources. + bool show_deleted = 4; +} + +// The request for +// [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase]. +message CreateDatabaseRequest { + // Required. A parent name of the form + // `projects/{project_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "firestore.googleapis.com/Database" + } + ]; + + // Required. The Database to create. + Database database = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the database, which will become the final + // component of the database's resource name. + // + // This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ + // with first character a letter and the last a letter or a number. Must not + // be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + // + // "(default)" database ID is also valid if the database is Standard edition. + string database_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata related to the create database operation. +message CreateDatabaseMetadata {} + +// The list of databases for a project. +message ListDatabasesResponse { + // The databases in the project. + repeated Database databases = 1; + + // In the event that data about individual databases cannot be listed they + // will be recorded here. + // + // An example entry might be: projects/some_project/locations/some_location + // This can happen if the Cloud Region that the Database resides in is + // currently unavailable. In this case we can't fetch all the details about + // the database. You may be able to get a more detailed error message + // (or possibly fetch the resource) by sending a 'Get' request for the + // resource or a 'List' request for the specific location. + repeated string unreachable = 3; +} + +// The request for +// [FirestoreAdmin.GetDatabase][google.firestore.admin.v1.FirestoreAdmin.GetDatabase]. +message GetDatabaseRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + } + ]; +} + +// The request for +// [FirestoreAdmin.UpdateDatabase][google.firestore.admin.v1.FirestoreAdmin.UpdateDatabase]. +message UpdateDatabaseRequest { + // Required. The database to update. + Database database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Metadata related to the update database operation. +message UpdateDatabaseMetadata {} + +// The request for +// [FirestoreAdmin.DeleteDatabase][google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase]. +message DeleteDatabaseRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + } + ]; + + // The current etag of the Database. + // If an etag is provided and does not match the current etag of the database, + // deletion will be blocked and a FAILED_PRECONDITION error will be returned. + string etag = 3; +} + +// Metadata related to the delete database operation. +message DeleteDatabaseMetadata {} + +// The request for +// [FirestoreAdmin.CreateUserCreds][google.firestore.admin.v1.FirestoreAdmin.CreateUserCreds]. +message CreateUserCredsRequest { + // Required. A parent name of the form + // `projects/{project_id}/databases/{database_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "firestore.googleapis.com/UserCreds" + } + ]; + + // Required. The user creds to create. + UserCreds user_creds = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the user creds, which will become the final + // component of the user creds's resource name. + // + // This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ + // with first character a letter and the last a letter or a number. Must not + // be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + string user_creds_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for +// [FirestoreAdmin.GetUserCreds][google.firestore.admin.v1.FirestoreAdmin.GetUserCreds]. +message GetUserCredsRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/UserCreds" + } + ]; +} + +// The request for +// [FirestoreAdmin.ListUserCreds][google.firestore.admin.v1.FirestoreAdmin.ListUserCreds]. +message ListUserCredsRequest { + // Required. A parent database name of the form + // `projects/{project_id}/databases/{database_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "firestore.googleapis.com/UserCreds" + } + ]; +} + +// The response for +// [FirestoreAdmin.ListUserCreds][google.firestore.admin.v1.FirestoreAdmin.ListUserCreds]. +message ListUserCredsResponse { + // The user creds for the database. + repeated UserCreds user_creds = 1; +} + +// The request for +// [FirestoreAdmin.EnableUserCreds][google.firestore.admin.v1.FirestoreAdmin.EnableUserCreds]. +message EnableUserCredsRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/UserCreds" + } + ]; +} + +// The request for +// [FirestoreAdmin.DisableUserCreds][google.firestore.admin.v1.FirestoreAdmin.DisableUserCreds]. +message DisableUserCredsRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/UserCreds" + } + ]; +} + +// The request for +// [FirestoreAdmin.ResetUserPassword][google.firestore.admin.v1.FirestoreAdmin.ResetUserPassword]. +message ResetUserPasswordRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/UserCreds" + } + ]; +} + +// The request for +// [FirestoreAdmin.DeleteUserCreds][google.firestore.admin.v1.FirestoreAdmin.DeleteUserCreds]. +message DeleteUserCredsRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/UserCreds" + } + ]; +} + +// The request for +// [FirestoreAdmin.CreateBackupSchedule][google.firestore.admin.v1.FirestoreAdmin.CreateBackupSchedule]. +message CreateBackupScheduleRequest { + // Required. The parent database. + // + // Format `projects/{project}/databases/{database}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + } + ]; + + // Required. The backup schedule to create. + BackupSchedule backup_schedule = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for +// [FirestoreAdmin.GetBackupSchedule][google.firestore.admin.v1.FirestoreAdmin.GetBackupSchedule]. +message GetBackupScheduleRequest { + // Required. The name of the backup schedule. + // + // Format + // `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/BackupSchedule" + } + ]; +} + +// The request for +// [FirestoreAdmin.UpdateBackupSchedule][google.firestore.admin.v1.FirestoreAdmin.UpdateBackupSchedule]. +message UpdateBackupScheduleRequest { + // Required. The backup schedule to update. + BackupSchedule backup_schedule = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request for +// [FirestoreAdmin.ListBackupSchedules][google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules]. +message ListBackupSchedulesRequest { + // Required. The parent database. + // + // Format is `projects/{project}/databases/{database}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + } + ]; +} + +// The response for +// [FirestoreAdmin.ListBackupSchedules][google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules]. +message ListBackupSchedulesResponse { + // List of all backup schedules. + repeated BackupSchedule backup_schedules = 1; +} + +// The request for [FirestoreAdmin.DeleteBackupSchedules][]. +message DeleteBackupScheduleRequest { + // Required. The name of the backup schedule. + // + // Format + // `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/BackupSchedule" + } + ]; +} + +// The request for +// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex]. +message CreateIndexRequest { + // Required. A parent name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/CollectionGroup" + } + ]; + + // Required. The composite index to create. + Index index = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for +// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes]. +message ListIndexesRequest { + // Required. A parent name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/CollectionGroup" + } + ]; + + // The filter to apply to list results. + string filter = 2; + + // The number of results to return. + int32 page_size = 3; + + // A page token, returned from a previous call to + // [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes], + // that may be used to get the next page of results. + string page_token = 4; +} + +// The response for +// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes]. +message ListIndexesResponse { + // The requested indexes. + repeated Index indexes = 1; + + // A page token that may be used to request another page of results. If blank, + // this is the last page. + string next_page_token = 2; +} + +// The request for +// [FirestoreAdmin.GetIndex][google.firestore.admin.v1.FirestoreAdmin.GetIndex]. +message GetIndexRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "firestore.googleapis.com/Index" } + ]; +} + +// The request for +// [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1.FirestoreAdmin.DeleteIndex]. +message DeleteIndexRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "firestore.googleapis.com/Index" } + ]; +} + +// The request for +// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField]. +message UpdateFieldRequest { + // Required. The field to be updated. + Field field = 1 [(google.api.field_behavior) = REQUIRED]; + + // A mask, relative to the field. If specified, only configuration specified + // by this field_mask will be updated in the field. + google.protobuf.FieldMask update_mask = 2; +} + +// The request for +// [FirestoreAdmin.GetField][google.firestore.admin.v1.FirestoreAdmin.GetField]. +message GetFieldRequest { + // Required. A name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "firestore.googleapis.com/Field" } + ]; +} + +// The request for +// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]. +message ListFieldsRequest { + // Required. A parent name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/CollectionGroup" + } + ]; + + // The filter to apply to list results. Currently, + // [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] + // only supports listing fields that have been explicitly overridden. To issue + // this query, call + // [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] + // with a filter that includes `indexConfig.usesAncestorConfig:false` or + // `ttlConfig:*`. + string filter = 2; + + // The number of results to return. + int32 page_size = 3; + + // A page token, returned from a previous call to + // [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields], + // that may be used to get the next page of results. + string page_token = 4; +} + +// The response for +// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]. +message ListFieldsResponse { + // The requested fields. + repeated Field fields = 1; + + // A page token that may be used to request another page of results. If blank, + // this is the last page. + string next_page_token = 2; +} + +// The request for +// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments]. +message ExportDocumentsRequest { + // Required. Database to export. Should be of the form: + // `projects/{project_id}/databases/{database_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + } + ]; + + // IDs of the collection groups to export. Unspecified means all + // collection groups. Each collection group in this list must be unique. + repeated string collection_ids = 2; + + // The output URI. Currently only supports Google Cloud Storage URIs of the + // form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name + // of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional + // Google Cloud Storage namespace path. When + // choosing a name, be sure to consider Google Cloud Storage naming + // guidelines: https://cloud.google.com/storage/docs/naming. + // If the URI is a bucket (without a namespace path), a prefix will be + // generated based on the start time. + string output_uri_prefix = 3; + + // An empty list represents all namespaces. This is the preferred + // usage for databases that don't use namespaces. + // + // An empty string element represents the default namespace. This should be + // used if the database has data in non-default namespaces, but doesn't want + // to include them. Each namespace in this list must be unique. + repeated string namespace_ids = 4; + + // The timestamp that corresponds to the version of the database to be + // exported. The timestamp must be in the past, rounded to the minute and not + // older than + // [earliestVersionTime][google.firestore.admin.v1.Database.earliest_version_time]. + // If specified, then the exported documents will represent a consistent view + // of the database at the provided time. Otherwise, there are no guarantees + // about the consistency of the exported documents. + google.protobuf.Timestamp snapshot_time = 5; +} + +// The request for +// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments]. +message ImportDocumentsRequest { + // Required. Database to import into. Should be of the form: + // `projects/{project_id}/databases/{database_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + } + ]; + + // IDs of the collection groups to import. Unspecified means all collection + // groups that were included in the export. Each collection group in this list + // must be unique. + repeated string collection_ids = 2; + + // Location of the exported files. + // This must match the output_uri_prefix of an ExportDocumentsResponse from + // an export that has completed successfully. + // See: + // [google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix][google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix]. + string input_uri_prefix = 3; + + // An empty list represents all namespaces. This is the preferred + // usage for databases that don't use namespaces. + // + // An empty string element represents the default namespace. This should be + // used if the database has data in non-default namespaces, but doesn't want + // to include them. Each namespace in this list must be unique. + repeated string namespace_ids = 4; +} + +// The request for +// [FirestoreAdmin.BulkDeleteDocuments][google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments]. +// +// When both collection_ids and namespace_ids are set, only documents satisfying +// both conditions will be deleted. +// +// Requests with namespace_ids and collection_ids both empty will be rejected. +// Please use +// [FirestoreAdmin.DeleteDatabase][google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase] +// instead. +message BulkDeleteDocumentsRequest { + // Required. Database to operate. Should be of the form: + // `projects/{project_id}/databases/{database_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + } + ]; + + // Optional. IDs of the collection groups to delete. Unspecified means all + // collection groups. + // + // Each collection group in this list must be unique. + repeated string collection_ids = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Namespaces to delete. + // + // An empty list means all namespaces. This is the recommended + // usage for databases that don't use namespaces. + // + // An empty string element represents the default namespace. This should be + // used if the database has data in non-default namespaces, but doesn't want + // to delete from them. + // + // Each namespace in this list must be unique. + repeated string namespace_ids = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for +// [FirestoreAdmin.BulkDeleteDocuments][google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments]. +message BulkDeleteDocumentsResponse {} + +// The request for +// [FirestoreAdmin.GetBackup][google.firestore.admin.v1.FirestoreAdmin.GetBackup]. +message GetBackupRequest { + // Required. Name of the backup to fetch. + // + // Format is `projects/{project}/locations/{location}/backups/{backup}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Backup" + } + ]; +} + +// The request for +// [FirestoreAdmin.ListBackups][google.firestore.admin.v1.FirestoreAdmin.ListBackups]. +message ListBackupsRequest { + // Required. The location to list backups from. + // + // Format is `projects/{project}/locations/{location}`. + // Use `{location} = '-'` to list backups from all locations for the given + // project. This allows listing backups from a single location or from all + // locations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Location" + } + ]; + + // An expression that filters the list of returned backups. + // + // A filter expression consists of a field name, a comparison operator, and a + // value for filtering. + // The value must be a string, a number, or a boolean. The comparison operator + // must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + // Colon `:` is the contains operator. Filter rules are not case sensitive. + // + // The following fields in the [Backup][google.firestore.admin.v1.Backup] are + // eligible for filtering: + // + // * `database_uid` (supports `=` only) + string filter = 2; +} + +// The response for +// [FirestoreAdmin.ListBackups][google.firestore.admin.v1.FirestoreAdmin.ListBackups]. +message ListBackupsResponse { + // List of all backups for the project. + repeated Backup backups = 1; + + // List of locations that existing backups were not able to be fetched from. + // + // Instead of failing the entire requests when a single location is + // unreachable, this response returns a partial result set and list of + // locations unable to be reached here. The request can be retried against a + // single location to get a concrete error. + repeated string unreachable = 3; +} + +// The request for +// [FirestoreAdmin.DeleteBackup][google.firestore.admin.v1.FirestoreAdmin.DeleteBackup]. +message DeleteBackupRequest { + // Required. Name of the backup to delete. + // + // format is `projects/{project}/locations/{location}/backups/{backup}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Backup" + } + ]; +} + +// The request message for +// [FirestoreAdmin.RestoreDatabase][google.firestore.admin.v1.FirestoreAdmin.RestoreDatabase]. +message RestoreDatabaseRequest { + // Required. The project to restore the database in. Format is + // `projects/{project_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "firestore.googleapis.com/Database" + } + ]; + + // Required. The ID to use for the database, which will become the final + // component of the database's resource name. This database ID must not be + // associated with an existing database. + // + // This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ + // with first character a letter and the last a letter or a number. Must not + // be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + // + // "(default)" database ID is also valid if the database is Standard edition. + string database_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Backup to restore from. Must be from the same project as the + // parent. + // + // The restored database will be created in the same location as the source + // backup. + // + // Format is: `projects/{project_id}/locations/{location}/backups/{backup}` + string backup = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Backup" + } + ]; + + // Optional. Encryption configuration for the restored database. + // + // If this field is not specified, the restored database will use + // the same encryption configuration as the backup, namely + // [use_source_encryption][google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption]. + Database.EncryptionConfig encryption_config = 9 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Immutable. Tags to be bound to the restored database. + // + // The tags should be provided in the format of + // `tagKeys/{tag_key_id} -> tagValues/{tag_value_id}`. + map tags = 10 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// The request message for +// [FirestoreAdmin.CloneDatabase][google.firestore.admin.v1.FirestoreAdmin.CloneDatabase]. +message CloneDatabaseRequest { + // Required. The project to clone the database in. Format is + // `projects/{project_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "firestore.googleapis.com/Database" + } + ]; + + // Required. The ID to use for the database, which will become the final + // component of the database's resource name. This database ID must not be + // associated with an existing database. + // + // This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ + // with first character a letter and the last a letter or a number. Must not + // be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + // + // "(default)" database ID is also valid if the database is Standard edition. + string database_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Specification of the PITR data to clone from. The source database + // must exist. + // + // The cloned database will be created in the same location as the source + // database. + PitrSnapshot pitr_snapshot = 6 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Encryption configuration for the cloned database. + // + // If this field is not specified, the cloned database will use + // the same encryption configuration as the source database, namely + // [use_source_encryption][google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption]. + Database.EncryptionConfig encryption_config = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Immutable. Tags to be bound to the cloned database. + // + // The tags should be provided in the format of + // `tagKeys/{tag_key_id} -> tagValues/{tag_value_id}`. + map tags = 5 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/index.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/index.proto new file mode 100644 index 000000000000..c3f20c5bc2df --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/index.proto @@ -0,0 +1,378 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "IndexProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// Cloud Firestore indexes enable simple and complex queries against +// documents in a database. +message Index { + option (google.api.resource) = { + type: "firestore.googleapis.com/Index" + pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}" + }; + + // Query Scope defines the scope at which a query is run. This is specified on + // a StructuredQuery's `from` field. + enum QueryScope { + // The query scope is unspecified. Not a valid option. + QUERY_SCOPE_UNSPECIFIED = 0; + + // Indexes with a collection query scope specified allow queries + // against a collection that is the child of a specific document, specified + // at query time, and that has the collection ID specified by the index. + COLLECTION = 1; + + // Indexes with a collection group query scope specified allow queries + // against all collections that has the collection ID specified by the + // index. + COLLECTION_GROUP = 2; + + // Include all the collections's ancestor in the index. Only available for + // Datastore Mode databases. + COLLECTION_RECURSIVE = 3; + } + + // API Scope defines the APIs (Firestore Native, or Firestore in + // Datastore Mode) that are supported for queries. + enum ApiScope { + // The index can only be used by the Firestore Native query API. + // This is the default. + ANY_API = 0; + + // The index can only be used by the Firestore in Datastore Mode query API. + DATASTORE_MODE_API = 1; + + // The index can only be used by the MONGODB_COMPATIBLE_API. + MONGODB_COMPATIBLE_API = 2; + } + + // A field in an index. + // The field_path describes which field is indexed, the value_mode describes + // how the field value is indexed. + message IndexField { + // The supported orderings. + enum Order { + // The ordering is unspecified. Not a valid option. + ORDER_UNSPECIFIED = 0; + + // The field is ordered by ascending field value. + ASCENDING = 1; + + // The field is ordered by descending field value. + DESCENDING = 2; + } + + // The supported array value configurations. + enum ArrayConfig { + // The index does not support additional array queries. + ARRAY_CONFIG_UNSPECIFIED = 0; + + // The index supports array containment queries. + CONTAINS = 1; + } + + // The index configuration to support vector search operations + message VectorConfig { + // An index that stores vectors in a flat data structure, and supports + // exhaustive search. + message FlatIndex {} + + // Required. The vector dimension this configuration applies to. + // + // The resulting index will only include vectors of this dimension, and + // can be used for vector search with the same dimension. + int32 dimension = 1 [(google.api.field_behavior) = REQUIRED]; + + // The type of index used. + oneof type { + // Indicates the vector index is a flat index. + FlatIndex flat = 2; + } + } + + // The configuration for how to index a field for search. + message SearchConfig { + // Ways to index the text field value. + enum TextIndexType { + // The index type is unspecified. Not a valid option. + TEXT_INDEX_TYPE_UNSPECIFIED = 0; + + // Field values are tokenized. This is the only way currently supported + // for MONGODB_COMPATIBLE_API. + TOKENIZED = 1; + } + + // Types of text matches that are supported for the + // field. + enum TextMatchType { + // The match type is unspecified. Not a valid option. + TEXT_MATCH_TYPE_UNSPECIFIED = 0; + + // Match on any indexed field. This is the only way currently supported + // for MONGODB_COMPATIBLE_API. + MATCH_GLOBALLY = 1; + } + + // Specification of how the field should be indexed for search text + // indexes. + message SearchTextIndexSpec { + // Required. How to index the text field value. + TextIndexType index_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. How to match the text field value. + TextMatchType match_type = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // The specification for how to build a text search index for a field. + message SearchTextSpec { + // Required. Specifications for how the field should be indexed. + // Repeated so that the field can be indexed in multiple ways. + repeated SearchTextIndexSpec index_specs = 1 + [(google.api.field_behavior) = REQUIRED]; + } + + // The specification for how to build a geo search index for a field. + message SearchGeoSpec { + // Optional. Disables geoJSON indexing for the field. By default, + // geoJSON points are indexed. + bool geo_json_indexing_disabled = 1 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The specification for building a text search index for a + // field. + SearchTextSpec text_spec = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The specification for building a geo search index for a + // field. + SearchGeoSpec geo_spec = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Can be __name__. + // For single field indexes, this must match the name of the field or may + // be omitted. + string field_path = 1; + + // How the field value is indexed. + oneof value_mode { + // Indicates that this field supports ordering by the specified order or + // comparing using =, !=, <, <=, >, >=. + Order order = 2; + + // Indicates that this field supports operations on `array_value`s. + ArrayConfig array_config = 3; + + // Indicates that this field supports nearest neighbor and distance + // operations on vector. + VectorConfig vector_config = 4; + + // Indicates that this field supports search operations. This field + // is only currently supported for indexes with MONGODB_COMPATIBLE_API + // ApiScope. + SearchConfig search_config = 5; + } + } + + // The state of an index. During index creation, an index will be in the + // `CREATING` state. If the index is created successfully, it will transition + // to the `READY` state. If the index creation encounters a problem, the index + // will transition to the `NEEDS_REPAIR` state. + enum State { + // The state is unspecified. + STATE_UNSPECIFIED = 0; + + // The index is being created. + // There is an active long-running operation for the index. + // The index is updated when writing a document. + // Some index data may exist. + CREATING = 1; + + // The index is ready to be used. + // The index is updated when writing a document. + // The index is fully populated from all stored documents it applies to. + READY = 2; + + // The index was being created, but something went wrong. + // There is no active long-running operation for the index, + // and the most recently finished long-running operation failed. + // The index is not updated when writing a document. + // Some index data may exist. + // Use the google.longrunning.Operations API to determine why the operation + // that last attempted to create this index failed, then re-create the + // index. + NEEDS_REPAIR = 3; + } + + // The density configuration for the index. + enum Density { + // Unspecified. It will use database default setting. This value is input + // only. + DENSITY_UNSPECIFIED = 0; + + // An index entry will only exist if ALL fields are present in the document. + // + // This is both the default and only allowed value for Standard Edition + // databases (for both Cloud Firestore `ANY_API` and Cloud Datastore + // `DATASTORE_MODE_API`). + // + // Take for example the following document: + // + // ``` + // { + // "__name__": "...", + // "a": 1, + // "b": 2, + // "c": 3 + // } + // ``` + // + // an index on `(a ASC, b ASC, c ASC, __name__ ASC)` will generate an index + // entry for this document since `a`, 'b', `c`, and `__name__` are all + // present but an index of `(a ASC, d ASC, __name__ ASC)` will not generate + // an index entry for this document since `d` is missing. + // + // This means that such indexes can only be used to serve a query when the + // query has either implicit or explicit requirements that all fields from + // the index are present. + SPARSE_ALL = 1; + + // An index entry will exist if ANY field are present in the document. + // + // This is used as the definition of a sparse index for Enterprise Edition + // databases. + // + // Take for example the following document: + // + // ``` + // { + // "__name__": "...", + // "a": 1, + // "b": 2, + // "c": 3 + // } + // ``` + // + // an index on `(a ASC, d ASC)` will generate an index entry for this + // document since `a` is present, and will fill in an `unset` value for `d`. + // An index on `(d ASC, e ASC)` will not generate any index entry as neither + // `d` nor `e` are present. + // + // An index that contains `__name__` will generate an index entry for all + // documents since Firestore guarantees that all documents have a `__name__` + // field. + SPARSE_ANY = 2; + + // An index entry will exist regardless of if the fields are present or not. + // + // This is the default density for an Enterprise Edition database. + // + // The index will store `unset` values for fields that are not present in + // the document. + DENSE = 3; + } + + // Options for search indexes at the definition level. + message SearchIndexOptions { + // Optional. The language to use for text search indexes. Used as the + // default language if not overridden at the document level by specifying + // the `text_language_override_field`. The language is specified as a BCP 47 + // language code. + // For indexes with MONGODB_COMPATIBLE_API ApiScope: If unspecified, the + // default language is English. + // For indexes with `ANY_API` ApiScope: If unspecified, the default behavior + // is autodetect. + string text_language = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The field in the document that specifies which language to use + // for that specific document. For indexes with MONGODB_COMPATIBLE_API + // ApiScope: if unspecified, the language is taken from the "language" field + // if it exists or from `text_language` if it does not. + string text_language_override_field_path = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. A server defined name for this index. + // The form of this name for composite indexes will be: + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}` + // For single field indexes, this field will be empty. + string name = 1; + + // Indexes with a collection query scope specified allow queries + // against a collection that is the child of a specific document, specified at + // query time, and that has the same collection ID. + // + // Indexes with a collection group query scope specified allow queries against + // all collections descended from a specific document, specified at query + // time, and that have the same collection ID as this index. + QueryScope query_scope = 2; + + // The API scope supported by this index. + ApiScope api_scope = 5; + + // The fields supported by this index. + // + // For composite indexes, this requires a minimum of 2 and a maximum of 100 + // fields. The last field entry is always for the field path `__name__`. If, + // on creation, `__name__` was not specified as the last field, it will be + // added automatically with the same direction as that of the last field + // defined. If the final field in a composite index is not directional, the + // `__name__` will be ordered ASCENDING (unless explicitly specified). + // + // For single field indexes, this will always be exactly one entry with a + // field path equal to the field path of the associated field. + repeated IndexField fields = 3; + + // Output only. The serving state of the index. + State state = 4; + + // Immutable. The density configuration of the index. + Density density = 6 [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. Whether the index is multikey. By default, the index is not + // multikey. For non-multikey indexes, none of the paths in the index + // definition reach or traverse an array, except via an explicit array index. + // For multikey indexes, at most one of the paths in the index definition + // reach or traverse an array, except via an explicit array index. Violations + // will result in errors. + // + // Note this field only applies to index with MONGODB_COMPATIBLE_API ApiScope. + bool multikey = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The number of shards for the index. + int32 shard_count = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether it is an unique index. Unique index ensures all values + // for the indexed field(s) are unique across documents. + bool unique = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Options for search indexes that are at the index definition + // level. This field is only currently supported for indexes with + // MONGODB_COMPATIBLE_API ApiScope. + SearchIndexOptions search_index_options = 9 + [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/location.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/location.proto new file mode 100644 index 000000000000..702138b15185 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/location.proto @@ -0,0 +1,30 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "LocationProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// The metadata message for +// [google.cloud.location.Location.metadata][google.cloud.location.Location.metadata]. +message LocationMetadata {} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/operation.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/operation.proto new file mode 100644 index 000000000000..3d22fdf4a8ff --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/operation.proto @@ -0,0 +1,330 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/resource.proto"; +import "google/firestore/admin/v1/index.proto"; +import "google/firestore/admin/v1/snapshot.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "OperationProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// Metadata for [google.longrunning.Operation][google.longrunning.Operation] +// results from +// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex]. +message IndexOperationMetadata { + // The time this operation started. + google.protobuf.Timestamp start_time = 1; + + // The time this operation completed. Will be unset if operation still in + // progress. + google.protobuf.Timestamp end_time = 2; + + // The index resource that this operation is acting on. For example: + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + string index = 3; + + // The state of the operation. + OperationState state = 4; + + // The progress, in documents, of this operation. + Progress progress_documents = 5; + + // The progress, in bytes, of this operation. + Progress progress_bytes = 6; +} + +// Metadata for [google.longrunning.Operation][google.longrunning.Operation] +// results from +// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField]. +message FieldOperationMetadata { + // Information about an index configuration change. + message IndexConfigDelta { + // Specifies how the index is changing. + enum ChangeType { + // The type of change is not specified or known. + CHANGE_TYPE_UNSPECIFIED = 0; + + // The single field index is being added. + ADD = 1; + + // The single field index is being removed. + REMOVE = 2; + } + + // Specifies how the index is changing. + ChangeType change_type = 1; + + // The index being changed. + Index index = 2; + } + + // Information about a TTL configuration change. + message TtlConfigDelta { + // Specifies how the TTL config is changing. + enum ChangeType { + // The type of change is not specified or known. + CHANGE_TYPE_UNSPECIFIED = 0; + + // The TTL config is being added. + ADD = 1; + + // The TTL config is being removed. + REMOVE = 2; + } + + // Specifies how the TTL configuration is changing. + ChangeType change_type = 1; + + // The offset, relative to the timestamp value in the TTL-enabled field, + // used determine the document's expiration time. + google.protobuf.Duration expiration_offset = 3; + } + + // The time this operation started. + google.protobuf.Timestamp start_time = 1; + + // The time this operation completed. Will be unset if operation still in + // progress. + google.protobuf.Timestamp end_time = 2; + + // The field resource that this operation is acting on. For example: + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` + string field = 3; + + // A list of + // [IndexConfigDelta][google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta], + // which describe the intent of this operation. + repeated IndexConfigDelta index_config_deltas = 4; + + // The state of the operation. + OperationState state = 5; + + // The progress, in documents, of this operation. + Progress progress_documents = 6; + + // The progress, in bytes, of this operation. + Progress progress_bytes = 7; + + // Describes the deltas of TTL configuration. + TtlConfigDelta ttl_config_delta = 8; +} + +// Metadata for [google.longrunning.Operation][google.longrunning.Operation] +// results from +// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments]. +message ExportDocumentsMetadata { + // The time this operation started. + google.protobuf.Timestamp start_time = 1; + + // The time this operation completed. Will be unset if operation still in + // progress. + google.protobuf.Timestamp end_time = 2; + + // The state of the export operation. + OperationState operation_state = 3; + + // The progress, in documents, of this operation. + Progress progress_documents = 4; + + // The progress, in bytes, of this operation. + Progress progress_bytes = 5; + + // Which collection IDs are being exported. + repeated string collection_ids = 6; + + // Where the documents are being exported to. + string output_uri_prefix = 7; + + // Which namespace IDs are being exported. + repeated string namespace_ids = 8; + + // The timestamp that corresponds to the version of the database that is being + // exported. If unspecified, there are no guarantees about the consistency of + // the documents being exported. + google.protobuf.Timestamp snapshot_time = 9; +} + +// Metadata for [google.longrunning.Operation][google.longrunning.Operation] +// results from +// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments]. +message ImportDocumentsMetadata { + // The time this operation started. + google.protobuf.Timestamp start_time = 1; + + // The time this operation completed. Will be unset if operation still in + // progress. + google.protobuf.Timestamp end_time = 2; + + // The state of the import operation. + OperationState operation_state = 3; + + // The progress, in documents, of this operation. + Progress progress_documents = 4; + + // The progress, in bytes, of this operation. + Progress progress_bytes = 5; + + // Which collection IDs are being imported. + repeated string collection_ids = 6; + + // The location of the documents being imported. + string input_uri_prefix = 7; + + // Which namespace IDs are being imported. + repeated string namespace_ids = 8; +} + +// Metadata for [google.longrunning.Operation][google.longrunning.Operation] +// results from +// [FirestoreAdmin.BulkDeleteDocuments][google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments]. +message BulkDeleteDocumentsMetadata { + // The time this operation started. + google.protobuf.Timestamp start_time = 1; + + // The time this operation completed. Will be unset if operation still in + // progress. + google.protobuf.Timestamp end_time = 2; + + // The state of the operation. + OperationState operation_state = 3; + + // The progress, in documents, of this operation. + Progress progress_documents = 4; + + // The progress, in bytes, of this operation. + Progress progress_bytes = 5; + + // The IDs of the collection groups that are being deleted. + repeated string collection_ids = 6; + + // Which namespace IDs are being deleted. + repeated string namespace_ids = 7; + + // The timestamp that corresponds to the version of the database that is being + // read to get the list of documents to delete. This time can also be used as + // the timestamp of PITR in case of disaster recovery (subject to PITR window + // limit). + google.protobuf.Timestamp snapshot_time = 8; +} + +// Returned in the [google.longrunning.Operation][google.longrunning.Operation] +// response field. +message ExportDocumentsResponse { + // Location of the output files. This can be used to begin an import + // into Cloud Firestore (this project or another project) after the operation + // completes successfully. + string output_uri_prefix = 1; +} + +// Metadata for the [long-running operation][google.longrunning.Operation] from +// the [RestoreDatabase][google.firestore.admin.v1.RestoreDatabase] request. +message RestoreDatabaseMetadata { + // The time the restore was started. + google.protobuf.Timestamp start_time = 1; + + // The time the restore finished, unset for ongoing restores. + google.protobuf.Timestamp end_time = 2; + + // The operation state of the restore. + OperationState operation_state = 3; + + // The name of the database being restored to. + string database = 4 [(google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + }]; + + // The name of the backup restoring from. + string backup = 5 [(google.api.resource_reference) = { + type: "firestore.googleapis.com/Backup" + }]; + + // How far along the restore is as an estimated percentage of remaining time. + Progress progress_percentage = 8; +} + +// Metadata for the [long-running operation][google.longrunning.Operation] from +// the [CloneDatabase][google.firestore.admin.v1.CloneDatabase] request. +message CloneDatabaseMetadata { + // The time the clone was started. + google.protobuf.Timestamp start_time = 1; + + // The time the clone finished, unset for ongoing clones. + google.protobuf.Timestamp end_time = 2; + + // The operation state of the clone. + OperationState operation_state = 3; + + // The name of the database being cloned to. + string database = 4 [(google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + }]; + + // The snapshot from which this database was cloned. + PitrSnapshot pitr_snapshot = 7; + + // How far along the clone is as an estimated percentage of remaining time. + Progress progress_percentage = 6; +} + +// Describes the progress of the operation. +// Unit of work is generic and must be interpreted based on where +// [Progress][google.firestore.admin.v1.Progress] is used. +message Progress { + // The amount of work estimated. + int64 estimated_work = 1; + + // The amount of work completed. + int64 completed_work = 2; +} + +// Describes the state of the operation. +enum OperationState { + // Unspecified. + OPERATION_STATE_UNSPECIFIED = 0; + + // Request is being prepared for processing. + INITIALIZING = 1; + + // Request is actively being processed. + PROCESSING = 2; + + // Request is in the process of being cancelled after user called + // google.longrunning.Operations.CancelOperation on the operation. + CANCELLING = 3; + + // Request has been processed and is in its finalization stage. + FINALIZING = 4; + + // Request has completed successfully. + SUCCESSFUL = 5; + + // Request has finished being processed, but encountered an error. + FAILED = 6; + + // Request has finished being cancelled after user called + // google.longrunning.Operations.CancelOperation. + CANCELLED = 7; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/realtime_updates.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/realtime_updates.proto new file mode 100644 index 000000000000..e06a63792ef8 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/realtime_updates.proto @@ -0,0 +1,40 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "RealtimeUpdatesProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// The Realtime Updates mode. +enum RealtimeUpdatesMode { + // The Realtime Updates feature is not specified. + REALTIME_UPDATES_MODE_UNSPECIFIED = 0; + + // The Realtime Updates feature is enabled by default. + // + // This could potentially degrade write performance for the database. + REALTIME_UPDATES_MODE_ENABLED = 1; + + // The Realtime Updates feature is disabled by default. + REALTIME_UPDATES_MODE_DISABLED = 2; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/schedule.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/schedule.proto new file mode 100644 index 000000000000..c6f3b3d38254 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/schedule.proto @@ -0,0 +1,95 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/dayofweek.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "ScheduleProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// A backup schedule for a Cloud Firestore Database. +// +// This resource is owned by the database it is backing up, and is deleted along +// with the database. The actual backups are not though. +message BackupSchedule { + option (google.api.resource) = { + type: "firestore.googleapis.com/BackupSchedule" + pattern: "projects/{project}/databases/{database}/backupSchedules/{backup_schedule}" + }; + + // Output only. The unique backup schedule identifier across all locations and + // databases for the given project. + // + // This will be auto-assigned. + // + // Format is + // `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp at which this backup schedule was created and + // effective since. + // + // No backups will be created for this schedule before this time. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp at which this backup schedule was most recently + // updated. When a backup schedule is first created, this is the same as + // create_time. + google.protobuf.Timestamp update_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // At what relative time in the future, compared to its creation time, + // the backup should be deleted, e.g. keep backups for 7 days. + // + // The maximum supported retention period is 14 weeks. + google.protobuf.Duration retention = 6; + + // A oneof field to represent when backups will be taken. + oneof recurrence { + // For a schedule that runs daily. + DailyRecurrence daily_recurrence = 7; + + // For a schedule that runs weekly on a specific day. + WeeklyRecurrence weekly_recurrence = 8; + } +} + +// Represents a recurring schedule that runs every day. +// +// The time zone is UTC. +message DailyRecurrence {} + +// Represents a recurring schedule that runs on a specified day of the week. +// +// The time zone is UTC. +message WeeklyRecurrence { + // The day of week to run. + // + // DAY_OF_WEEK_UNSPECIFIED is not allowed. + google.type.DayOfWeek day = 2; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/snapshot.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/snapshot.proto new file mode 100644 index 000000000000..07a5e0bc1e96 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/snapshot.proto @@ -0,0 +1,53 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "PitrSnapshotProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// A consistent snapshot of a database at a specific point in time. +// A PITR (Point-in-time recovery) snapshot with previous versions of a +// database's data is available for every minute up to the associated database's +// data retention period. If the PITR feature is enabled, the retention period +// is 7 days; otherwise, it is one hour. +message PitrSnapshot { + // Required. The name of the database that this was a snapshot of. Format: + // `projects/{project}/databases/{database}`. + string database = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "firestore.googleapis.com/Database" + } + ]; + + // Output only. Public UUID of the database the snapshot was associated with. + bytes database_uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Snapshot time of the database. + google.protobuf.Timestamp snapshot_time = 3 + [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/user_creds.proto b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/user_creds.proto new file mode 100644 index 000000000000..e949a085aa61 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/admin/v1/user_creds.proto @@ -0,0 +1,86 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; +option java_multiple_files = true; +option java_outer_classname = "UserCredsProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; +option ruby_package = "Google::Cloud::Firestore::Admin::V1"; + +// A Cloud Firestore User Creds. +message UserCreds { + option (google.api.resource) = { + type: "firestore.googleapis.com/UserCreds" + pattern: "projects/{project}/databases/{database}/userCreds/{user_creds}" + plural: "userCreds" + singular: "userCreds" + }; + + // The state of the user creds (ENABLED or DISABLED). + enum State { + // The default value. Should not be used. + STATE_UNSPECIFIED = 0; + + // The user creds are enabled. + ENABLED = 1; + + // The user creds are disabled. + DISABLED = 2; + } + + // Describes a Resource Identity principal. + message ResourceIdentity { + // Output only. Principal identifier string. + // See: https://cloud.google.com/iam/docs/principal-identifiers + string principal = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Identifier. The resource name of the UserCreds. + // Format: + // `projects/{project}/databases/{database}/userCreds/{user_creds}` + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. The time the user creds were created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the user creds were last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the user creds are enabled or disabled. Defaults to + // ENABLED on creation. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The plaintext server-generated password for the user creds. + // Only populated in responses for CreateUserCreds and ResetUserPassword. + string secure_password = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Identity associated with this User Creds. + oneof UserCredsIdentity { + // Resource Identity descriptor. + ResourceIdentity resource_identity = 6; + } +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/aggregation_result.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/aggregation_result.proto new file mode 100644 index 000000000000..4eee2ddc8aa4 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/aggregation_result.proto @@ -0,0 +1,43 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +import "google/firestore/v1/document.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "AggregationResultProto"; +option java_package = "com.google.firestore.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// The result of a single bucket from a Firestore aggregation query. +// +// The keys of `aggregate_fields` are the same for all results in an aggregation +// query, unlike document queries which can have different fields present for +// each result. +message AggregationResult { + // The result of the aggregation functions, ex: `COUNT(*) AS total_docs`. + // + // The key is the + // [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias] + // assigned to the aggregation function on input and the size of this map + // equals the number of aggregation functions in the query. + map aggregate_fields = 2; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/bloom_filter.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/bloom_filter.proto new file mode 100644 index 000000000000..f9bbdbf08d52 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/bloom_filter.proto @@ -0,0 +1,73 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "BloomFilterProto"; +option java_package = "com.google.firestore.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// A sequence of bits, encoded in a byte array. +// +// Each byte in the `bitmap` byte array stores 8 bits of the sequence. The only +// exception is the last byte, which may store 8 _or fewer_ bits. The `padding` +// defines the number of bits of the last byte to be ignored as "padding". The +// values of these "padding" bits are unspecified and must be ignored. +// +// To retrieve the first bit, bit 0, calculate: `(bitmap[0] & 0x01) != 0`. +// To retrieve the second bit, bit 1, calculate: `(bitmap[0] & 0x02) != 0`. +// To retrieve the third bit, bit 2, calculate: `(bitmap[0] & 0x04) != 0`. +// To retrieve the fourth bit, bit 3, calculate: `(bitmap[0] & 0x08) != 0`. +// To retrieve bit n, calculate: `(bitmap[n / 8] & (0x01 << (n % 8))) != 0`. +// +// The "size" of a `BitSequence` (the number of bits it contains) is calculated +// by this formula: `(bitmap.length * 8) - padding`. +message BitSequence { + // The bytes that encode the bit sequence. + // May have a length of zero. + bytes bitmap = 1; + + // The number of bits of the last byte in `bitmap` to ignore as "padding". + // If the length of `bitmap` is zero, then this value must be `0`. + // Otherwise, this value must be between 0 and 7, inclusive. + int32 padding = 2; +} + +// A bloom filter (https://en.wikipedia.org/wiki/Bloom_filter). +// +// The bloom filter hashes the entries with MD5 and treats the resulting 128-bit +// hash as 2 distinct 64-bit hash values, interpreted as unsigned integers +// using 2's complement encoding. +// +// These two hash values, named `h1` and `h2`, are then used to compute the +// `hash_count` hash values using the formula, starting at `i=0`: +// +// h(i) = h1 + (i * h2) +// +// These resulting values are then taken modulo the number of bits in the bloom +// filter to get the bits of the bloom filter to test for the given entry. +message BloomFilter { + // The bloom filter data. + BitSequence bits = 1; + + // The number of hashes used by the algorithm. + int32 hash_count = 2; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/common.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/common.proto new file mode 100644 index 000000000000..d075d54a9a93 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/common.proto @@ -0,0 +1,111 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.firestore.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// A set of field paths on a document. +// Used to restrict a get or update operation on a document to a subset of its +// fields. +// This is different from standard field masks, as this is always scoped to a +// [Document][google.firestore.v1.Document], and takes in account the dynamic +// nature of [Value][google.firestore.v1.Value]. +message DocumentMask { + // The list of field paths in the mask. See + // [Document.fields][google.firestore.v1.Document.fields] for a field path + // syntax reference. + repeated string field_paths = 1; +} + +// A precondition on a document, used for conditional operations. +message Precondition { + // The type of precondition. + oneof condition_type { + // When set to `true`, the target document must exist. + // When set to `false`, the target document must not exist. + bool exists = 1; + + // When set, the target document must exist and have been last updated at + // that time. Timestamp must be microsecond aligned. + google.protobuf.Timestamp update_time = 2; + } +} + +// Options for creating a new transaction. +message TransactionOptions { + // The type of concurrency control mode for transactions. + enum ConcurrencyMode { + // Start the transaction with the database-level default concurrency mode. + CONCURRENCY_MODE_UNSPECIFIED = 0; + + // Use optimistic concurrency control for the new transaction. + OPTIMISTIC = 1; + + // Use pessimistic concurrency control for the new transaction. + PESSIMISTIC = 2; + } + + // Options for a transaction that can be used to read and write documents. + message ReadWrite { + // An optional transaction to retry. + bytes retry_transaction = 1; + + // Optional. The concurrency control mode to use for this transaction. + // + // A database is able to use different concurrency modes for different + // transactions simultaneously. + // + // 3rd party auth requests are only allowed to create optimistic + // read-write transactions and must specify that here even if the + // database-level setting is already configured to optimistic. + ConcurrencyMode concurrency_mode = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Options for a transaction that can only be used to read documents. + message ReadOnly { + // The consistency mode for this transaction. If not set, defaults to strong + // consistency. + oneof consistency_selector { + // Reads documents at the given time. + // + // This must be a microsecond precision timestamp within the past one + // hour, or if Point-in-Time Recovery is enabled, can additionally be a + // whole minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 2; + } + } + + // The mode of the transaction. + oneof mode { + // The transaction can only be used for read operations. + ReadOnly read_only = 2; + + // The transaction can be used for both read and write operations. + ReadWrite read_write = 3; + } +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/document.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/document.proto new file mode 100644 index 000000000000..a77dbd997189 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/document.proto @@ -0,0 +1,247 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/latlng.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.firestore.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// A Firestore document. +// +// Must not exceed 1 MiB - 4 bytes. +message Document { + // The resource name of the document, for example + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string name = 1; + + // The document's fields. + // + // The map keys represent field names. + // + // Field names matching the regular expression `__.*__` are reserved. Reserved + // field names are forbidden except in certain documented contexts. The field + // names, represented as UTF-8, must not exceed 1,500 bytes and cannot be + // empty. + // + // Field paths may be used in other contexts to refer to structured fields + // defined here. For `map_value`, the field path is represented by a + // dot-delimited (`.`) string of segments. Each segment is either a simple + // field name (defined below) or a quoted field name. For example, the + // structured field `"foo" : { map_value: { "x&y" : { string_value: "hello" + // }}}` would be represented by the field path `` foo.`x&y` ``. + // + // A simple field name contains only characters `a` to `z`, `A` to `Z`, + // `0` to `9`, or `_`, and must not start with `0` to `9`. For example, + // `foo_bar_17`. + // + // A quoted field name starts and ends with `` ` `` and + // may contain any character. Some characters, including `` ` ``, must be + // escaped using a `\`. For example, `` `x&y` `` represents `x&y` and + // `` `bak\`tik` `` represents `` bak`tik ``. + map fields = 2; + + // Output only. The time at which the document was created. + // + // This value increases monotonically when a document is deleted then + // recreated. It can also be compared to values from other documents and + // the `read_time` of a query. + google.protobuf.Timestamp create_time = 3; + + // Output only. The time at which the document was last changed. + // + // This value is initially set to the `create_time` then increases + // monotonically with each change to the document. It can also be + // compared to values from other documents and the `read_time` of a query. + google.protobuf.Timestamp update_time = 4; +} + +// A message that can hold any of the supported value types. +message Value { + // Must have a value set. + oneof value_type { + // A null value. + google.protobuf.NullValue null_value = 11; + + // A boolean value. + bool boolean_value = 1; + + // An integer value. + int64 integer_value = 2; + + // A double value. + double double_value = 3; + + // A timestamp value. + // + // Precise only to microseconds. When stored, any additional precision is + // rounded down. + google.protobuf.Timestamp timestamp_value = 10; + + // A string value. + // + // The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes. + // Only the first 1,500 bytes of the UTF-8 representation are considered by + // queries. + string string_value = 17; + + // A bytes value. + // + // Must not exceed 1 MiB - 89 bytes. + // Only the first 1,500 bytes are considered by queries. + bytes bytes_value = 18; + + // A reference to a document. For example: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string reference_value = 5; + + // A geo point value representing a point on the surface of Earth. + google.type.LatLng geo_point_value = 8; + + // An array value. + // + // Cannot directly contain another array value, though can contain a + // map which contains another array. + ArrayValue array_value = 9; + + // A map value. + MapValue map_value = 6; + + // Value which references a field. + // + // This is considered relative (vs absolute) since it only refers to a field + // and not a field within a particular document. + // + // **Requires:** + // + // * Must follow [field reference][FieldReference.field_path] limitations. + // + // * Not allowed to be used when writing documents. + string field_reference_value = 19; + + // Pointer to a variable defined elsewhere in a pipeline. + // + // Unlike `field_reference_value` which references a field within a + // document, this refers to a variable, defined in a separate namespace than + // the fields of a document. + string variable_reference_value = 22; + + // A value that represents an unevaluated expression. + // + // **Requires:** + // + // * Not allowed to be used when writing documents. + Function function_value = 20; + + // A value that represents an unevaluated pipeline. + // + // **Requires:** + // + // * Not allowed to be used when writing documents. + Pipeline pipeline_value = 21; + } +} + +// An array value. +message ArrayValue { + // Values in the array. + repeated Value values = 1; +} + +// A map value. +message MapValue { + // The map's fields. + // + // The map keys represent field names. Field names matching the regular + // expression `__.*__` are reserved. Reserved field names are forbidden except + // in certain documented contexts. The map keys, represented as UTF-8, must + // not exceed 1,500 bytes and cannot be empty. + map fields = 1; +} + +// Represents an unevaluated scalar expression. +// +// For example, the expression `like(user_name, "%alice%")` is represented as: +// +// ``` +// name: "like" +// args { field_reference: "user_name" } +// args { string_value: "%alice%" } +// ``` +message Function { + // Required. The name of the function to evaluate. + // + // **Requires:** + // + // * must be in snake case (lower case with underscore separator). + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Ordered list of arguments the given function expects. + repeated Value args = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional named arguments that certain functions may support. + map options = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A Firestore query represented as an ordered list of operations / stages. +message Pipeline { + // A single operation within a pipeline. + // + // A stage is made up of a unique name, and a list of arguments. The exact + // number of arguments & types is dependent on the stage type. + // + // To give an example, the stage `filter(state = "MD")` would be encoded as: + // + // ``` + // name: "filter" + // args { + // function_value { + // name: "eq" + // args { field_reference_value: "state" } + // args { string_value: "MD" } + // } + // } + // ``` + // + // See public documentation for the full list. + message Stage { + // Required. The name of the stage to evaluate. + // + // **Requires:** + // + // * must be in snake case (lower case with underscore separator). + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Ordered list of arguments the given stage expects. + repeated Value args = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional named arguments that certain functions may support. + map options = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Ordered list of stages to evaluate. + repeated Stage stages = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/explain_stats.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/explain_stats.proto new file mode 100644 index 000000000000..a05d530133b3 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/explain_stats.proto @@ -0,0 +1,41 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +import "google/protobuf/any.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "ExplainStatsProto"; +option java_package = "com.google.firestore.v1"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// Specification of Firestore Explain Stats fields. + +// Pipeline explain stats. +// +// Depending on the explain options in the original request, this can contain +// the optimized plan and / or execution stats. +message ExplainStats { + // The format depends on the `output_format` options in the request. + // + // Currently there are two supported options: `TEXT` and `JSON`. + // Both supply a `google.protobuf.StringValue`. + google.protobuf.Any data = 1; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/firestore.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/firestore.proto new file mode 100644 index 000000000000..a1dea5a637b3 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/firestore.proto @@ -0,0 +1,1237 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/routing.proto"; +import "google/firestore/v1/aggregation_result.proto"; +import "google/firestore/v1/common.proto"; +import "google/firestore/v1/document.proto"; +import "google/firestore/v1/explain_stats.proto"; +import "google/firestore/v1/pipeline.proto"; +import "google/firestore/v1/query.proto"; +import "google/firestore/v1/query_profile.proto"; +import "google/firestore/v1/write.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "FirestoreProto"; +option java_package = "com.google.firestore.v1"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// Specification of the Firestore API. + +// The Cloud Firestore service. +// +// Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL +// document database that simplifies storing, syncing, and querying data for +// your mobile, web, and IoT apps at global scale. Its client libraries provide +// live synchronization and offline support, while its security features and +// integrations with Firebase and Google Cloud Platform accelerate building +// truly serverless apps. +service Firestore { + option (google.api.default_host) = "firestore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/datastore"; + + // Gets a single document. + rpc GetDocument(GetDocumentRequest) returns (Document) { + option (google.api.http) = { + get: "/v1/{name=projects/*/databases/*/documents/*/**}" + }; + } + + // Lists documents. + rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}" + additional_bindings { + get: "/v1/{parent=projects/*/databases/*/documents}/{collection_id}" + } + }; + } + + // Updates or inserts a document. + rpc UpdateDocument(UpdateDocumentRequest) returns (Document) { + option (google.api.http) = { + patch: "/v1/{document.name=projects/*/databases/*/documents/*/**}" + body: "document" + }; + option (google.api.method_signature) = "document,update_mask"; + } + + // Deletes a document. + rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/databases/*/documents/*/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets multiple documents. + // + // Documents returned by this method are not guaranteed to be returned in the + // same order that they were requested. + rpc BatchGetDocuments(BatchGetDocumentsRequest) + returns (stream BatchGetDocumentsResponse) { + option (google.api.http) = { + post: "/v1/{database=projects/*/databases/*}/documents:batchGet" + body: "*" + }; + } + + // Starts a new transaction. + rpc BeginTransaction(BeginTransactionRequest) + returns (BeginTransactionResponse) { + option (google.api.http) = { + post: "/v1/{database=projects/*/databases/*}/documents:beginTransaction" + body: "*" + }; + option (google.api.method_signature) = "database"; + } + + // Commits a transaction, while optionally updating documents. + rpc Commit(CommitRequest) returns (CommitResponse) { + option (google.api.http) = { + post: "/v1/{database=projects/*/databases/*}/documents:commit" + body: "*" + }; + option (google.api.method_signature) = "database,writes"; + } + + // Rolls back a transaction. + rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{database=projects/*/databases/*}/documents:rollback" + body: "*" + }; + option (google.api.method_signature) = "database,transaction"; + } + + // Runs a query. + rpc RunQuery(RunQueryRequest) returns (stream RunQueryResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/databases/*/documents}:runQuery" + body: "*" + additional_bindings { + post: "/v1/{parent=projects/*/databases/*/documents/*/**}:runQuery" + body: "*" + } + }; + } + + // Executes a pipeline query. + rpc ExecutePipeline(ExecutePipelineRequest) + returns (stream ExecutePipelineResponse) { + option (google.api.http) = { + post: "/v1/{database=projects/*/databases/*}/documents:executePipeline" + body: "*" + }; + option (google.api.routing) = { + routing_parameters { + field: "database" + path_template: "projects/{project_id=*}/**" + } + routing_parameters { + field: "database" + path_template: "projects/*/databases/{database_id=*}/**" + } + }; + } + + // Runs an aggregation query. + // + // Rather than producing [Document][google.firestore.v1.Document] results like + // [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery], this API + // allows running an aggregation to produce a series of + // [AggregationResult][google.firestore.v1.AggregationResult] server-side. + // + // High-Level Example: + // + // ``` + // -- Return the number of documents in table given a filter. + // SELECT COUNT(*) FROM ( SELECT * FROM k where a = true ); + // ``` + rpc RunAggregationQuery(RunAggregationQueryRequest) + returns (stream RunAggregationQueryResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/databases/*/documents}:runAggregationQuery" + body: "*" + additional_bindings { + post: "/v1/{parent=projects/*/databases/*/documents/*/**}:runAggregationQuery" + body: "*" + } + }; + } + + // Partitions a query by returning partition cursors that can be used to run + // the query in parallel. The returned partition cursors are split points that + // can be used by RunQuery as starting/end points for the query results. + rpc PartitionQuery(PartitionQueryRequest) returns (PartitionQueryResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/databases/*/documents}:partitionQuery" + body: "*" + additional_bindings { + post: "/v1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery" + body: "*" + } + }; + } + + // Streams batches of document updates and deletes, in order. This method is + // only available via gRPC or WebChannel (not REST). + rpc Write(stream WriteRequest) returns (stream WriteResponse) { + option (google.api.http) = { + post: "/v1/{database=projects/*/databases/*}/documents:write" + body: "*" + }; + } + + // Listens to changes. This method is only available via gRPC or WebChannel + // (not REST). + rpc Listen(stream ListenRequest) returns (stream ListenResponse) { + option (google.api.http) = { + post: "/v1/{database=projects/*/databases/*}/documents:listen" + body: "*" + }; + } + + // Lists all the collection IDs underneath a document. + rpc ListCollectionIds(ListCollectionIdsRequest) + returns (ListCollectionIdsResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/databases/*/documents}:listCollectionIds" + body: "*" + additional_bindings { + post: "/v1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Applies a batch of write operations. + // + // The BatchWrite method does not apply the write operations atomically + // and can apply them out of order. Method does not allow more than one write + // per document. Each write succeeds or fails independently. See the + // [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the + // success status of each write. + // + // If you require an atomically applied set of writes, use + // [Commit][google.firestore.v1.Firestore.Commit] instead. + rpc BatchWrite(BatchWriteRequest) returns (BatchWriteResponse) { + option (google.api.http) = { + post: "/v1/{database=projects/*/databases/*}/documents:batchWrite" + body: "*" + }; + } + + // Creates a new document. + rpc CreateDocument(CreateDocumentRequest) returns (Document) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/databases/*/documents/**}/{collection_id}" + body: "document" + }; + } +} + +// The request for +// [Firestore.GetDocument][google.firestore.v1.Firestore.GetDocument]. +message GetDocumentRequest { + // Required. The resource name of the Document to get. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The fields to return. If not set, returns all fields. + // + // If the document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 2; + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads the document in a transaction. + bytes transaction = 3; + + // Reads the version of the document at the given time. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 5; + } +} + +// The request for +// [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments]. +message ListDocumentsRequest { + // Required. The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The collection ID, relative to `parent`, to list. + // + // For example: `chatrooms` or `messages`. + // + // This is optional, and when not provided, Firestore will list documents + // from all collections under the provided `parent`. + string collection_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of documents to return in a single response. + // + // Firestore may return fewer than this value. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListDocuments` response. + // + // Provide this to retrieve the subsequent page. When paginating, all other + // parameters (with the exception of `page_size`) must match the values set + // in the request that generated the page token. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The optional ordering of the documents to return. + // + // For example: `priority desc, __name__ desc`. + // + // This mirrors the [`ORDER BY`][google.firestore.v1.StructuredQuery.order_by] + // used in Firestore queries but in a string representation. When absent, + // documents are ordered based on `__name__ ASC`. + string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fields to return. If not set, returns all fields. + // + // If a document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 7 [(google.api.field_behavior) = OPTIONAL]; + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Perform the read as part of an already active transaction. + bytes transaction = 8; + + // Perform the read at the provided time. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 10; + } + + // If the list should show missing documents. + // + // A document is missing if it does not exist, but there are sub-documents + // nested underneath it. When true, such missing documents will be returned + // with a key but will not have fields, + // [`create_time`][google.firestore.v1.Document.create_time], or + // [`update_time`][google.firestore.v1.Document.update_time] set. + // + // Requests with `show_missing` may not specify `where` or `order_by`. + bool show_missing = 12; +} + +// The response for +// [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments]. +message ListDocumentsResponse { + // The Documents found. + repeated Document documents = 1; + + // A token to retrieve the next page of documents. + // + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// The request for +// [Firestore.CreateDocument][google.firestore.v1.Firestore.CreateDocument]. +message CreateDocumentRequest { + // Required. The parent resource. For example: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The collection ID, relative to `parent`, to list. For example: + // `chatrooms`. + string collection_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // The client-assigned document ID to use for this document. + // + // Optional. If not specified, an ID will be assigned by the service. + string document_id = 3; + + // Required. The document to create. `name` must not be set. + Document document = 4 [(google.api.field_behavior) = REQUIRED]; + + // The fields to return. If not set, returns all fields. + // + // If the document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 5; +} + +// The request for +// [Firestore.UpdateDocument][google.firestore.v1.Firestore.UpdateDocument]. +message UpdateDocumentRequest { + // Required. The updated document. + // Creates the document if it does not already exist. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The fields to update. + // None of the field paths in the mask may contain a reserved name. + // + // If the document exists on the server and has fields not referenced in the + // mask, they are left unchanged. + // Fields referenced in the mask, but not present in the input document, are + // deleted from the document on the server. + DocumentMask update_mask = 2; + + // The fields to return. If not set, returns all fields. + // + // If the document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 3; + + // An optional precondition on the document. + // The request will fail if this is set and not met by the target document. + Precondition current_document = 4; +} + +// The request for +// [Firestore.DeleteDocument][google.firestore.v1.Firestore.DeleteDocument]. +message DeleteDocumentRequest { + // Required. The resource name of the Document to delete. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // An optional precondition on the document. + // The request will fail if this is set and not met by the target document. + Precondition current_document = 2; +} + +// The request for +// [Firestore.BatchGetDocuments][google.firestore.v1.Firestore.BatchGetDocuments]. +message BatchGetDocumentsRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The names of the documents to retrieve. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // The request will fail if any of the document is not a child resource of the + // given `database`. Duplicate names will be elided. + repeated string documents = 2; + + // The fields to return. If not set, returns all fields. + // + // If a document has a field that is not present in this mask, that field will + // not be returned in the response. + DocumentMask mask = 3; + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads documents in a transaction. + bytes transaction = 4; + + // Starts a new transaction and reads the documents. + // Defaults to a read-only transaction. + // The new transaction ID will be returned as the first response in the + // stream. + TransactionOptions new_transaction = 5; + + // Reads documents as they were at the given time. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 7; + } +} + +// The streamed response for +// [Firestore.BatchGetDocuments][google.firestore.v1.Firestore.BatchGetDocuments]. +message BatchGetDocumentsResponse { + // A single result. + // This can be empty if the server is just returning a transaction. + oneof result { + // A document that was requested. + Document found = 1; + + // A document name that was requested but does not exist. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string missing = 2; + } + + // The transaction that was started as part of this request. + // Will only be set in the first response, and only if + // [BatchGetDocumentsRequest.new_transaction][google.firestore.v1.BatchGetDocumentsRequest.new_transaction] + // was set in the request. + bytes transaction = 3; + + // The time at which the document was read. + // This may be monotically increasing, in this case the previous documents in + // the result stream are guaranteed not to have changed between their + // read_time and this one. + google.protobuf.Timestamp read_time = 4; +} + +// The request for +// [Firestore.BeginTransaction][google.firestore.v1.Firestore.BeginTransaction]. +message BeginTransactionRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The options for the transaction. + // Defaults to a read-write transaction. + TransactionOptions options = 2; +} + +// The response for +// [Firestore.BeginTransaction][google.firestore.v1.Firestore.BeginTransaction]. +message BeginTransactionResponse { + // The transaction that was started. + bytes transaction = 1; +} + +// The request for [Firestore.Commit][google.firestore.v1.Firestore.Commit]. +message CommitRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The writes to apply. + // + // Always executed atomically and in order. + repeated Write writes = 2; + + // If set, applies all writes in this transaction, and commits it. + bytes transaction = 3; +} + +// The response for [Firestore.Commit][google.firestore.v1.Firestore.Commit]. +message CommitResponse { + // The result of applying the writes. + // + // This i-th write result corresponds to the i-th write in the + // request. + repeated WriteResult write_results = 1; + + // The time at which the commit occurred. Any read with an equal or greater + // `read_time` is guaranteed to see the effects of the commit. + google.protobuf.Timestamp commit_time = 2; +} + +// The request for [Firestore.Rollback][google.firestore.v1.Firestore.Rollback]. +message RollbackRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The transaction to roll back. + bytes transaction = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery]. +message RunQueryRequest { + // Required. The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The query to run. + oneof query_type { + // A structured query. + StructuredQuery structured_query = 2; + } + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Run the query within an already active transaction. + // + // The value here is the opaque transaction ID to execute the query in. + bytes transaction = 5; + + // Starts a new transaction and reads the documents. + // Defaults to a read-only transaction. + // The new transaction ID will be returned as the first response in the + // stream. + TransactionOptions new_transaction = 6; + + // Reads documents as they were at the given time. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 7; + } + + // Optional. Explain options for the query. If set, additional query + // statistics will be returned. If not, only query results will be returned. + ExplainOptions explain_options = 10 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for +// [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery]. +message RunQueryResponse { + // The transaction that was started as part of this request. + // Can only be set in the first response, and only if + // [RunQueryRequest.new_transaction][google.firestore.v1.RunQueryRequest.new_transaction] + // was set in the request. If set, no other fields will be set in this + // response. + bytes transaction = 2; + + // A query result, not set when reporting partial progress. + Document document = 1; + + // The time at which the document was read. This may be monotonically + // increasing; in this case, the previous documents in the result stream are + // guaranteed not to have changed between their `read_time` and this one. + // + // If the query returns no results, a response with `read_time` and no + // `document` will be sent, and this represents the time at which the query + // was run. + google.protobuf.Timestamp read_time = 3; + + // The number of results that have been skipped due to an offset between + // the last response and the current response. + int32 skipped_results = 4; + + // The continuation mode for the query. If present, it indicates the current + // query response stream has finished. This can be set with or without a + // `document` present, but when set, no more results are returned. + oneof continuation_selector { + // If present, Firestore has completely finished the request and no more + // documents will be returned. + bool done = 6; + } + + // Query explain metrics. This is only present when the + // [RunQueryRequest.explain_options][google.firestore.v1.RunQueryRequest.explain_options] + // is provided, and it is sent only once with the last response in the stream. + ExplainMetrics explain_metrics = 11; +} + +// The request for +// [Firestore.ExecutePipeline][google.firestore.v1.Firestore.ExecutePipeline]. +message ExecutePipelineRequest { + // Required. Database identifier, in the form + // `projects/{project}/databases/{database}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + oneof pipeline_type { + // A pipelined operation. + StructuredPipeline structured_pipeline = 2; + } + + // Optional consistency arguments, defaults to strong consistency. + oneof consistency_selector { + // Run the query within an already active transaction. + // + // The value here is the opaque transaction ID to execute the query in. + bytes transaction = 5; + + // Execute the pipeline in a new transaction. + // + // The identifier of the newly created transaction will be returned in the + // first response on the stream. This defaults to a read-only transaction. + TransactionOptions new_transaction = 6; + + // Execute the pipeline in a snapshot transaction at the given time. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 7; + } + + // Optional. Automatically commits the transaction after the pipeline has been + // executed. Only permitted in combination with `transaction` or + // `new_transaction`. + bool auto_commit_transaction = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for [Firestore.Execute][]. +message ExecutePipelineResponse { + // Newly created transaction identifier. + // + // This field is only specified as part of the first response from the server, + // alongside the `results` field when the original request specified + // [ExecuteRequest.new_transaction][]. + bytes transaction = 1; + + // An ordered batch of results returned executing a pipeline. + // + // The batch size is variable, and can even be zero for when only a partial + // progress message is returned. + // + // The fields present in the returned documents are only those that were + // explicitly requested in the pipeline, this includes those like + // [`__name__`][google.firestore.v1.Document.name] and + // [`__update_time__`][google.firestore.v1.Document.update_time]. This is + // explicitly a divergence from `Firestore.RunQuery` / `Firestore.GetDocument` + // RPCs which always return such fields even when they are not specified in + // the [`mask`][google.firestore.v1.DocumentMask]. + repeated Document results = 2; + + // The time at which the results are valid. + // + // This is a (not strictly) monotonically increasing value across multiple + // responses in the same stream. The API guarantees that all previously + // returned results are still valid at the latest `execution_time`. This + // allows the API consumer to treat the query if it ran at the latest + // `execution_time` returned. + // + // If the query returns no results, a response with `execution_time` and no + // `results` will be sent, and this represents the time at which the operation + // was run. + google.protobuf.Timestamp execution_time = 3; + + // Query explain stats. + // + // This is present on the **last** response if the request configured explain + // to run in 'analyze' or 'explain' mode in the pipeline options. If the query + // does not return any results, a response with `explain_stats` and no + // `results` will still be sent. + ExplainStats explain_stats = 4; +} + +// The request for +// [Firestore.RunAggregationQuery][google.firestore.v1.Firestore.RunAggregationQuery]. +message RunAggregationQueryRequest { + // Required. The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The query to run. + oneof query_type { + // An aggregation query. + StructuredAggregationQuery structured_aggregation_query = 2; + } + + // The consistency mode for the query, defaults to strong consistency. + oneof consistency_selector { + // Run the aggregation within an already active transaction. + // + // The value here is the opaque transaction ID to execute the query in. + bytes transaction = 4; + + // Starts a new transaction as part of the query, defaulting to read-only. + // + // The new transaction ID will be returned as the first response in the + // stream. + TransactionOptions new_transaction = 5; + + // Executes the query at the given timestamp. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 6; + } + + // Optional. Explain options for the query. If set, additional query + // statistics will be returned. If not, only query results will be returned. + ExplainOptions explain_options = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for +// [Firestore.RunAggregationQuery][google.firestore.v1.Firestore.RunAggregationQuery]. +message RunAggregationQueryResponse { + // A single aggregation result. + // + // Not present when reporting partial progress. + AggregationResult result = 1; + + // The transaction that was started as part of this request. + // + // Only present on the first response when the request requested to start + // a new transaction. + bytes transaction = 2; + + // The time at which the aggregate result was computed. This is always + // monotonically increasing; in this case, the previous AggregationResult in + // the result stream are guaranteed not to have changed between their + // `read_time` and this one. + // + // If the query returns no results, a response with `read_time` and no + // `result` will be sent, and this represents the time at which the query + // was run. + google.protobuf.Timestamp read_time = 3; + + // Query explain metrics. This is only present when the + // [RunAggregationQueryRequest.explain_options][google.firestore.v1.RunAggregationQueryRequest.explain_options] + // is provided, and it is sent only once with the last response in the stream. + ExplainMetrics explain_metrics = 10; +} + +// The request for +// [Firestore.PartitionQuery][google.firestore.v1.Firestore.PartitionQuery]. +message PartitionQueryRequest { + // Required. The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents`. + // Document resource names are not supported; only database resource names + // can be specified. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The query to partition. + oneof query_type { + // A structured query. + // Query must specify collection with all descendants and be ordered by name + // ascending. Other filters, order bys, limits, offsets, and start/end + // cursors are not supported. + StructuredQuery structured_query = 2; + } + + // The desired maximum number of partition points. + // The partitions may be returned across multiple pages of results. + // The number must be positive. The actual number of partitions + // returned may be fewer. + // + // For example, this may be set to one fewer than the number of parallel + // queries to be run, or in running a data pipeline job, one fewer than the + // number of workers or compute instances available. + int64 partition_count = 3; + + // The `next_page_token` value returned from a previous call to + // PartitionQuery that may be used to get an additional set of results. + // There are no ordering guarantees between sets of results. Thus, using + // multiple sets of results will require merging the different result sets. + // + // For example, two subsequent calls using a page_token may return: + // + // * cursor B, cursor M, cursor Q + // * cursor A, cursor U, cursor W + // + // To obtain a complete result set ordered with respect to the results of the + // query supplied to PartitionQuery, the results sets should be merged: + // cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + string page_token = 4; + + // The maximum number of partitions to return in this call, subject to + // `partition_count`. + // + // For example, if `partition_count` = 10 and `page_size` = 8, the first call + // to PartitionQuery will return up to 8 partitions and a `next_page_token` + // if more results exist. A second call to PartitionQuery will return up to + // 2 partitions, to complete the total of 10 specified in `partition_count`. + int32 page_size = 5; + + // The consistency mode for this request. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads documents as they were at the given time. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 6; + } +} + +// The response for +// [Firestore.PartitionQuery][google.firestore.v1.Firestore.PartitionQuery]. +message PartitionQueryResponse { + // Partition results. + // Each partition is a split point that can be used by RunQuery as a starting + // or end point for the query results. The RunQuery requests must be made with + // the same query supplied to this PartitionQuery request. The partition + // cursors will be ordered according to same ordering as the results of the + // query supplied to PartitionQuery. + // + // For example, if a PartitionQuery request returns partition cursors A and B, + // running the following three queries will return the entire result set of + // the original query: + // + // * query, end_at A + // * query, start_at A, end_at B + // * query, start_at B + // + // An empty result may indicate that the query has too few results to be + // partitioned, or that the query is not yet supported for partitioning. + repeated Cursor partitions = 1; + + // A page token that may be used to request an additional set of results, up + // to the number specified by `partition_count` in the PartitionQuery request. + // If blank, there are no more results. + string next_page_token = 2; +} + +// The request for [Firestore.Write][google.firestore.v1.Firestore.Write]. +// +// The first request creates a stream, or resumes an existing one from a token. +// +// When creating a new stream, the server replies with a response containing +// only an ID and a token, to use in the next request. +// +// When resuming a stream, the server first streams any responses later than the +// given token, then a response containing only an up-to-date token, to use in +// the next request. +message WriteRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + // This is only required in the first message. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The ID of the write stream to resume. + // This may only be set in the first message. When left empty, a new write + // stream will be created. + string stream_id = 2; + + // The writes to apply. + // + // Always executed atomically and in order. + // This must be empty on the first request. + // This may be empty on the last request. + // This must not be empty on all other requests. + repeated Write writes = 3; + + // A stream token that was previously sent by the server. + // + // The client should set this field to the token from the most recent + // [WriteResponse][google.firestore.v1.WriteResponse] it has received. This + // acknowledges that the client has received responses up to this token. After + // sending this token, earlier tokens may not be used anymore. + // + // The server may close the stream if there are too many unacknowledged + // responses. + // + // Leave this field unset when creating a new stream. To resume a stream at + // a specific point, set this field and the `stream_id` field. + // + // Leave this field unset when creating a new stream. + bytes stream_token = 4; + + // Labels associated with this write request. + map labels = 5; +} + +// The response for [Firestore.Write][google.firestore.v1.Firestore.Write]. +message WriteResponse { + // The ID of the stream. + // Only set on the first message, when a new stream was created. + string stream_id = 1; + + // A token that represents the position of this response in the stream. + // This can be used by a client to resume the stream at this point. + // + // This field is always set. + bytes stream_token = 2; + + // The result of applying the writes. + // + // This i-th write result corresponds to the i-th write in the + // request. + repeated WriteResult write_results = 3; + + // The time at which the commit occurred. Any read with an equal or greater + // `read_time` is guaranteed to see the effects of the write. + google.protobuf.Timestamp commit_time = 4; +} + +// A request for [Firestore.Listen][google.firestore.v1.Firestore.Listen] +message ListenRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The supported target changes. + oneof target_change { + // A target to add to this stream. + Target add_target = 2; + + // The ID of a target to remove from this stream. + int32 remove_target = 3; + } + + // Labels associated with this target change. + map labels = 4; +} + +// The response for [Firestore.Listen][google.firestore.v1.Firestore.Listen]. +message ListenResponse { + // The supported responses. + oneof response_type { + // Targets have changed. + TargetChange target_change = 2; + + // A [Document][google.firestore.v1.Document] has changed. + DocumentChange document_change = 3; + + // A [Document][google.firestore.v1.Document] has been deleted. + DocumentDelete document_delete = 4; + + // A [Document][google.firestore.v1.Document] has been removed from a target + // (because it is no longer relevant to that target). + DocumentRemove document_remove = 6; + + // A filter to apply to the set of documents previously returned for the + // given target. + // + // Returned when documents may have been removed from the given target, but + // the exact documents are unknown. + ExistenceFilter filter = 5; + } +} + +// A specification of a set of documents to listen to. +message Target { + // A target specified by a set of documents names. + message DocumentsTarget { + // The names of the documents to retrieve. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // The request will fail if any of the document is not a child resource of + // the given `database`. Duplicate names will be elided. + repeated string documents = 2; + } + + // A target specified by a query. + message QueryTarget { + // The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1; + + // The query to run. + oneof query_type { + // A structured query. + StructuredQuery structured_query = 2; + } + } + + // The type of target to listen to. + oneof target_type { + // A target specified by a query. + QueryTarget query = 2; + + // A target specified by a set of document names. + DocumentsTarget documents = 3; + } + + // When to start listening. + // + // If specified, only the matching Documents that have been updated AFTER the + // `resume_token` or `read_time` will be returned. Otherwise, all matching + // Documents are returned before any subsequent changes. + oneof resume_type { + // A resume token from a prior + // [TargetChange][google.firestore.v1.TargetChange] for an identical target. + // + // Using a resume token with a different target is unsupported and may fail. + bytes resume_token = 4; + + // Start listening after a specific `read_time`. + // + // The client must know the state of matching documents at this time. + google.protobuf.Timestamp read_time = 11; + } + + // The target ID that identifies the target on the stream. Must be a positive + // number and non-zero. + // + // If `target_id` is 0 (or unspecified), the server will assign an ID for this + // target and return that in a `TargetChange::ADD` event. Once a target with + // `target_id=0` is added, all subsequent targets must also have + // `target_id=0`. If an `AddTarget` request with `target_id != 0` is + // sent to the server after a target with `target_id=0` is added, the server + // will immediately send a response with a `TargetChange::Remove` event. + // + // Note that if the client sends multiple `AddTarget` requests + // without an ID, the order of IDs returned in `TargetChange.target_ids` are + // undefined. Therefore, clients should provide a target ID instead of relying + // on the server to assign one. + // + // If `target_id` is non-zero, there must not be an existing active target on + // this stream with the same ID. + int32 target_id = 5; + + // If the target should be removed once it is current and consistent. + bool once = 6; + + // The number of documents that last matched the query at the resume token or + // read time. + // + // This value is only relevant when a `resume_type` is provided. This value + // being present and greater than zero signals that the client wants + // `ExistenceFilter.unchanged_names` to be included in the response. + google.protobuf.Int32Value expected_count = 12; +} + +// Targets being watched have changed. +message TargetChange { + // The type of change. + enum TargetChangeType { + // No change has occurred. Used only to send an updated `resume_token`. + NO_CHANGE = 0; + + // The targets have been added. + ADD = 1; + + // The targets have been removed. + REMOVE = 2; + + // The targets reflect all changes committed before the targets were added + // to the stream. + // + // This will be sent after or with a `read_time` that is greater than or + // equal to the time at which the targets were added. + // + // Listeners can wait for this change if read-after-write semantics + // are desired. + CURRENT = 3; + + // The targets have been reset, and a new initial state for the targets + // will be returned in subsequent changes. + // + // After the initial state is complete, `CURRENT` will be returned even + // if the target was previously indicated to be `CURRENT`. + RESET = 4; + } + + // The type of change that occurred. + TargetChangeType target_change_type = 1; + + // The target IDs of targets that have changed. + // + // If empty, the change applies to all targets. + // + // The order of the target IDs is not defined. + repeated int32 target_ids = 2; + + // The error that resulted in this change, if applicable. + google.rpc.Status cause = 3; + + // A token that can be used to resume the stream for the given `target_ids`, + // or all targets if `target_ids` is empty. + // + // Not set on every target change. + bytes resume_token = 4; + + // The consistent `read_time` for the given `target_ids` (omitted when the + // target_ids are not at a consistent snapshot). + // + // The stream is guaranteed to send a `read_time` with `target_ids` empty + // whenever the entire stream reaches a new consistent snapshot. ADD, + // CURRENT, and RESET messages are guaranteed to (eventually) result in a + // new consistent snapshot (while NO_CHANGE and REMOVE messages are not). + // + // For a given stream, `read_time` is guaranteed to be monotonically + // increasing. + google.protobuf.Timestamp read_time = 6; +} + +// The request for +// [Firestore.ListCollectionIds][google.firestore.v1.Firestore.ListCollectionIds]. +message ListCollectionIdsRequest { + // Required. The parent document. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + // + // Use `projects/{project_id}/databases/{database_id}/documents` to list + // top-level collections. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of results to return. + int32 page_size = 2; + + // A page token. Must be a value from + // [ListCollectionIdsResponse][google.firestore.v1.ListCollectionIdsResponse]. + string page_token = 3; + + // The consistency mode for this request. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads documents as they were at the given time. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 4; + } +} + +// The response from +// [Firestore.ListCollectionIds][google.firestore.v1.Firestore.ListCollectionIds]. +message ListCollectionIdsResponse { + // The collection ids. + repeated string collection_ids = 1; + + // A page token that may be used to continue the list. + string next_page_token = 2; +} + +// The request for +// [Firestore.BatchWrite][google.firestore.v1.Firestore.BatchWrite]. +message BatchWriteRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The writes to apply. + // + // Method does not apply writes atomically and does not guarantee ordering. + // Each write succeeds or fails independently. You cannot write to the same + // document more than once per request. + repeated Write writes = 2; + + // Labels associated with this batch write. + map labels = 3; +} + +// The response from +// [Firestore.BatchWrite][google.firestore.v1.Firestore.BatchWrite]. +message BatchWriteResponse { + // The result of applying the writes. + // + // This i-th write result corresponds to the i-th write in the + // request. + repeated WriteResult write_results = 1; + + // The status of applying the writes. + // + // This i-th write status corresponds to the i-th write in the + // request. + repeated google.rpc.Status status = 2; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/pipeline.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/pipeline.proto new file mode 100644 index 000000000000..509ecd2730e6 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/pipeline.proto @@ -0,0 +1,43 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +import "google/api/field_behavior.proto"; +import "google/firestore/v1/document.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "PipelineProto"; +option java_package = "com.google.firestore.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// A Firestore query represented as an ordered list of operations / stages. +// +// This is considered the top-level function which plans and executes a query. +// It is logically equivalent to `query(stages, options)`, but prevents the +// client from having to build a function wrapper. +message StructuredPipeline { + // Required. The pipeline query to execute. + Pipeline pipeline = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Optional query-level arguments. + // + map options = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/query.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/query.proto new file mode 100644 index 000000000000..8ff0c66b4b03 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/query.proto @@ -0,0 +1,600 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +import "google/api/field_behavior.proto"; +import "google/firestore/v1/document.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "QueryProto"; +option java_package = "com.google.firestore.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// A Firestore query. +// +// The query stages are executed in the following order: +// 1. from +// 2. where +// 3. select +// 4. order_by + start_at + end_at +// 5. offset +// 6. limit +// 7. find_nearest +message StructuredQuery { + // A selection of a collection, such as `messages as m1`. + message CollectionSelector { + // The collection ID. + // When set, selects only collections with this ID. + string collection_id = 2; + + // When false, selects only collections that are immediate children of + // the `parent` specified in the containing `RunQueryRequest`. + // When true, selects all descendant collections. + bool all_descendants = 3; + } + + // A filter. + message Filter { + // The type of filter. + oneof filter_type { + // A composite filter. + CompositeFilter composite_filter = 1; + + // A filter on a document field. + FieldFilter field_filter = 2; + + // A filter that takes exactly one argument. + UnaryFilter unary_filter = 3; + } + } + + // A filter that merges multiple other filters using the given operator. + message CompositeFilter { + // A composite filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // Documents are required to satisfy all of the combined filters. + AND = 1; + + // Documents are required to satisfy at least one of the combined filters. + OR = 2; + } + + // The operator for combining multiple filters. + Operator op = 1; + + // The list of filters to combine. + // + // Requires: + // + // * At least one filter is present. + repeated Filter filters = 2; + } + + // A filter on a specific field. + message FieldFilter { + // A field filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // The given `field` is less than the given `value`. + // + // Requires: + // + // * That `field` come first in `order_by`. + LESS_THAN = 1; + + // The given `field` is less than or equal to the given `value`. + // + // Requires: + // + // * That `field` come first in `order_by`. + LESS_THAN_OR_EQUAL = 2; + + // The given `field` is greater than the given `value`. + // + // Requires: + // + // * That `field` come first in `order_by`. + GREATER_THAN = 3; + + // The given `field` is greater than or equal to the given `value`. + // + // Requires: + // + // * That `field` come first in `order_by`. + GREATER_THAN_OR_EQUAL = 4; + + // The given `field` is equal to the given `value`. + EQUAL = 5; + + // The given `field` is not equal to the given `value`. + // + // Requires: + // + // * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. + // * That `field` comes first in the `order_by`. + NOT_EQUAL = 6; + + // The given `field` is an array that contains the given `value`. + ARRAY_CONTAINS = 7; + + // The given `field` is equal to at least one value in the given array. + // + // Requires: + // + // * That `value` is a non-empty `ArrayValue`, subject to disjunction + // limits. + // * No `NOT_IN` filters in the same query. + IN = 8; + + // The given `field` is an array that contains any of the values in the + // given array. + // + // Requires: + // + // * That `value` is a non-empty `ArrayValue`, subject to disjunction + // limits. + // * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. + // * No `NOT_IN` filters in the same query. + ARRAY_CONTAINS_ANY = 9; + + // The value of the `field` is not in the given array. + // + // Requires: + // + // * That `value` is a non-empty `ArrayValue` with at most 10 values. + // * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, + // `IS_NOT_NULL`, or `IS_NOT_NAN`. + // * That `field` comes first in the `order_by`. + NOT_IN = 10; + } + + // The field to filter by. + FieldReference field = 1; + + // The operator to filter by. + Operator op = 2; + + // The value to compare to. + Value value = 3; + } + + // A filter with a single operand. + message UnaryFilter { + // A unary operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // The given `field` is equal to `NaN`. + IS_NAN = 2; + + // The given `field` is equal to `NULL`. + IS_NULL = 3; + + // The given `field` is not equal to `NaN`. + // + // Requires: + // + // * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. + // * That `field` comes first in the `order_by`. + IS_NOT_NAN = 4; + + // The given `field` is not equal to `NULL`. + // + // Requires: + // + // * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. + // * That `field` comes first in the `order_by`. + IS_NOT_NULL = 5; + } + + // The unary operator to apply. + Operator op = 1; + + // The argument to the filter. + oneof operand_type { + // The field to which to apply the operator. + FieldReference field = 2; + } + } + + // An order on a field. + message Order { + // The field to order by. + FieldReference field = 1; + + // The direction to order by. Defaults to `ASCENDING`. + Direction direction = 2; + } + + // A sort direction. + enum Direction { + // Unspecified. + DIRECTION_UNSPECIFIED = 0; + + // Ascending. + ASCENDING = 1; + + // Descending. + DESCENDING = 2; + } + + // A reference to a field in a document, ex: `stats.operations`. + message FieldReference { + // A reference to a field in a document. + // + // Requires: + // + // * MUST be a dot-delimited (`.`) string of segments, where each segment + // conforms to [document field name][google.firestore.v1.Document.fields] + // limitations. + string field_path = 2; + } + + // The projection of document's fields to return. + message Projection { + // The fields to return. + // + // If empty, all fields are returned. To only return the name + // of the document, use `['__name__']`. + repeated FieldReference fields = 2; + } + + // Nearest Neighbors search config. The ordering provided by FindNearest + // supersedes the order_by stage. If multiple documents have the same vector + // distance, the returned document order is not guaranteed to be stable + // between queries. + message FindNearest { + // The distance measure to use when comparing vectors. + enum DistanceMeasure { + // Should not be set. + DISTANCE_MEASURE_UNSPECIFIED = 0; + + // Measures the EUCLIDEAN distance between the vectors. See + // [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn + // more. The resulting distance decreases the more similar two vectors + // are. + EUCLIDEAN = 1; + + // COSINE distance compares vectors based on the angle between them, which + // allows you to measure similarity that isn't based on the vectors + // magnitude. We recommend using DOT_PRODUCT with unit normalized vectors + // instead of COSINE distance, which is mathematically equivalent with + // better performance. See [Cosine + // Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn + // more about COSINE similarity and COSINE distance. The resulting + // COSINE distance decreases the more similar two vectors are. + COSINE = 2; + + // Similar to cosine but is affected by the magnitude of the vectors. See + // [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. + // The resulting distance increases the more similar two vectors are. + DOT_PRODUCT = 3; + } + + // Required. An indexed vector field to search upon. Only documents which + // contain vectors whose dimensionality match the query_vector can be + // returned. + FieldReference vector_field = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The query vector that we are searching on. Must be a vector of + // no more than 2048 dimensions. + Value query_vector = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The distance measure to use, required. + DistanceMeasure distance_measure = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The number of nearest neighbors to return. Must be a positive + // integer of no more than 1000. + google.protobuf.Int32Value limit = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Optional name of the field to output the result of the vector + // distance calculation. Must conform to [document field + // name][google.firestore.v1.Document.fields] limitations. + string distance_result_field = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Option to specify a threshold for which no less similar + // documents will be returned. The behavior of the specified + // `distance_measure` will affect the meaning of the distance threshold. + // Since DOT_PRODUCT distances increase when the vectors are more similar, + // the comparison is inverted. + // + // * For EUCLIDEAN, COSINE: `WHERE distance <= distance_threshold` + // * For DOT_PRODUCT: `WHERE distance >= distance_threshold` + google.protobuf.DoubleValue distance_threshold = 6 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional sub-set of the fields to return. + // + // This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the + // documents returned from a query. When not set, assumes that the caller + // wants all fields returned. + Projection select = 1; + + // The collections to query. + repeated CollectionSelector from = 2; + + // The filter to apply. + Filter where = 3; + + // The order to apply to the query results. + // + // Callers can provide a full ordering, a partial ordering, or no ordering at + // all. While Firestore will always respect the provided order, the behavior + // for queries without a full ordering is different per database edition: + // + // In Standard edition, Firestore guarantees a stable ordering through the + // following rules: + // + // * The `order_by` is required to reference all fields used with an + // inequality filter. + // * All fields that are required to be in the `order_by` but are not already + // present are appended in lexicographical ordering of the field name. + // * If an order on `__name__` is not specified, it is appended by default. + // + // Fields are appended with the same sort direction as the last order + // specified, or 'ASCENDING' if no order was specified. For example: + // + // * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC` + // * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC` + // * `WHERE a > 1` becomes `WHERE a > 1 ORDER BY a ASC, __name__ ASC` + // * `WHERE __name__ > ... AND a > 1` becomes + // `WHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC` + // + // In Enterprise edition, Firestore does not guarantee a stable ordering. + // Instead it will pick the most efficient ordering based on the indexes + // available at the time of query execution. This will result in a different + // ordering for queries that are otherwise identical. To ensure a stable + // ordering, always include a unique field in the `order_by` clause, such as + // `__name__`. + repeated Order order_by = 4; + + // A potential prefix of a position in the result set to start the query at. + // + // The ordering of the result set is based on the `ORDER BY` clause of the + // original query. + // + // ``` + // SELECT * FROM k WHERE a = 1 AND b > 2 ORDER BY b ASC, __name__ ASC; + // ``` + // + // This query's results are ordered by `(b ASC, __name__ ASC)`. + // + // Cursors can reference either the full ordering or a prefix of the location, + // though it cannot reference more fields than what are in the provided + // `ORDER BY`. + // + // Continuing off the example above, attaching the following start cursors + // will have varying impact: + // + // - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND + // b > 2 AND __name__ > /k/123`. + // - `START AFTER (10)`: start the query right after `a = 1 AND b > 10`. + // + // Unlike `OFFSET` which requires scanning over the first N results to skip, + // a start cursor allows the query to begin at a logical position. This + // position is not required to match an actual result, it will scan forward + // from this position to find the next document. + // + // Requires: + // + // * The number of values cannot be greater than the number of fields + // specified in the `ORDER BY` clause. + Cursor start_at = 7; + + // A potential prefix of a position in the result set to end the query at. + // + // This is similar to `START_AT` but with it controlling the end position + // rather than the start position. + // + // Requires: + // + // * The number of values cannot be greater than the number of fields + // specified in the `ORDER BY` clause. + Cursor end_at = 8; + + // The number of documents to skip before returning the first result. + // + // This applies after the constraints specified by the `WHERE`, `START AT`, & + // `END AT` but before the `LIMIT` clause. + // + // Requires: + // + // * The value must be greater than or equal to zero if specified. + int32 offset = 6; + + // The maximum number of results to return. + // + // Applies after all other constraints. + // + // Requires: + // + // * The value must be greater than or equal to zero if specified. + google.protobuf.Int32Value limit = 5; + + // Optional. A potential nearest neighbors search. + // + // Applies after all other filters and ordering. + // + // Finds the closest vector embeddings to the given query vector. + FindNearest find_nearest = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// Firestore query for running an aggregation over a +// [StructuredQuery][google.firestore.v1.StructuredQuery]. +message StructuredAggregationQuery { + // Defines an aggregation that produces a single result. + message Aggregation { + // Count of documents that match the query. + // + // The `COUNT(*)` aggregation function operates on the entire document + // so it does not require a field reference. + message Count { + // Optional. Optional constraint on the maximum number of documents to + // count. + // + // This provides a way to set an upper bound on the number of documents + // to scan, limiting latency, and cost. + // + // Unspecified is interpreted as no bound. + // + // High-Level Example: + // + // ``` + // AGGREGATE COUNT_UP_TO(1000) OVER ( SELECT * FROM k ); + // ``` + // + // Requires: + // + // * Must be greater than zero when present. + google.protobuf.Int64Value up_to = 1 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Sum of the values of the requested field. + // + // * Only numeric values will be aggregated. All non-numeric values + // including `NULL` are skipped. + // + // * If the aggregated values contain `NaN`, returns `NaN`. Infinity math + // follows IEEE-754 standards. + // + // * If the aggregated value set is empty, returns 0. + // + // * Returns a 64-bit integer if all aggregated numbers are integers and the + // sum result does not overflow. Otherwise, the result is returned as a + // double. Note that even if all the aggregated values are integers, the + // result is returned as a double if it cannot fit within a 64-bit signed + // integer. When this occurs, the returned value will lose precision. + // + // * When underflow occurs, floating-point aggregation is non-deterministic. + // This means that running the same query repeatedly without any changes to + // the underlying values could produce slightly different results each + // time. In those cases, values should be stored as integers over + // floating-point numbers. + message Sum { + // The field to aggregate on. + StructuredQuery.FieldReference field = 1; + } + + // Average of the values of the requested field. + // + // * Only numeric values will be aggregated. All non-numeric values + // including `NULL` are skipped. + // + // * If the aggregated values contain `NaN`, returns `NaN`. Infinity math + // follows IEEE-754 standards. + // + // * If the aggregated value set is empty, returns `NULL`. + // + // * Always returns the result as a double. + message Avg { + // The field to aggregate on. + StructuredQuery.FieldReference field = 1; + } + + // The type of aggregation to perform, required. + oneof operator { + // Count aggregator. + Count count = 1; + + // Sum aggregator. + Sum sum = 2; + + // Average aggregator. + Avg avg = 3; + } + + // Optional. Optional name of the field to store the result of the + // aggregation into. + // + // If not provided, Firestore will pick a default name following the format + // `field_`. For example: + // + // ``` + // AGGREGATE + // COUNT_UP_TO(1) AS count_up_to_1, + // COUNT_UP_TO(2), + // COUNT_UP_TO(3) AS count_up_to_3, + // COUNT(*) + // OVER ( + // ... + // ); + // ``` + // + // becomes: + // + // ``` + // AGGREGATE + // COUNT_UP_TO(1) AS count_up_to_1, + // COUNT_UP_TO(2) AS field_1, + // COUNT_UP_TO(3) AS count_up_to_3, + // COUNT(*) AS field_2 + // OVER ( + // ... + // ); + // ``` + // + // Requires: + // + // * Must be unique across all aggregation aliases. + // * Conform to [document field name][google.firestore.v1.Document.fields] + // limitations. + string alias = 7 [(google.api.field_behavior) = OPTIONAL]; + } + + // The base query to aggregate over. + oneof query_type { + // Nested structured query. + StructuredQuery structured_query = 1; + } + + // Optional. Series of aggregations to apply over the results of the + // `structured_query`. + // + // Requires: + // + // * A minimum of one and maximum of five aggregations per query. + repeated Aggregation aggregations = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A position in a query result set. +message Cursor { + // The values that represent a position, in the order they appear in + // the order by clause of a query. + // + // Can contain fewer values than specified in the order by clause. + repeated Value values = 1; + + // If the position is just before or just after the given values, relative + // to the sort order defined by the query. + bool before = 2; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/query_profile.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/query_profile.proto new file mode 100644 index 000000000000..a5f9e95c51fe --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/query_profile.proto @@ -0,0 +1,92 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "QueryProfileProto"; +option java_package = "com.google.firestore.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// Specification of the Firestore Query Profile fields. + +// Explain options for the query. +message ExplainOptions { + // Optional. Whether to execute this query. + // + // When false (the default), the query will be planned, returning only + // metrics from the planning stages. + // + // When true, the query will be planned and executed, returning the full + // query results along with both planning and execution stage metrics. + bool analyze = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Explain metrics for the query. +message ExplainMetrics { + // Planning phase information for the query. + PlanSummary plan_summary = 1; + + // Aggregated stats from the execution of the query. Only present when + // [ExplainOptions.analyze][google.firestore.v1.ExplainOptions.analyze] is set + // to true. + ExecutionStats execution_stats = 2; +} + +// Planning phase information for the query. +message PlanSummary { + // The indexes selected for the query. For example: + // [ + // {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"}, + // {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"} + // ] + repeated google.protobuf.Struct indexes_used = 1; +} + +// Execution statistics for the query. +message ExecutionStats { + // Total number of results returned, including documents, projections, + // aggregation results, keys. + int64 results_returned = 1; + + // Total time to execute the query in the backend. + google.protobuf.Duration execution_duration = 3; + + // Total billable read operations. + int64 read_operations = 4; + + // Debugging statistics from the execution of the query. Note that the + // debugging stats are subject to change as Firestore evolves. It could + // include: + // { + // "indexes_entries_scanned": "1000", + // "documents_scanned": "20", + // "billing_details" : { + // "documents_billable": "20", + // "index_entries_billable": "1000", + // "min_query_cost": "0" + // } + // } + google.protobuf.Struct debug_stats = 5; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1/write.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1/write.proto new file mode 100644 index 000000000000..49f9a4870f92 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1/write.proto @@ -0,0 +1,286 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.firestore.v1; + +import "google/firestore/v1/bloom_filter.proto"; +import "google/firestore/v1/common.proto"; +import "google/firestore/v1/document.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "WriteProto"; +option java_package = "com.google.firestore.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; + +// A write on a document. +message Write { + // The operation to execute. + oneof operation { + // A document to write. + Document update = 1; + + // A document name to delete. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string delete = 2; + + // Applies a transformation to a document. + DocumentTransform transform = 6; + } + + // The fields to update in this write. + // + // This field can be set only when the operation is `update`. + // If the mask is not set for an `update` and the document exists, any + // existing data will be overwritten. + // If the mask is set and the document on the server has fields not covered by + // the mask, they are left unchanged. + // Fields referenced in the mask, but not present in the input document, are + // deleted from the document on the server. + // The field paths in this mask must not contain a reserved field name. + DocumentMask update_mask = 3; + + // The transforms to perform after update. + // + // This field can be set only when the operation is `update`. If present, this + // write is equivalent to performing `update` and `transform` to the same + // document atomically and in order. + repeated DocumentTransform.FieldTransform update_transforms = 7; + + // An optional precondition on the document. + // + // The write will fail if this is set and not met by the target document. + Precondition current_document = 4; +} + +// A transformation of a document. +message DocumentTransform { + // A transformation of a field of the document. + message FieldTransform { + // A value that is calculated by the server. + enum ServerValue { + // Unspecified. This value must not be used. + SERVER_VALUE_UNSPECIFIED = 0; + + // The time at which the server processed the request, with millisecond + // precision. If used on multiple fields (same or different documents) in + // a transaction, all the fields will get the same server timestamp. + REQUEST_TIME = 1; + } + + // The path of the field. See + // [Document.fields][google.firestore.v1.Document.fields] for the field path + // syntax reference. + string field_path = 1; + + // The transformation to apply on the field. + oneof transform_type { + // Sets the field to the given server value. + ServerValue set_to_server_value = 2; + + // Adds the given value to the field's current value. + // + // This must be an integer or a double value. + // If the field is not an integer or double, or if the field does not yet + // exist, the transformation will set the field to the given value. + // If either of the given value or the current field value are doubles, + // both values will be interpreted as doubles. Double arithmetic and + // representation of double values follow IEEE 754 semantics. + // If there is positive/negative integer overflow, the field is resolved + // to the largest magnitude positive/negative integer. + Value increment = 3; + + // Sets the field to the maximum of its current value and the given value. + // + // This must be an integer or a double value. + // If the field is not an integer or double, or if the field does not yet + // exist, the transformation will set the field to the given value. + // If a maximum operation is applied where the field and the input value + // are of mixed types (that is - one is an integer and one is a double) + // the field takes on the type of the larger operand. If the operands are + // equivalent (e.g. 3 and 3.0), the field does not change. + // 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and + // zero input value is always the stored value. + // The maximum of any numeric value x and NaN is NaN. + Value maximum = 4; + + // Sets the field to the minimum of its current value and the given value. + // + // This must be an integer or a double value. + // If the field is not an integer or double, or if the field does not yet + // exist, the transformation will set the field to the input value. + // If a minimum operation is applied where the field and the input value + // are of mixed types (that is - one is an integer and one is a double) + // the field takes on the type of the smaller operand. If the operands are + // equivalent (e.g. 3 and 3.0), the field does not change. + // 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and + // zero input value is always the stored value. + // The minimum of any numeric value x and NaN is NaN. + Value minimum = 5; + + // Append the given elements in order if they are not already present in + // the current field value. + // If the field is not an array, or if the field does not yet exist, it is + // first set to the empty array. + // + // Equivalent numbers of different types (e.g. 3L and 3.0) are + // considered equal when checking if a value is missing. + // NaN is equal to NaN, and Null is equal to Null. + // If the input contains multiple equivalent values, only the first will + // be considered. + // + // The corresponding transform_result will be the null value. + ArrayValue append_missing_elements = 6; + + // Remove all of the given elements from the array in the field. + // If the field is not an array, or if the field does not yet exist, it is + // set to the empty array. + // + // Equivalent numbers of the different types (e.g. 3L and 3.0) are + // considered equal when deciding whether an element should be removed. + // NaN is equal to NaN, and Null is equal to Null. + // This will remove all equivalent values if there are duplicates. + // + // The corresponding transform_result will be the null value. + ArrayValue remove_all_from_array = 7; + } + } + + // The name of the document to transform. + string document = 1; + + // The list of transformations to apply to the fields of the document, in + // order. + // This must not be empty. + repeated FieldTransform field_transforms = 2; +} + +// The result of applying a write. +message WriteResult { + // The last update time of the document after applying the write. Not set + // after a `delete`. + // + // If the write did not actually change the document, this will be the + // previous update_time. + google.protobuf.Timestamp update_time = 1; + + // The results of applying each + // [DocumentTransform.FieldTransform][google.firestore.v1.DocumentTransform.FieldTransform], + // in the same order. + repeated Value transform_results = 2; +} + +// A [Document][google.firestore.v1.Document] has changed. +// +// May be the result of multiple [writes][google.firestore.v1.Write], including +// deletes, that ultimately resulted in a new value for the +// [Document][google.firestore.v1.Document]. +// +// Multiple [DocumentChange][google.firestore.v1.DocumentChange] messages may be +// returned for the same logical change, if multiple targets are affected. +message DocumentChange { + // The new state of the [Document][google.firestore.v1.Document]. + // + // If `mask` is set, contains only fields that were updated or added. + Document document = 1; + + // A set of target IDs of targets that match this document. + repeated int32 target_ids = 5; + + // A set of target IDs for targets that no longer match this document. + repeated int32 removed_target_ids = 6; +} + +// A [Document][google.firestore.v1.Document] has been deleted. +// +// May be the result of multiple [writes][google.firestore.v1.Write], including +// updates, the last of which deleted the +// [Document][google.firestore.v1.Document]. +// +// Multiple [DocumentDelete][google.firestore.v1.DocumentDelete] messages may be +// returned for the same logical delete, if multiple targets are affected. +message DocumentDelete { + // The resource name of the [Document][google.firestore.v1.Document] that was + // deleted. + string document = 1; + + // A set of target IDs for targets that previously matched this entity. + repeated int32 removed_target_ids = 6; + + // The read timestamp at which the delete was observed. + // + // Greater or equal to the `commit_time` of the delete. + google.protobuf.Timestamp read_time = 4; +} + +// A [Document][google.firestore.v1.Document] has been removed from the view of +// the targets. +// +// Sent if the document is no longer relevant to a target and is out of view. +// Can be sent instead of a DocumentDelete or a DocumentChange if the server +// can not send the new value of the document. +// +// Multiple [DocumentRemove][google.firestore.v1.DocumentRemove] messages may be +// returned for the same logical write or delete, if multiple targets are +// affected. +message DocumentRemove { + // The resource name of the [Document][google.firestore.v1.Document] that has + // gone out of view. + string document = 1; + + // A set of target IDs for targets that previously matched this document. + repeated int32 removed_target_ids = 2; + + // The read timestamp at which the remove was observed. + // + // Greater or equal to the `commit_time` of the change/delete/remove. + google.protobuf.Timestamp read_time = 4; +} + +// A digest of all the documents that match a given target. +message ExistenceFilter { + // The target ID to which this filter applies. + int32 target_id = 1; + + // The total count of documents that match + // [target_id][google.firestore.v1.ExistenceFilter.target_id]. + // + // If different from the count of documents in the client that match, the + // client must manually determine which documents no longer match the target. + // + // The client can use the `unchanged_names` bloom filter to assist with + // this determination by testing ALL the document names against the filter; + // if the document name is NOT in the filter, it means the document no + // longer matches the target. + int32 count = 2; + + // A bloom filter that, despite its name, contains the UTF-8 byte encodings of + // the resource names of ALL the documents that match + // [target_id][google.firestore.v1.ExistenceFilter.target_id], in the form + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // + // This bloom filter may be omitted at the server's discretion, such as if it + // is deemed that the client will not make use of it or if it is too + // computationally expensive to calculate or transmit. Clients must gracefully + // handle this field being absent by falling back to the logic used before + // this field existed; that is, re-add the target without a resume token to + // figure out which documents in the client's cache are out of sync. + BloomFilter unchanged_names = 3; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/common.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/common.proto new file mode 100644 index 000000000000..b18e53398b75 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/common.proto @@ -0,0 +1,82 @@ +// Copyright 2025 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; +option ruby_package = "Google::Cloud::Firestore::V1beta1"; + +// A set of field paths on a document. +// Used to restrict a get or update operation on a document to a subset of its +// fields. +// This is different from standard field masks, as this is always scoped to a +// [Document][google.firestore.v1beta1.Document], and takes in account the dynamic nature of [Value][google.firestore.v1beta1.Value]. +message DocumentMask { + // The list of field paths in the mask. See [Document.fields][google.firestore.v1beta1.Document.fields] for a field + // path syntax reference. + repeated string field_paths = 1; +} + +// A precondition on a document, used for conditional operations. +message Precondition { + // The type of precondition. + oneof condition_type { + // When set to `true`, the target document must exist. + // When set to `false`, the target document must not exist. + bool exists = 1; + + // When set, the target document must exist and have been last updated at + // that time. + google.protobuf.Timestamp update_time = 2; + } +} + +// Options for creating a new transaction. +message TransactionOptions { + // Options for a transaction that can be used to read and write documents. + message ReadWrite { + // An optional transaction to retry. + bytes retry_transaction = 1; + } + + // Options for a transaction that can only be used to read documents. + message ReadOnly { + // The consistency mode for this transaction. If not set, defaults to strong + // consistency. + oneof consistency_selector { + // Reads documents at the given time. + // This may not be older than 60 seconds. + google.protobuf.Timestamp read_time = 2; + } + } + + // The mode of the transaction. + oneof mode { + // The transaction can only be used for read operations. + ReadOnly read_only = 2; + + // The transaction can be used for both read and write operations. + ReadWrite read_write = 3; + } +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/document.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/document.proto new file mode 100644 index 000000000000..36b30151cd6d --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/document.proto @@ -0,0 +1,149 @@ +// Copyright 2025 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/latlng.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; +option ruby_package = "Google::Cloud::Firestore::V1beta1"; + +// A Firestore document. +// +// Must not exceed 1 MiB - 4 bytes. +message Document { + // The resource name of the document, for example + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string name = 1; + + // The document's fields. + // + // The map keys represent field names. + // + // A simple field name contains only characters `a` to `z`, `A` to `Z`, + // `0` to `9`, or `_`, and must not start with `0` to `9`. For example, + // `foo_bar_17`. + // + // Field names matching the regular expression `__.*__` are reserved. Reserved + // field names are forbidden except in certain documented contexts. The map + // keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be + // empty. + // + // Field paths may be used in other contexts to refer to structured fields + // defined here. For `map_value`, the field path is represented by the simple + // or quoted field names of the containing fields, delimited by `.`. For + // example, the structured field + // `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be + // represented by the field path `foo.x&y`. + // + // Within a field path, a quoted field name starts and ends with `` ` `` and + // may contain any character. Some characters, including `` ` ``, must be + // escaped using a `\`. For example, `` `x&y` `` represents `x&y` and + // `` `bak\`tik` `` represents `` bak`tik ``. + map fields = 2; + + // Output only. The time at which the document was created. + // + // This value increases monotonically when a document is deleted then + // recreated. It can also be compared to values from other documents and + // the `read_time` of a query. + google.protobuf.Timestamp create_time = 3; + + // Output only. The time at which the document was last changed. + // + // This value is initially set to the `create_time` then increases + // monotonically with each change to the document. It can also be + // compared to values from other documents and the `read_time` of a query. + google.protobuf.Timestamp update_time = 4; +} + +// A message that can hold any of the supported value types. +message Value { + // Must have a value set. + oneof value_type { + // A null value. + google.protobuf.NullValue null_value = 11; + + // A boolean value. + bool boolean_value = 1; + + // An integer value. + int64 integer_value = 2; + + // A double value. + double double_value = 3; + + // A timestamp value. + // + // Precise only to microseconds. When stored, any additional precision is + // rounded down. + google.protobuf.Timestamp timestamp_value = 10; + + // A string value. + // + // The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes. + // Only the first 1,500 bytes of the UTF-8 representation are considered by + // queries. + string string_value = 17; + + // A bytes value. + // + // Must not exceed 1 MiB - 89 bytes. + // Only the first 1,500 bytes are considered by queries. + bytes bytes_value = 18; + + // A reference to a document. For example: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string reference_value = 5; + + // A geo point value representing a point on the surface of Earth. + google.type.LatLng geo_point_value = 8; + + // An array value. + // + // Cannot directly contain another array value, though can contain an + // map which contains another array. + ArrayValue array_value = 9; + + // A map value. + MapValue map_value = 6; + } +} + +// An array value. +message ArrayValue { + // Values in the array. + repeated Value values = 1; +} + +// A map value. +message MapValue { + // The map's fields. + // + // The map keys represent field names. Field names matching the regular + // expression `__.*__` are reserved. Reserved field names are forbidden except + // in certain documented contexts. The map keys, represented as UTF-8, must + // not exceed 1,500 bytes and cannot be empty. + map fields = 1; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/firestore.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/firestore.proto new file mode 100644 index 000000000000..07d4b3fe998b --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/firestore.proto @@ -0,0 +1,900 @@ +// Copyright 2025 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/firestore/v1beta1/common.proto"; +import "google/firestore/v1beta1/document.proto"; +import "google/firestore/v1beta1/query.proto"; +import "google/firestore/v1beta1/write.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "FirestoreProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; +option ruby_package = "Google::Cloud::Firestore::V1beta1"; + +// Specification of the Firestore API. + +// The Cloud Firestore service. +// +// Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL +// document database that simplifies storing, syncing, and querying data for +// your mobile, web, and IoT apps at global scale. Its client libraries provide +// live synchronization and offline support, while its security features and +// integrations with Firebase and Google Cloud Platform (GCP) accelerate +// building truly serverless apps. +service Firestore { + option (google.api.default_host) = "firestore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/datastore"; + + // Gets a single document. + rpc GetDocument(GetDocumentRequest) returns (Document) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/databases/*/documents/*/**}" + }; + } + + // Lists documents. + rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}" + }; + } + + // Updates or inserts a document. + rpc UpdateDocument(UpdateDocumentRequest) returns (Document) { + option (google.api.http) = { + patch: "/v1beta1/{document.name=projects/*/databases/*/documents/*/**}" + body: "document" + }; + option (google.api.method_signature) = "document,update_mask"; + } + + // Deletes a document. + rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/databases/*/documents/*/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets multiple documents. + // + // Documents returned by this method are not guaranteed to be returned in the + // same order that they were requested. + rpc BatchGetDocuments(BatchGetDocumentsRequest) returns (stream BatchGetDocumentsResponse) { + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:batchGet" + body: "*" + }; + } + + // Starts a new transaction. + rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse) { + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction" + body: "*" + }; + option (google.api.method_signature) = "database"; + } + + // Commits a transaction, while optionally updating documents. + rpc Commit(CommitRequest) returns (CommitResponse) { + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:commit" + body: "*" + }; + option (google.api.method_signature) = "database,writes"; + } + + // Rolls back a transaction. + rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:rollback" + body: "*" + }; + option (google.api.method_signature) = "database,transaction"; + } + + // Runs a query. + rpc RunQuery(RunQueryRequest) returns (stream RunQueryResponse) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/databases/*/documents}:runQuery" + body: "*" + additional_bindings { + post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:runQuery" + body: "*" + } + }; + } + + // Partitions a query by returning partition cursors that can be used to run + // the query in parallel. The returned partition cursors are split points that + // can be used by RunQuery as starting/end points for the query results. + rpc PartitionQuery(PartitionQueryRequest) returns (PartitionQueryResponse) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/databases/*/documents}:partitionQuery" + body: "*" + additional_bindings { + post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery" + body: "*" + } + }; + } + + // Streams batches of document updates and deletes, in order. + rpc Write(stream WriteRequest) returns (stream WriteResponse) { + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:write" + body: "*" + }; + } + + // Listens to changes. + rpc Listen(stream ListenRequest) returns (stream ListenResponse) { + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:listen" + body: "*" + }; + } + + // Lists all the collection IDs underneath a document. + rpc ListCollectionIds(ListCollectionIdsRequest) returns (ListCollectionIdsResponse) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds" + body: "*" + additional_bindings { + post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Applies a batch of write operations. + // + // The BatchWrite method does not apply the write operations atomically + // and can apply them out of order. Method does not allow more than one write + // per document. Each write succeeds or fails independently. See the + // [BatchWriteResponse][google.firestore.v1beta1.BatchWriteResponse] for the success status of each write. + // + // If you require an atomically applied set of writes, use + // [Commit][google.firestore.v1beta1.Firestore.Commit] instead. + rpc BatchWrite(BatchWriteRequest) returns (BatchWriteResponse) { + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:batchWrite" + body: "*" + }; + } + + // Creates a new document. + rpc CreateDocument(CreateDocumentRequest) returns (Document) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}" + body: "document" + }; + } +} + +// The request for [Firestore.GetDocument][google.firestore.v1beta1.Firestore.GetDocument]. +message GetDocumentRequest { + // Required. The resource name of the Document to get. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The fields to return. If not set, returns all fields. + // + // If the document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 2; + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads the document in a transaction. + bytes transaction = 3; + + // Reads the version of the document at the given time. + // This may not be older than 270 seconds. + google.protobuf.Timestamp read_time = 5; + } +} + +// The request for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments]. +message ListDocumentsRequest { + // Required. The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The collection ID, relative to `parent`, to list. For example: `chatrooms` + // or `messages`. + string collection_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of documents to return. + int32 page_size = 3; + + // The `next_page_token` value returned from a previous List request, if any. + string page_token = 4; + + // The order to sort results by. For example: `priority desc, name`. + string order_by = 6; + + // The fields to return. If not set, returns all fields. + // + // If a document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 7; + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads documents in a transaction. + bytes transaction = 8; + + // Reads documents as they were at the given time. + // This may not be older than 270 seconds. + google.protobuf.Timestamp read_time = 10; + } + + // If the list should show missing documents. A missing document is a + // document that does not exist but has sub-documents. These documents will + // be returned with a key but will not have fields, [Document.create_time][google.firestore.v1beta1.Document.create_time], + // or [Document.update_time][google.firestore.v1beta1.Document.update_time] set. + // + // Requests with `show_missing` may not specify `where` or + // `order_by`. + bool show_missing = 12; +} + +// The response for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments]. +message ListDocumentsResponse { + // The Documents found. + repeated Document documents = 1; + + // The next page token. + string next_page_token = 2; +} + +// The request for [Firestore.CreateDocument][google.firestore.v1beta1.Firestore.CreateDocument]. +message CreateDocumentRequest { + // Required. The parent resource. For example: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`. + string collection_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // The client-assigned document ID to use for this document. + // + // Optional. If not specified, an ID will be assigned by the service. + string document_id = 3; + + // Required. The document to create. `name` must not be set. + Document document = 4 [(google.api.field_behavior) = REQUIRED]; + + // The fields to return. If not set, returns all fields. + // + // If the document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 5; +} + +// The request for [Firestore.UpdateDocument][google.firestore.v1beta1.Firestore.UpdateDocument]. +message UpdateDocumentRequest { + // Required. The updated document. + // Creates the document if it does not already exist. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // The fields to update. + // None of the field paths in the mask may contain a reserved name. + // + // If the document exists on the server and has fields not referenced in the + // mask, they are left unchanged. + // Fields referenced in the mask, but not present in the input document, are + // deleted from the document on the server. + DocumentMask update_mask = 2; + + // The fields to return. If not set, returns all fields. + // + // If the document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 3; + + // An optional precondition on the document. + // The request will fail if this is set and not met by the target document. + Precondition current_document = 4; +} + +// The request for [Firestore.DeleteDocument][google.firestore.v1beta1.Firestore.DeleteDocument]. +message DeleteDocumentRequest { + // Required. The resource name of the Document to delete. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // An optional precondition on the document. + // The request will fail if this is set and not met by the target document. + Precondition current_document = 2; +} + +// The request for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments]. +message BatchGetDocumentsRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The names of the documents to retrieve. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // The request will fail if any of the document is not a child resource of the + // given `database`. Duplicate names will be elided. + repeated string documents = 2; + + // The fields to return. If not set, returns all fields. + // + // If a document has a field that is not present in this mask, that field will + // not be returned in the response. + DocumentMask mask = 3; + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads documents in a transaction. + bytes transaction = 4; + + // Starts a new transaction and reads the documents. + // Defaults to a read-only transaction. + // The new transaction ID will be returned as the first response in the + // stream. + TransactionOptions new_transaction = 5; + + // Reads documents as they were at the given time. + // This may not be older than 270 seconds. + google.protobuf.Timestamp read_time = 7; + } +} + +// The streamed response for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments]. +message BatchGetDocumentsResponse { + // A single result. + // This can be empty if the server is just returning a transaction. + oneof result { + // A document that was requested. + Document found = 1; + + // A document name that was requested but does not exist. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string missing = 2; + } + + // The transaction that was started as part of this request. + // Will only be set in the first response, and only if + // [BatchGetDocumentsRequest.new_transaction][google.firestore.v1beta1.BatchGetDocumentsRequest.new_transaction] was set in the request. + bytes transaction = 3; + + // The time at which the document was read. + // This may be monotically increasing, in this case the previous documents in + // the result stream are guaranteed not to have changed between their + // read_time and this one. + google.protobuf.Timestamp read_time = 4; +} + +// The request for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction]. +message BeginTransactionRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The options for the transaction. + // Defaults to a read-write transaction. + TransactionOptions options = 2; +} + +// The response for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction]. +message BeginTransactionResponse { + // The transaction that was started. + bytes transaction = 1; +} + +// The request for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit]. +message CommitRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The writes to apply. + // + // Always executed atomically and in order. + repeated Write writes = 2; + + // If set, applies all writes in this transaction, and commits it. + bytes transaction = 3; +} + +// The response for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit]. +message CommitResponse { + // The result of applying the writes. + // + // This i-th write result corresponds to the i-th write in the + // request. + repeated WriteResult write_results = 1; + + // The time at which the commit occurred. Any read with an equal or greater + // `read_time` is guaranteed to see the effects of the commit. + google.protobuf.Timestamp commit_time = 2; +} + +// The request for [Firestore.Rollback][google.firestore.v1beta1.Firestore.Rollback]. +message RollbackRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The transaction to roll back. + bytes transaction = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery]. +message RunQueryRequest { + // Required. The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The query to run. + oneof query_type { + // A structured query. + StructuredQuery structured_query = 2; + } + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads documents in a transaction. + bytes transaction = 5; + + // Starts a new transaction and reads the documents. + // Defaults to a read-only transaction. + // The new transaction ID will be returned as the first response in the + // stream. + TransactionOptions new_transaction = 6; + + // Reads documents as they were at the given time. + // This may not be older than 270 seconds. + google.protobuf.Timestamp read_time = 7; + } +} + +// The response for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery]. +message RunQueryResponse { + // The transaction that was started as part of this request. + // Can only be set in the first response, and only if + // [RunQueryRequest.new_transaction][google.firestore.v1beta1.RunQueryRequest.new_transaction] was set in the request. + // If set, no other fields will be set in this response. + bytes transaction = 2; + + // A query result. + // Not set when reporting partial progress. + Document document = 1; + + // The time at which the document was read. This may be monotonically + // increasing; in this case, the previous documents in the result stream are + // guaranteed not to have changed between their `read_time` and this one. + // + // If the query returns no results, a response with `read_time` and no + // `document` will be sent, and this represents the time at which the query + // was run. + google.protobuf.Timestamp read_time = 3; + + // The number of results that have been skipped due to an offset between + // the last response and the current response. + int32 skipped_results = 4; +} + +// The request for [Firestore.PartitionQuery][google.firestore.v1beta1.Firestore.PartitionQuery]. +message PartitionQueryRequest { + // Required. The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents`. + // Document resource names are not supported; only database resource names + // can be specified. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The query to partition. + oneof query_type { + // A structured query. + // Query must specify collection with all descendants and be ordered by name + // ascending. Other filters, order bys, limits, offsets, and start/end + // cursors are not supported. + StructuredQuery structured_query = 2; + } + + // The desired maximum number of partition points. + // The partitions may be returned across multiple pages of results. + // The number must be positive. The actual number of partitions + // returned may be fewer. + // + // For example, this may be set to one fewer than the number of parallel + // queries to be run, or in running a data pipeline job, one fewer than the + // number of workers or compute instances available. + int64 partition_count = 3; + + // The `next_page_token` value returned from a previous call to + // PartitionQuery that may be used to get an additional set of results. + // There are no ordering guarantees between sets of results. Thus, using + // multiple sets of results will require merging the different result sets. + // + // For example, two subsequent calls using a page_token may return: + // + // * cursor B, cursor M, cursor Q + // * cursor A, cursor U, cursor W + // + // To obtain a complete result set ordered with respect to the results of the + // query supplied to PartitionQuery, the results sets should be merged: + // cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + string page_token = 4; + + // The maximum number of partitions to return in this call, subject to + // `partition_count`. + // + // For example, if `partition_count` = 10 and `page_size` = 8, the first call + // to PartitionQuery will return up to 8 partitions and a `next_page_token` + // if more results exist. A second call to PartitionQuery will return up to + // 2 partitions, to complete the total of 10 specified in `partition_count`. + int32 page_size = 5; +} + +// The response for [Firestore.PartitionQuery][google.firestore.v1beta1.Firestore.PartitionQuery]. +message PartitionQueryResponse { + // Partition results. + // Each partition is a split point that can be used by RunQuery as a starting + // or end point for the query results. The RunQuery requests must be made with + // the same query supplied to this PartitionQuery request. The partition + // cursors will be ordered according to same ordering as the results of the + // query supplied to PartitionQuery. + // + // For example, if a PartitionQuery request returns partition cursors A and B, + // running the following three queries will return the entire result set of + // the original query: + // + // * query, end_at A + // * query, start_at A, end_at B + // * query, start_at B + // + // An empty result may indicate that the query has too few results to be + // partitioned. + repeated Cursor partitions = 1; + + // A page token that may be used to request an additional set of results, up + // to the number specified by `partition_count` in the PartitionQuery request. + // If blank, there are no more results. + string next_page_token = 2; +} + +// The request for [Firestore.Write][google.firestore.v1beta1.Firestore.Write]. +// +// The first request creates a stream, or resumes an existing one from a token. +// +// When creating a new stream, the server replies with a response containing +// only an ID and a token, to use in the next request. +// +// When resuming a stream, the server first streams any responses later than the +// given token, then a response containing only an up-to-date token, to use in +// the next request. +message WriteRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + // This is only required in the first message. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The ID of the write stream to resume. + // This may only be set in the first message. When left empty, a new write + // stream will be created. + string stream_id = 2; + + // The writes to apply. + // + // Always executed atomically and in order. + // This must be empty on the first request. + // This may be empty on the last request. + // This must not be empty on all other requests. + repeated Write writes = 3; + + // A stream token that was previously sent by the server. + // + // The client should set this field to the token from the most recent + // [WriteResponse][google.firestore.v1beta1.WriteResponse] it has received. This acknowledges that the client has + // received responses up to this token. After sending this token, earlier + // tokens may not be used anymore. + // + // The server may close the stream if there are too many unacknowledged + // responses. + // + // Leave this field unset when creating a new stream. To resume a stream at + // a specific point, set this field and the `stream_id` field. + // + // Leave this field unset when creating a new stream. + bytes stream_token = 4; + + // Labels associated with this write request. + map labels = 5; +} + +// The response for [Firestore.Write][google.firestore.v1beta1.Firestore.Write]. +message WriteResponse { + // The ID of the stream. + // Only set on the first message, when a new stream was created. + string stream_id = 1; + + // A token that represents the position of this response in the stream. + // This can be used by a client to resume the stream at this point. + // + // This field is always set. + bytes stream_token = 2; + + // The result of applying the writes. + // + // This i-th write result corresponds to the i-th write in the + // request. + repeated WriteResult write_results = 3; + + // The time at which the commit occurred. Any read with an equal or greater + // `read_time` is guaranteed to see the effects of the write. + google.protobuf.Timestamp commit_time = 4; +} + +// A request for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen] +message ListenRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The supported target changes. + oneof target_change { + // A target to add to this stream. + Target add_target = 2; + + // The ID of a target to remove from this stream. + int32 remove_target = 3; + } + + // Labels associated with this target change. + map labels = 4; +} + +// The response for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen]. +message ListenResponse { + // The supported responses. + oneof response_type { + // Targets have changed. + TargetChange target_change = 2; + + // A [Document][google.firestore.v1beta1.Document] has changed. + DocumentChange document_change = 3; + + // A [Document][google.firestore.v1beta1.Document] has been deleted. + DocumentDelete document_delete = 4; + + // A [Document][google.firestore.v1beta1.Document] has been removed from a target (because it is no longer + // relevant to that target). + DocumentRemove document_remove = 6; + + // A filter to apply to the set of documents previously returned for the + // given target. + // + // Returned when documents may have been removed from the given target, but + // the exact documents are unknown. + ExistenceFilter filter = 5; + } +} + +// A specification of a set of documents to listen to. +message Target { + // A target specified by a set of documents names. + message DocumentsTarget { + // The names of the documents to retrieve. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // The request will fail if any of the document is not a child resource of + // the given `database`. Duplicate names will be elided. + repeated string documents = 2; + } + + // A target specified by a query. + message QueryTarget { + // The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1; + + // The query to run. + oneof query_type { + // A structured query. + StructuredQuery structured_query = 2; + } + } + + // The type of target to listen to. + oneof target_type { + // A target specified by a query. + QueryTarget query = 2; + + // A target specified by a set of document names. + DocumentsTarget documents = 3; + } + + // When to start listening. + // + // If not specified, all matching Documents are returned before any + // subsequent changes. + oneof resume_type { + // A resume token from a prior [TargetChange][google.firestore.v1beta1.TargetChange] for an identical target. + // + // Using a resume token with a different target is unsupported and may fail. + bytes resume_token = 4; + + // Start listening after a specific `read_time`. + // + // The client must know the state of matching documents at this time. + google.protobuf.Timestamp read_time = 11; + } + + // The target ID that identifies the target on the stream. Must be a positive + // number and non-zero. + int32 target_id = 5; + + // If the target should be removed once it is current and consistent. + bool once = 6; +} + +// Targets being watched have changed. +message TargetChange { + // The type of change. + enum TargetChangeType { + // No change has occurred. Used only to send an updated `resume_token`. + NO_CHANGE = 0; + + // The targets have been added. + ADD = 1; + + // The targets have been removed. + REMOVE = 2; + + // The targets reflect all changes committed before the targets were added + // to the stream. + // + // This will be sent after or with a `read_time` that is greater than or + // equal to the time at which the targets were added. + // + // Listeners can wait for this change if read-after-write semantics + // are desired. + CURRENT = 3; + + // The targets have been reset, and a new initial state for the targets + // will be returned in subsequent changes. + // + // After the initial state is complete, `CURRENT` will be returned even + // if the target was previously indicated to be `CURRENT`. + RESET = 4; + } + + // The type of change that occurred. + TargetChangeType target_change_type = 1; + + // The target IDs of targets that have changed. + // + // If empty, the change applies to all targets. + // + // The order of the target IDs is not defined. + repeated int32 target_ids = 2; + + // The error that resulted in this change, if applicable. + google.rpc.Status cause = 3; + + // A token that can be used to resume the stream for the given `target_ids`, + // or all targets if `target_ids` is empty. + // + // Not set on every target change. + bytes resume_token = 4; + + // The consistent `read_time` for the given `target_ids` (omitted when the + // target_ids are not at a consistent snapshot). + // + // The stream is guaranteed to send a `read_time` with `target_ids` empty + // whenever the entire stream reaches a new consistent snapshot. ADD, + // CURRENT, and RESET messages are guaranteed to (eventually) result in a + // new consistent snapshot (while NO_CHANGE and REMOVE messages are not). + // + // For a given stream, `read_time` is guaranteed to be monotonically + // increasing. + google.protobuf.Timestamp read_time = 6; +} + +// The request for [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds]. +message ListCollectionIdsRequest { + // Required. The parent document. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of results to return. + int32 page_size = 2; + + // A page token. Must be a value from + // [ListCollectionIdsResponse][google.firestore.v1beta1.ListCollectionIdsResponse]. + string page_token = 3; +} + +// The response from [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds]. +message ListCollectionIdsResponse { + // The collection ids. + repeated string collection_ids = 1; + + // A page token that may be used to continue the list. + string next_page_token = 2; +} + +// The request for [Firestore.BatchWrite][google.firestore.v1beta1.Firestore.BatchWrite]. +message BatchWriteRequest { + // Required. The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // The writes to apply. + // + // Method does not apply writes atomically and does not guarantee ordering. + // Each write succeeds or fails independently. You cannot write to the same + // document more than once per request. + repeated Write writes = 2; + + // Labels associated with this batch write. + map labels = 3; +} + +// The response from [Firestore.BatchWrite][google.firestore.v1beta1.Firestore.BatchWrite]. +message BatchWriteResponse { + // The result of applying the writes. + // + // This i-th write result corresponds to the i-th write in the + // request. + repeated WriteResult write_results = 1; + + // The status of applying the writes. + // + // This i-th write status corresponds to the i-th write in the + // request. + repeated google.rpc.Status status = 2; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/query.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/query.proto new file mode 100644 index 000000000000..f107ab72177a --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/query.proto @@ -0,0 +1,300 @@ +// Copyright 2025 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/firestore/v1beta1/document.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "QueryProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; +option ruby_package = "Google::Cloud::Firestore::V1beta1"; + +// A Firestore query. +message StructuredQuery { + // A selection of a collection, such as `messages as m1`. + message CollectionSelector { + // The collection ID. + // When set, selects only collections with this ID. + string collection_id = 2; + + // When false, selects only collections that are immediate children of + // the `parent` specified in the containing `RunQueryRequest`. + // When true, selects all descendant collections. + bool all_descendants = 3; + } + + // A filter. + message Filter { + // The type of filter. + oneof filter_type { + // A composite filter. + CompositeFilter composite_filter = 1; + + // A filter on a document field. + FieldFilter field_filter = 2; + + // A filter that takes exactly one argument. + UnaryFilter unary_filter = 3; + } + } + + // A filter that merges multiple other filters using the given operator. + message CompositeFilter { + // A composite filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // The results are required to satisfy each of the combined filters. + AND = 1; + } + + // The operator for combining multiple filters. + Operator op = 1; + + // The list of filters to combine. + // Must contain at least one filter. + repeated Filter filters = 2; + } + + // A filter on a specific field. + message FieldFilter { + // A field filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // The given `field` is less than the given `value`. + // + // Requires: + // + // * That `field` come first in `order_by`. + LESS_THAN = 1; + + // The given `field` is less than or equal to the given `value`. + // + // Requires: + // + // * That `field` come first in `order_by`. + LESS_THAN_OR_EQUAL = 2; + + // The given `field` is greater than the given `value`. + // + // Requires: + // + // * That `field` come first in `order_by`. + GREATER_THAN = 3; + + // The given `field` is greater than or equal to the given `value`. + // + // Requires: + // + // * That `field` come first in `order_by`. + GREATER_THAN_OR_EQUAL = 4; + + // The given `field` is equal to the given `value`. + EQUAL = 5; + + // The given `field` is not equal to the given `value`. + // + // Requires: + // + // * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. + // * That `field` comes first in the `order_by`. + NOT_EQUAL = 6; + + // The given `field` is an array that contains the given `value`. + ARRAY_CONTAINS = 7; + + // The given `field` is equal to at least one value in the given array. + // + // Requires: + // + // * That `value` is a non-empty `ArrayValue` with at most 10 values. + // * No other `IN` or `ARRAY_CONTAINS_ANY` or `NOT_IN`. + IN = 8; + + // The given `field` is an array that contains any of the values in the + // given array. + // + // Requires: + // + // * That `value` is a non-empty `ArrayValue` with at most 10 values. + // * No other `IN` or `ARRAY_CONTAINS_ANY` or `NOT_IN`. + ARRAY_CONTAINS_ANY = 9; + + // The value of the `field` is not in the given array. + // + // Requires: + // + // * That `value` is a non-empty `ArrayValue` with at most 10 values. + // * No other `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, + // `IS_NOT_NULL`, or `IS_NOT_NAN`. + // * That `field` comes first in the `order_by`. + NOT_IN = 10; + } + + // The field to filter by. + FieldReference field = 1; + + // The operator to filter by. + Operator op = 2; + + // The value to compare to. + Value value = 3; + } + + // A filter with a single operand. + message UnaryFilter { + // A unary operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // The given `field` is equal to `NaN`. + IS_NAN = 2; + + // The given `field` is equal to `NULL`. + IS_NULL = 3; + + // The given `field` is not equal to `NaN`. + // + // Requires: + // + // * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. + // * That `field` comes first in the `order_by`. + IS_NOT_NAN = 4; + + // The given `field` is not equal to `NULL`. + // + // Requires: + // + // * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. + // * That `field` comes first in the `order_by`. + IS_NOT_NULL = 5; + } + + // The unary operator to apply. + Operator op = 1; + + // The argument to the filter. + oneof operand_type { + // The field to which to apply the operator. + FieldReference field = 2; + } + } + + // A reference to a field, such as `max(messages.time) as max_time`. + message FieldReference { + string field_path = 2; + } + + // An order on a field. + message Order { + // The field to order by. + FieldReference field = 1; + + // The direction to order by. Defaults to `ASCENDING`. + Direction direction = 2; + } + + // The projection of document's fields to return. + message Projection { + // The fields to return. + // + // If empty, all fields are returned. To only return the name + // of the document, use `['__name__']`. + repeated FieldReference fields = 2; + } + + // A sort direction. + enum Direction { + // Unspecified. + DIRECTION_UNSPECIFIED = 0; + + // Ascending. + ASCENDING = 1; + + // Descending. + DESCENDING = 2; + } + + // The projection to return. + Projection select = 1; + + // The collections to query. + repeated CollectionSelector from = 2; + + // The filter to apply. + Filter where = 3; + + // The order to apply to the query results. + // + // Firestore guarantees a stable ordering through the following rules: + // + // * Any field required to appear in `order_by`, that is not already + // specified in `order_by`, is appended to the order in field name order + // by default. + // * If an order on `__name__` is not specified, it is appended by default. + // + // Fields are appended with the same sort direction as the last order + // specified, or 'ASCENDING' if no order was specified. For example: + // + // * `SELECT * FROM Foo ORDER BY A` becomes + // `SELECT * FROM Foo ORDER BY A, __name__` + // * `SELECT * FROM Foo ORDER BY A DESC` becomes + // `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC` + // * `SELECT * FROM Foo WHERE A > 1` becomes + // `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__` + repeated Order order_by = 4; + + // A starting point for the query results. + Cursor start_at = 7; + + // A end point for the query results. + Cursor end_at = 8; + + // The number of results to skip. + // + // Applies before limit, but after all other constraints. Must be >= 0 if + // specified. + int32 offset = 6; + + // The maximum number of results to return. + // + // Applies after all other constraints. + // Must be >= 0 if specified. + google.protobuf.Int32Value limit = 5; +} + +// A position in a query result set. +message Cursor { + // The values that represent a position, in the order they appear in + // the order by clause of a query. + // + // Can contain fewer values than specified in the order by clause. + repeated Value values = 1; + + // If the position is just before or just after the given values, relative + // to the sort order defined by the query. + bool before = 2; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/undeliverable_first_gen_event.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/undeliverable_first_gen_event.proto new file mode 100644 index 000000000000..0f7841eb9d64 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/undeliverable_first_gen_event.proto @@ -0,0 +1,75 @@ +// Copyright 2025 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "UndeliverableFirstGenEventProto"; +option java_package = "com.google.firestore.v1beta1"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; +option ruby_package = "Google::Cloud::Firestore::V1beta1"; + +// A message signifying an event that cannot be delivered to Cloud Functions +// from Firestore using [Cloud Firestore triggers 1st +// gen](https://cloud.google.com/functions/docs/calling/cloud-firestore) +message UndeliverableFirstGenEvent { + // Reason for events being undeliverable. + enum Reason { + // Unspecified. + REASON_UNSPECIFIED = 0; + + // Exceeding maximum event size limit + EXCEEDING_SIZE_LIMIT = 1; + } + + // Document change type. + enum DocumentChangeType { + // Unspecified. + DOCUMENT_CHANGE_TYPE_UNSPECIFIED = 0; + + // Represent creation operation. + CREATE = 1; + + // Represent delete operation. + DELETE = 2; + + // Represent update operation. + UPDATE = 3; + } + + // Error message for events being undeliverable. + string message = 1; + + // Reason for events being undeliverable. + Reason reason = 2; + + // The resource name of the changed document, in the format of + // `projects/{projectId}/databases/{databaseId}/documents/{document_path}`. + string document_name = 3; + + // The type of the document change. + DocumentChangeType document_change_type = 4; + + // The names of the functions that were supposed to be triggered. + repeated string function_name = 5; + + // The commit time of triggered write operation. + google.protobuf.Timestamp triggered_time = 6; +} diff --git a/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/write.proto b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/write.proto new file mode 100644 index 000000000000..2fbe127ebe89 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/google/firestore/v1beta1/write.proto @@ -0,0 +1,258 @@ +// Copyright 2025 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/firestore/v1beta1/common.proto"; +import "google/firestore/v1beta1/document.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb"; +option java_multiple_files = true; +option java_outer_classname = "WriteProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; +option ruby_package = "Google::Cloud::Firestore::V1beta1"; + +// A write on a document. +message Write { + // The operation to execute. + oneof operation { + // A document to write. + Document update = 1; + + // A document name to delete. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string delete = 2; + + // Applies a transformation to a document. + DocumentTransform transform = 6; + } + + // The fields to update in this write. + // + // This field can be set only when the operation is `update`. + // If the mask is not set for an `update` and the document exists, any + // existing data will be overwritten. + // If the mask is set and the document on the server has fields not covered by + // the mask, they are left unchanged. + // Fields referenced in the mask, but not present in the input document, are + // deleted from the document on the server. + // The field paths in this mask must not contain a reserved field name. + DocumentMask update_mask = 3; + + // The transforms to perform after update. + // + // This field can be set only when the operation is `update`. If present, this + // write is equivalent to performing `update` and `transform` to the same + // document atomically and in order. + repeated DocumentTransform.FieldTransform update_transforms = 7; + + // An optional precondition on the document. + // + // The write will fail if this is set and not met by the target document. + Precondition current_document = 4; +} + +// A transformation of a document. +message DocumentTransform { + // A transformation of a field of the document. + message FieldTransform { + // A value that is calculated by the server. + enum ServerValue { + // Unspecified. This value must not be used. + SERVER_VALUE_UNSPECIFIED = 0; + + // The time at which the server processed the request, with millisecond + // precision. If used on multiple fields (same or different documents) in + // a transaction, all the fields will get the same server timestamp. + REQUEST_TIME = 1; + } + + // The path of the field. See [Document.fields][google.firestore.v1beta1.Document.fields] for the field path syntax + // reference. + string field_path = 1; + + // The transformation to apply on the field. + oneof transform_type { + // Sets the field to the given server value. + ServerValue set_to_server_value = 2; + + // Adds the given value to the field's current value. + // + // This must be an integer or a double value. + // If the field is not an integer or double, or if the field does not yet + // exist, the transformation will set the field to the given value. + // If either of the given value or the current field value are doubles, + // both values will be interpreted as doubles. Double arithmetic and + // representation of double values follow IEEE 754 semantics. + // If there is positive/negative integer overflow, the field is resolved + // to the largest magnitude positive/negative integer. + Value increment = 3; + + // Sets the field to the maximum of its current value and the given value. + // + // This must be an integer or a double value. + // If the field is not an integer or double, or if the field does not yet + // exist, the transformation will set the field to the given value. + // If a maximum operation is applied where the field and the input value + // are of mixed types (that is - one is an integer and one is a double) + // the field takes on the type of the larger operand. If the operands are + // equivalent (e.g. 3 and 3.0), the field does not change. + // 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and + // zero input value is always the stored value. + // The maximum of any numeric value x and NaN is NaN. + Value maximum = 4; + + // Sets the field to the minimum of its current value and the given value. + // + // This must be an integer or a double value. + // If the field is not an integer or double, or if the field does not yet + // exist, the transformation will set the field to the input value. + // If a minimum operation is applied where the field and the input value + // are of mixed types (that is - one is an integer and one is a double) + // the field takes on the type of the smaller operand. If the operands are + // equivalent (e.g. 3 and 3.0), the field does not change. + // 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and + // zero input value is always the stored value. + // The minimum of any numeric value x and NaN is NaN. + Value minimum = 5; + + // Append the given elements in order if they are not already present in + // the current field value. + // If the field is not an array, or if the field does not yet exist, it is + // first set to the empty array. + // + // Equivalent numbers of different types (e.g. 3L and 3.0) are + // considered equal when checking if a value is missing. + // NaN is equal to NaN, and Null is equal to Null. + // If the input contains multiple equivalent values, only the first will + // be considered. + // + // The corresponding transform_result will be the null value. + ArrayValue append_missing_elements = 6; + + // Remove all of the given elements from the array in the field. + // If the field is not an array, or if the field does not yet exist, it is + // set to the empty array. + // + // Equivalent numbers of the different types (e.g. 3L and 3.0) are + // considered equal when deciding whether an element should be removed. + // NaN is equal to NaN, and Null is equal to Null. + // This will remove all equivalent values if there are duplicates. + // + // The corresponding transform_result will be the null value. + ArrayValue remove_all_from_array = 7; + } + } + + // The name of the document to transform. + string document = 1; + + // The list of transformations to apply to the fields of the document, in + // order. + // This must not be empty. + repeated FieldTransform field_transforms = 2; +} + +// The result of applying a write. +message WriteResult { + // The last update time of the document after applying the write. Not set + // after a `delete`. + // + // If the write did not actually change the document, this will be the + // previous update_time. + google.protobuf.Timestamp update_time = 1; + + // The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1beta1.DocumentTransform.FieldTransform], in the + // same order. + repeated Value transform_results = 2; +} + +// A [Document][google.firestore.v1beta1.Document] has changed. +// +// May be the result of multiple [writes][google.firestore.v1beta1.Write], including deletes, that +// ultimately resulted in a new value for the [Document][google.firestore.v1beta1.Document]. +// +// Multiple [DocumentChange][google.firestore.v1beta1.DocumentChange] messages may be returned for the same logical +// change, if multiple targets are affected. +message DocumentChange { + // The new state of the [Document][google.firestore.v1beta1.Document]. + // + // If `mask` is set, contains only fields that were updated or added. + Document document = 1; + + // A set of target IDs of targets that match this document. + repeated int32 target_ids = 5; + + // A set of target IDs for targets that no longer match this document. + repeated int32 removed_target_ids = 6; +} + +// A [Document][google.firestore.v1beta1.Document] has been deleted. +// +// May be the result of multiple [writes][google.firestore.v1beta1.Write], including updates, the +// last of which deleted the [Document][google.firestore.v1beta1.Document]. +// +// Multiple [DocumentDelete][google.firestore.v1beta1.DocumentDelete] messages may be returned for the same logical +// delete, if multiple targets are affected. +message DocumentDelete { + // The resource name of the [Document][google.firestore.v1beta1.Document] that was deleted. + string document = 1; + + // A set of target IDs for targets that previously matched this entity. + repeated int32 removed_target_ids = 6; + + // The read timestamp at which the delete was observed. + // + // Greater or equal to the `commit_time` of the delete. + google.protobuf.Timestamp read_time = 4; +} + +// A [Document][google.firestore.v1beta1.Document] has been removed from the view of the targets. +// +// Sent if the document is no longer relevant to a target and is out of view. +// Can be sent instead of a DocumentDelete or a DocumentChange if the server +// can not send the new value of the document. +// +// Multiple [DocumentRemove][google.firestore.v1beta1.DocumentRemove] messages may be returned for the same logical +// write or delete, if multiple targets are affected. +message DocumentRemove { + // The resource name of the [Document][google.firestore.v1beta1.Document] that has gone out of view. + string document = 1; + + // A set of target IDs for targets that previously matched this document. + repeated int32 removed_target_ids = 2; + + // The read timestamp at which the remove was observed. + // + // Greater or equal to the `commit_time` of the change/delete/remove. + google.protobuf.Timestamp read_time = 4; +} + +// A digest of all the documents that match a given target. +message ExistenceFilter { + // The target ID to which this filter applies. + int32 target_id = 1; + + // The total count of documents that match [target_id][google.firestore.v1beta1.ExistenceFilter.target_id]. + // + // If different from the count of documents in the client that match, the + // client must manually determine which documents no longer match the target. + int32 count = 2; +} diff --git a/packages/google-cloud-firestore-api/protos/protos.d.ts b/packages/google-cloud-firestore-api/protos/protos.d.ts new file mode 100644 index 000000000000..794aabf24f73 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/protos.d.ts @@ -0,0 +1,35648 @@ +// Copyright 2026 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 type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); +/** Namespace google. */ +export namespace google { + + /** Namespace firestore. */ + namespace firestore { + + /** Namespace admin. */ + namespace admin { + + /** Namespace v1. */ + namespace v1 { + + /** Properties of a Backup. */ + interface IBackup { + + /** Backup name */ + name?: (string|null); + + /** Backup database */ + database?: (string|null); + + /** Backup databaseUid */ + databaseUid?: (string|null); + + /** Backup snapshotTime */ + snapshotTime?: (google.protobuf.ITimestamp|null); + + /** Backup expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); + + /** Backup stats */ + stats?: (google.firestore.admin.v1.Backup.IStats|null); + + /** Backup state */ + state?: (google.firestore.admin.v1.Backup.State|keyof typeof google.firestore.admin.v1.Backup.State|null); + } + + /** Represents a Backup. */ + class Backup implements IBackup { + + /** + * Constructs a new Backup. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IBackup); + + /** Backup name. */ + public name: string; + + /** Backup database. */ + public database: string; + + /** Backup databaseUid. */ + public databaseUid: string; + + /** Backup snapshotTime. */ + public snapshotTime?: (google.protobuf.ITimestamp|null); + + /** Backup expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); + + /** Backup stats. */ + public stats?: (google.firestore.admin.v1.Backup.IStats|null); + + /** Backup state. */ + public state: (google.firestore.admin.v1.Backup.State|keyof typeof google.firestore.admin.v1.Backup.State); + + /** + * Creates a new Backup instance using the specified properties. + * @param [properties] Properties to set + * @returns Backup instance + */ + public static create(properties?: google.firestore.admin.v1.IBackup): google.firestore.admin.v1.Backup; + + /** + * Encodes the specified Backup message. Does not implicitly {@link google.firestore.admin.v1.Backup.verify|verify} messages. + * @param message Backup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Backup.verify|verify} messages. + * @param message Backup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Backup message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Backup; + + /** + * Decodes a Backup message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Backup; + + /** + * Verifies a Backup message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Backup message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Backup + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Backup; + + /** + * Creates a plain object from a Backup message. Also converts values to other types if specified. + * @param message Backup + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Backup, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Backup to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Backup + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Backup { + + /** Properties of a Stats. */ + interface IStats { + + /** Stats sizeBytes */ + sizeBytes?: (number|Long|string|null); + + /** Stats documentCount */ + documentCount?: (number|Long|string|null); + + /** Stats indexCount */ + indexCount?: (number|Long|string|null); + } + + /** Represents a Stats. */ + class Stats implements IStats { + + /** + * Constructs a new Stats. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Backup.IStats); + + /** Stats sizeBytes. */ + public sizeBytes: (number|Long|string); + + /** Stats documentCount. */ + public documentCount: (number|Long|string); + + /** Stats indexCount. */ + public indexCount: (number|Long|string); + + /** + * Creates a new Stats instance using the specified properties. + * @param [properties] Properties to set + * @returns Stats instance + */ + public static create(properties?: google.firestore.admin.v1.Backup.IStats): google.firestore.admin.v1.Backup.Stats; + + /** + * Encodes the specified Stats message. Does not implicitly {@link google.firestore.admin.v1.Backup.Stats.verify|verify} messages. + * @param message Stats message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Backup.IStats, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Stats message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Backup.Stats.verify|verify} messages. + * @param message Stats message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Backup.IStats, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Stats message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Stats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Backup.Stats; + + /** + * Decodes a Stats message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Stats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Backup.Stats; + + /** + * Verifies a Stats message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Stats message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Stats + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Backup.Stats; + + /** + * Creates a plain object from a Stats message. Also converts values to other types if specified. + * @param message Stats + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Backup.Stats, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Stats to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Stats + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + READY = 2, + NOT_AVAILABLE = 3 + } + } + + /** Properties of a Database. */ + interface IDatabase { + + /** Database name */ + name?: (string|null); + + /** Database uid */ + uid?: (string|null); + + /** Database createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Database updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Database deleteTime */ + deleteTime?: (google.protobuf.ITimestamp|null); + + /** Database locationId */ + locationId?: (string|null); + + /** Database type */ + type?: (google.firestore.admin.v1.Database.DatabaseType|keyof typeof google.firestore.admin.v1.Database.DatabaseType|null); + + /** Database concurrencyMode */ + concurrencyMode?: (google.firestore.admin.v1.Database.ConcurrencyMode|keyof typeof google.firestore.admin.v1.Database.ConcurrencyMode|null); + + /** Database versionRetentionPeriod */ + versionRetentionPeriod?: (google.protobuf.IDuration|null); + + /** Database earliestVersionTime */ + earliestVersionTime?: (google.protobuf.ITimestamp|null); + + /** Database pointInTimeRecoveryEnablement */ + pointInTimeRecoveryEnablement?: (google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement|keyof typeof google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement|null); + + /** Database appEngineIntegrationMode */ + appEngineIntegrationMode?: (google.firestore.admin.v1.Database.AppEngineIntegrationMode|keyof typeof google.firestore.admin.v1.Database.AppEngineIntegrationMode|null); + + /** Database keyPrefix */ + keyPrefix?: (string|null); + + /** Database deleteProtectionState */ + deleteProtectionState?: (google.firestore.admin.v1.Database.DeleteProtectionState|keyof typeof google.firestore.admin.v1.Database.DeleteProtectionState|null); + + /** Database cmekConfig */ + cmekConfig?: (google.firestore.admin.v1.Database.ICmekConfig|null); + + /** Database previousId */ + previousId?: (string|null); + + /** Database sourceInfo */ + sourceInfo?: (google.firestore.admin.v1.Database.ISourceInfo|null); + + /** Database tags */ + tags?: ({ [k: string]: string }|null); + + /** Database freeTier */ + freeTier?: (boolean|null); + + /** Database etag */ + etag?: (string|null); + + /** Database databaseEdition */ + databaseEdition?: (google.firestore.admin.v1.Database.DatabaseEdition|keyof typeof google.firestore.admin.v1.Database.DatabaseEdition|null); + + /** Database realtimeUpdatesMode */ + realtimeUpdatesMode?: (google.firestore.admin.v1.RealtimeUpdatesMode|keyof typeof google.firestore.admin.v1.RealtimeUpdatesMode|null); + + /** Database firestoreDataAccessMode */ + firestoreDataAccessMode?: (google.firestore.admin.v1.Database.DataAccessMode|keyof typeof google.firestore.admin.v1.Database.DataAccessMode|null); + + /** Database mongodbCompatibleDataAccessMode */ + mongodbCompatibleDataAccessMode?: (google.firestore.admin.v1.Database.DataAccessMode|keyof typeof google.firestore.admin.v1.Database.DataAccessMode|null); + } + + /** Represents a Database. */ + class Database implements IDatabase { + + /** + * Constructs a new Database. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IDatabase); + + /** Database name. */ + public name: string; + + /** Database uid. */ + public uid: string; + + /** Database createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Database updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Database deleteTime. */ + public deleteTime?: (google.protobuf.ITimestamp|null); + + /** Database locationId. */ + public locationId: string; + + /** Database type. */ + public type: (google.firestore.admin.v1.Database.DatabaseType|keyof typeof google.firestore.admin.v1.Database.DatabaseType); + + /** Database concurrencyMode. */ + public concurrencyMode: (google.firestore.admin.v1.Database.ConcurrencyMode|keyof typeof google.firestore.admin.v1.Database.ConcurrencyMode); + + /** Database versionRetentionPeriod. */ + public versionRetentionPeriod?: (google.protobuf.IDuration|null); + + /** Database earliestVersionTime. */ + public earliestVersionTime?: (google.protobuf.ITimestamp|null); + + /** Database pointInTimeRecoveryEnablement. */ + public pointInTimeRecoveryEnablement: (google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement|keyof typeof google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement); + + /** Database appEngineIntegrationMode. */ + public appEngineIntegrationMode: (google.firestore.admin.v1.Database.AppEngineIntegrationMode|keyof typeof google.firestore.admin.v1.Database.AppEngineIntegrationMode); + + /** Database keyPrefix. */ + public keyPrefix: string; + + /** Database deleteProtectionState. */ + public deleteProtectionState: (google.firestore.admin.v1.Database.DeleteProtectionState|keyof typeof google.firestore.admin.v1.Database.DeleteProtectionState); + + /** Database cmekConfig. */ + public cmekConfig?: (google.firestore.admin.v1.Database.ICmekConfig|null); + + /** Database previousId. */ + public previousId: string; + + /** Database sourceInfo. */ + public sourceInfo?: (google.firestore.admin.v1.Database.ISourceInfo|null); + + /** Database tags. */ + public tags: { [k: string]: string }; + + /** Database freeTier. */ + public freeTier?: (boolean|null); + + /** Database etag. */ + public etag: string; + + /** Database databaseEdition. */ + public databaseEdition: (google.firestore.admin.v1.Database.DatabaseEdition|keyof typeof google.firestore.admin.v1.Database.DatabaseEdition); + + /** Database realtimeUpdatesMode. */ + public realtimeUpdatesMode: (google.firestore.admin.v1.RealtimeUpdatesMode|keyof typeof google.firestore.admin.v1.RealtimeUpdatesMode); + + /** Database firestoreDataAccessMode. */ + public firestoreDataAccessMode: (google.firestore.admin.v1.Database.DataAccessMode|keyof typeof google.firestore.admin.v1.Database.DataAccessMode); + + /** Database mongodbCompatibleDataAccessMode. */ + public mongodbCompatibleDataAccessMode: (google.firestore.admin.v1.Database.DataAccessMode|keyof typeof google.firestore.admin.v1.Database.DataAccessMode); + + /** + * Creates a new Database instance using the specified properties. + * @param [properties] Properties to set + * @returns Database instance + */ + public static create(properties?: google.firestore.admin.v1.IDatabase): google.firestore.admin.v1.Database; + + /** + * Encodes the specified Database message. Does not implicitly {@link google.firestore.admin.v1.Database.verify|verify} messages. + * @param message Database message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Database message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.verify|verify} messages. + * @param message Database message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Database message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Database; + + /** + * Decodes a Database message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Database; + + /** + * Verifies a Database message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Database message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Database + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Database; + + /** + * Creates a plain object from a Database message. Also converts values to other types if specified. + * @param message Database + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Database, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Database to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Database + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Database { + + /** DatabaseType enum. */ + enum DatabaseType { + DATABASE_TYPE_UNSPECIFIED = 0, + FIRESTORE_NATIVE = 1, + DATASTORE_MODE = 2 + } + + /** ConcurrencyMode enum. */ + enum ConcurrencyMode { + CONCURRENCY_MODE_UNSPECIFIED = 0, + OPTIMISTIC = 1, + PESSIMISTIC = 2, + OPTIMISTIC_WITH_ENTITY_GROUPS = 3 + } + + /** PointInTimeRecoveryEnablement enum. */ + enum PointInTimeRecoveryEnablement { + POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED = 0, + POINT_IN_TIME_RECOVERY_ENABLED = 1, + POINT_IN_TIME_RECOVERY_DISABLED = 2 + } + + /** AppEngineIntegrationMode enum. */ + enum AppEngineIntegrationMode { + APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED = 0, + ENABLED = 1, + DISABLED = 2 + } + + /** DeleteProtectionState enum. */ + enum DeleteProtectionState { + DELETE_PROTECTION_STATE_UNSPECIFIED = 0, + DELETE_PROTECTION_DISABLED = 1, + DELETE_PROTECTION_ENABLED = 2 + } + + /** Properties of a CmekConfig. */ + interface ICmekConfig { + + /** CmekConfig kmsKeyName */ + kmsKeyName?: (string|null); + + /** CmekConfig activeKeyVersion */ + activeKeyVersion?: (string[]|null); + } + + /** Represents a CmekConfig. */ + class CmekConfig implements ICmekConfig { + + /** + * Constructs a new CmekConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Database.ICmekConfig); + + /** CmekConfig kmsKeyName. */ + public kmsKeyName: string; + + /** CmekConfig activeKeyVersion. */ + public activeKeyVersion: string[]; + + /** + * Creates a new CmekConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns CmekConfig instance + */ + public static create(properties?: google.firestore.admin.v1.Database.ICmekConfig): google.firestore.admin.v1.Database.CmekConfig; + + /** + * Encodes the specified CmekConfig message. Does not implicitly {@link google.firestore.admin.v1.Database.CmekConfig.verify|verify} messages. + * @param message CmekConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Database.ICmekConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CmekConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.CmekConfig.verify|verify} messages. + * @param message CmekConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Database.ICmekConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CmekConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CmekConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Database.CmekConfig; + + /** + * Decodes a CmekConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CmekConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Database.CmekConfig; + + /** + * Verifies a CmekConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CmekConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CmekConfig + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Database.CmekConfig; + + /** + * Creates a plain object from a CmekConfig message. Also converts values to other types if specified. + * @param message CmekConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Database.CmekConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CmekConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CmekConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SourceInfo. */ + interface ISourceInfo { + + /** SourceInfo backup */ + backup?: (google.firestore.admin.v1.Database.SourceInfo.IBackupSource|null); + + /** SourceInfo operation */ + operation?: (string|null); + } + + /** Represents a SourceInfo. */ + class SourceInfo implements ISourceInfo { + + /** + * Constructs a new SourceInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Database.ISourceInfo); + + /** SourceInfo backup. */ + public backup?: (google.firestore.admin.v1.Database.SourceInfo.IBackupSource|null); + + /** SourceInfo operation. */ + public operation: string; + + /** SourceInfo source. */ + public source?: "backup"; + + /** + * Creates a new SourceInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceInfo instance + */ + public static create(properties?: google.firestore.admin.v1.Database.ISourceInfo): google.firestore.admin.v1.Database.SourceInfo; + + /** + * Encodes the specified SourceInfo message. Does not implicitly {@link google.firestore.admin.v1.Database.SourceInfo.verify|verify} messages. + * @param message SourceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Database.ISourceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceInfo message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.SourceInfo.verify|verify} messages. + * @param message SourceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Database.ISourceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Database.SourceInfo; + + /** + * Decodes a SourceInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Database.SourceInfo; + + /** + * Verifies a SourceInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceInfo + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Database.SourceInfo; + + /** + * Creates a plain object from a SourceInfo message. Also converts values to other types if specified. + * @param message SourceInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Database.SourceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SourceInfo { + + /** Properties of a BackupSource. */ + interface IBackupSource { + + /** BackupSource backup */ + backup?: (string|null); + } + + /** Represents a BackupSource. */ + class BackupSource implements IBackupSource { + + /** + * Constructs a new BackupSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Database.SourceInfo.IBackupSource); + + /** BackupSource backup. */ + public backup: string; + + /** + * Creates a new BackupSource instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupSource instance + */ + public static create(properties?: google.firestore.admin.v1.Database.SourceInfo.IBackupSource): google.firestore.admin.v1.Database.SourceInfo.BackupSource; + + /** + * Encodes the specified BackupSource message. Does not implicitly {@link google.firestore.admin.v1.Database.SourceInfo.BackupSource.verify|verify} messages. + * @param message BackupSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Database.SourceInfo.IBackupSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupSource message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.SourceInfo.BackupSource.verify|verify} messages. + * @param message BackupSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Database.SourceInfo.IBackupSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Database.SourceInfo.BackupSource; + + /** + * Decodes a BackupSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Database.SourceInfo.BackupSource; + + /** + * Verifies a BackupSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupSource + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Database.SourceInfo.BackupSource; + + /** + * Creates a plain object from a BackupSource message. Also converts values to other types if specified. + * @param message BackupSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Database.SourceInfo.BackupSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an EncryptionConfig. */ + interface IEncryptionConfig { + + /** EncryptionConfig googleDefaultEncryption */ + googleDefaultEncryption?: (google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions|null); + + /** EncryptionConfig useSourceEncryption */ + useSourceEncryption?: (google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions|null); + + /** EncryptionConfig customerManagedEncryption */ + customerManagedEncryption?: (google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions|null); + } + + /** Represents an EncryptionConfig. */ + class EncryptionConfig implements IEncryptionConfig { + + /** + * Constructs a new EncryptionConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Database.IEncryptionConfig); + + /** EncryptionConfig googleDefaultEncryption. */ + public googleDefaultEncryption?: (google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions|null); + + /** EncryptionConfig useSourceEncryption. */ + public useSourceEncryption?: (google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions|null); + + /** EncryptionConfig customerManagedEncryption. */ + public customerManagedEncryption?: (google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions|null); + + /** EncryptionConfig encryptionType. */ + public encryptionType?: ("googleDefaultEncryption"|"useSourceEncryption"|"customerManagedEncryption"); + + /** + * Creates a new EncryptionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns EncryptionConfig instance + */ + public static create(properties?: google.firestore.admin.v1.Database.IEncryptionConfig): google.firestore.admin.v1.Database.EncryptionConfig; + + /** + * Encodes the specified EncryptionConfig message. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.verify|verify} messages. + * @param message EncryptionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Database.IEncryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EncryptionConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.verify|verify} messages. + * @param message EncryptionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Database.IEncryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EncryptionConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EncryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Database.EncryptionConfig; + + /** + * Decodes an EncryptionConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EncryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Database.EncryptionConfig; + + /** + * Verifies an EncryptionConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EncryptionConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EncryptionConfig + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Database.EncryptionConfig; + + /** + * Creates a plain object from an EncryptionConfig message. Also converts values to other types if specified. + * @param message EncryptionConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Database.EncryptionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EncryptionConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EncryptionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EncryptionConfig { + + /** Properties of a GoogleDefaultEncryptionOptions. */ + interface IGoogleDefaultEncryptionOptions { + } + + /** Represents a GoogleDefaultEncryptionOptions. */ + class GoogleDefaultEncryptionOptions implements IGoogleDefaultEncryptionOptions { + + /** + * Constructs a new GoogleDefaultEncryptionOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions); + + /** + * Creates a new GoogleDefaultEncryptionOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns GoogleDefaultEncryptionOptions instance + */ + public static create(properties?: google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions): google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions; + + /** + * Encodes the specified GoogleDefaultEncryptionOptions message. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions.verify|verify} messages. + * @param message GoogleDefaultEncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GoogleDefaultEncryptionOptions message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions.verify|verify} messages. + * @param message GoogleDefaultEncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GoogleDefaultEncryptionOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GoogleDefaultEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions; + + /** + * Decodes a GoogleDefaultEncryptionOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GoogleDefaultEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions; + + /** + * Verifies a GoogleDefaultEncryptionOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GoogleDefaultEncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GoogleDefaultEncryptionOptions + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions; + + /** + * Creates a plain object from a GoogleDefaultEncryptionOptions message. Also converts values to other types if specified. + * @param message GoogleDefaultEncryptionOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GoogleDefaultEncryptionOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GoogleDefaultEncryptionOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SourceEncryptionOptions. */ + interface ISourceEncryptionOptions { + } + + /** Represents a SourceEncryptionOptions. */ + class SourceEncryptionOptions implements ISourceEncryptionOptions { + + /** + * Constructs a new SourceEncryptionOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions); + + /** + * Creates a new SourceEncryptionOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceEncryptionOptions instance + */ + public static create(properties?: google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions): google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions; + + /** + * Encodes the specified SourceEncryptionOptions message. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions.verify|verify} messages. + * @param message SourceEncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceEncryptionOptions message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions.verify|verify} messages. + * @param message SourceEncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceEncryptionOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions; + + /** + * Decodes a SourceEncryptionOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions; + + /** + * Verifies a SourceEncryptionOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceEncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceEncryptionOptions + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions; + + /** + * Creates a plain object from a SourceEncryptionOptions message. Also converts values to other types if specified. + * @param message SourceEncryptionOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceEncryptionOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceEncryptionOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CustomerManagedEncryptionOptions. */ + interface ICustomerManagedEncryptionOptions { + + /** CustomerManagedEncryptionOptions kmsKeyName */ + kmsKeyName?: (string|null); + } + + /** Represents a CustomerManagedEncryptionOptions. */ + class CustomerManagedEncryptionOptions implements ICustomerManagedEncryptionOptions { + + /** + * Constructs a new CustomerManagedEncryptionOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions); + + /** CustomerManagedEncryptionOptions kmsKeyName. */ + public kmsKeyName: string; + + /** + * Creates a new CustomerManagedEncryptionOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomerManagedEncryptionOptions instance + */ + public static create(properties?: google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions): google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions; + + /** + * Encodes the specified CustomerManagedEncryptionOptions message. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions.verify|verify} messages. + * @param message CustomerManagedEncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomerManagedEncryptionOptions message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions.verify|verify} messages. + * @param message CustomerManagedEncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomerManagedEncryptionOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomerManagedEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions; + + /** + * Decodes a CustomerManagedEncryptionOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomerManagedEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions; + + /** + * Verifies a CustomerManagedEncryptionOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomerManagedEncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomerManagedEncryptionOptions + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions; + + /** + * Creates a plain object from a CustomerManagedEncryptionOptions message. Also converts values to other types if specified. + * @param message CustomerManagedEncryptionOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomerManagedEncryptionOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomerManagedEncryptionOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** DatabaseEdition enum. */ + enum DatabaseEdition { + DATABASE_EDITION_UNSPECIFIED = 0, + STANDARD = 1, + ENTERPRISE = 2 + } + + /** DataAccessMode enum. */ + enum DataAccessMode { + DATA_ACCESS_MODE_UNSPECIFIED = 0, + DATA_ACCESS_MODE_ENABLED = 1, + DATA_ACCESS_MODE_DISABLED = 2 + } + } + + /** RealtimeUpdatesMode enum. */ + enum RealtimeUpdatesMode { + REALTIME_UPDATES_MODE_UNSPECIFIED = 0, + REALTIME_UPDATES_MODE_ENABLED = 1, + REALTIME_UPDATES_MODE_DISABLED = 2 + } + + /** Properties of a Field. */ + interface IField { + + /** Field name */ + name?: (string|null); + + /** Field indexConfig */ + indexConfig?: (google.firestore.admin.v1.Field.IIndexConfig|null); + + /** Field ttlConfig */ + ttlConfig?: (google.firestore.admin.v1.Field.ITtlConfig|null); + } + + /** Represents a Field. */ + class Field implements IField { + + /** + * Constructs a new Field. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IField); + + /** Field name. */ + public name: string; + + /** Field indexConfig. */ + public indexConfig?: (google.firestore.admin.v1.Field.IIndexConfig|null); + + /** Field ttlConfig. */ + public ttlConfig?: (google.firestore.admin.v1.Field.ITtlConfig|null); + + /** + * Creates a new Field instance using the specified properties. + * @param [properties] Properties to set + * @returns Field instance + */ + public static create(properties?: google.firestore.admin.v1.IField): google.firestore.admin.v1.Field; + + /** + * Encodes the specified Field message. Does not implicitly {@link google.firestore.admin.v1.Field.verify|verify} messages. + * @param message Field message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Field message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Field.verify|verify} messages. + * @param message Field message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Field message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Field + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Field; + + /** + * Decodes a Field message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Field + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Field; + + /** + * Verifies a Field message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Field message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Field + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Field; + + /** + * Creates a plain object from a Field message. Also converts values to other types if specified. + * @param message Field + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Field, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Field to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Field + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Field { + + /** Properties of an IndexConfig. */ + interface IIndexConfig { + + /** IndexConfig indexes */ + indexes?: (google.firestore.admin.v1.IIndex[]|null); + + /** IndexConfig usesAncestorConfig */ + usesAncestorConfig?: (boolean|null); + + /** IndexConfig ancestorField */ + ancestorField?: (string|null); + + /** IndexConfig reverting */ + reverting?: (boolean|null); + } + + /** Represents an IndexConfig. */ + class IndexConfig implements IIndexConfig { + + /** + * Constructs a new IndexConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Field.IIndexConfig); + + /** IndexConfig indexes. */ + public indexes: google.firestore.admin.v1.IIndex[]; + + /** IndexConfig usesAncestorConfig. */ + public usesAncestorConfig: boolean; + + /** IndexConfig ancestorField. */ + public ancestorField: string; + + /** IndexConfig reverting. */ + public reverting: boolean; + + /** + * Creates a new IndexConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns IndexConfig instance + */ + public static create(properties?: google.firestore.admin.v1.Field.IIndexConfig): google.firestore.admin.v1.Field.IndexConfig; + + /** + * Encodes the specified IndexConfig message. Does not implicitly {@link google.firestore.admin.v1.Field.IndexConfig.verify|verify} messages. + * @param message IndexConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Field.IIndexConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IndexConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Field.IndexConfig.verify|verify} messages. + * @param message IndexConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Field.IIndexConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IndexConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IndexConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Field.IndexConfig; + + /** + * Decodes an IndexConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IndexConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Field.IndexConfig; + + /** + * Verifies an IndexConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IndexConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IndexConfig + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Field.IndexConfig; + + /** + * Creates a plain object from an IndexConfig message. Also converts values to other types if specified. + * @param message IndexConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Field.IndexConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IndexConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IndexConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TtlConfig. */ + interface ITtlConfig { + + /** TtlConfig state */ + state?: (google.firestore.admin.v1.Field.TtlConfig.State|keyof typeof google.firestore.admin.v1.Field.TtlConfig.State|null); + + /** TtlConfig expirationOffset */ + expirationOffset?: (google.protobuf.IDuration|null); + } + + /** Represents a TtlConfig. */ + class TtlConfig implements ITtlConfig { + + /** + * Constructs a new TtlConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Field.ITtlConfig); + + /** TtlConfig state. */ + public state: (google.firestore.admin.v1.Field.TtlConfig.State|keyof typeof google.firestore.admin.v1.Field.TtlConfig.State); + + /** TtlConfig expirationOffset. */ + public expirationOffset?: (google.protobuf.IDuration|null); + + /** + * Creates a new TtlConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns TtlConfig instance + */ + public static create(properties?: google.firestore.admin.v1.Field.ITtlConfig): google.firestore.admin.v1.Field.TtlConfig; + + /** + * Encodes the specified TtlConfig message. Does not implicitly {@link google.firestore.admin.v1.Field.TtlConfig.verify|verify} messages. + * @param message TtlConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Field.ITtlConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TtlConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Field.TtlConfig.verify|verify} messages. + * @param message TtlConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Field.ITtlConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TtlConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TtlConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Field.TtlConfig; + + /** + * Decodes a TtlConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TtlConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Field.TtlConfig; + + /** + * Verifies a TtlConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TtlConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TtlConfig + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Field.TtlConfig; + + /** + * Creates a plain object from a TtlConfig message. Also converts values to other types if specified. + * @param message TtlConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Field.TtlConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TtlConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TtlConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TtlConfig { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + ACTIVE = 2, + NEEDS_REPAIR = 3 + } + } + } + + /** Properties of an Index. */ + interface IIndex { + + /** Index name */ + name?: (string|null); + + /** Index queryScope */ + queryScope?: (google.firestore.admin.v1.Index.QueryScope|keyof typeof google.firestore.admin.v1.Index.QueryScope|null); + + /** Index apiScope */ + apiScope?: (google.firestore.admin.v1.Index.ApiScope|keyof typeof google.firestore.admin.v1.Index.ApiScope|null); + + /** Index fields */ + fields?: (google.firestore.admin.v1.Index.IIndexField[]|null); + + /** Index state */ + state?: (google.firestore.admin.v1.Index.State|keyof typeof google.firestore.admin.v1.Index.State|null); + + /** Index density */ + density?: (google.firestore.admin.v1.Index.Density|keyof typeof google.firestore.admin.v1.Index.Density|null); + + /** Index multikey */ + multikey?: (boolean|null); + + /** Index shardCount */ + shardCount?: (number|null); + + /** Index unique */ + unique?: (boolean|null); + + /** Index searchIndexOptions */ + searchIndexOptions?: (google.firestore.admin.v1.Index.ISearchIndexOptions|null); + } + + /** Represents an Index. */ + class Index implements IIndex { + + /** + * Constructs a new Index. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IIndex); + + /** Index name. */ + public name: string; + + /** Index queryScope. */ + public queryScope: (google.firestore.admin.v1.Index.QueryScope|keyof typeof google.firestore.admin.v1.Index.QueryScope); + + /** Index apiScope. */ + public apiScope: (google.firestore.admin.v1.Index.ApiScope|keyof typeof google.firestore.admin.v1.Index.ApiScope); + + /** Index fields. */ + public fields: google.firestore.admin.v1.Index.IIndexField[]; + + /** Index state. */ + public state: (google.firestore.admin.v1.Index.State|keyof typeof google.firestore.admin.v1.Index.State); + + /** Index density. */ + public density: (google.firestore.admin.v1.Index.Density|keyof typeof google.firestore.admin.v1.Index.Density); + + /** Index multikey. */ + public multikey: boolean; + + /** Index shardCount. */ + public shardCount: number; + + /** Index unique. */ + public unique: boolean; + + /** Index searchIndexOptions. */ + public searchIndexOptions?: (google.firestore.admin.v1.Index.ISearchIndexOptions|null); + + /** + * Creates a new Index instance using the specified properties. + * @param [properties] Properties to set + * @returns Index instance + */ + public static create(properties?: google.firestore.admin.v1.IIndex): google.firestore.admin.v1.Index; + + /** + * Encodes the specified Index message. Does not implicitly {@link google.firestore.admin.v1.Index.verify|verify} messages. + * @param message Index message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IIndex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Index message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.verify|verify} messages. + * @param message Index message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IIndex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Index message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Index + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Index; + + /** + * Decodes an Index message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Index + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Index; + + /** + * Verifies an Index message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Index message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Index + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Index; + + /** + * Creates a plain object from an Index message. Also converts values to other types if specified. + * @param message Index + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Index, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Index to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Index + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Index { + + /** QueryScope enum. */ + enum QueryScope { + QUERY_SCOPE_UNSPECIFIED = 0, + COLLECTION = 1, + COLLECTION_GROUP = 2, + COLLECTION_RECURSIVE = 3 + } + + /** ApiScope enum. */ + enum ApiScope { + ANY_API = 0, + DATASTORE_MODE_API = 1, + MONGODB_COMPATIBLE_API = 2 + } + + /** Properties of an IndexField. */ + interface IIndexField { + + /** IndexField fieldPath */ + fieldPath?: (string|null); + + /** IndexField order */ + order?: (google.firestore.admin.v1.Index.IndexField.Order|keyof typeof google.firestore.admin.v1.Index.IndexField.Order|null); + + /** IndexField arrayConfig */ + arrayConfig?: (google.firestore.admin.v1.Index.IndexField.ArrayConfig|keyof typeof google.firestore.admin.v1.Index.IndexField.ArrayConfig|null); + + /** IndexField vectorConfig */ + vectorConfig?: (google.firestore.admin.v1.Index.IndexField.IVectorConfig|null); + + /** IndexField searchConfig */ + searchConfig?: (google.firestore.admin.v1.Index.IndexField.ISearchConfig|null); + } + + /** Represents an IndexField. */ + class IndexField implements IIndexField { + + /** + * Constructs a new IndexField. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Index.IIndexField); + + /** IndexField fieldPath. */ + public fieldPath: string; + + /** IndexField order. */ + public order?: (google.firestore.admin.v1.Index.IndexField.Order|keyof typeof google.firestore.admin.v1.Index.IndexField.Order|null); + + /** IndexField arrayConfig. */ + public arrayConfig?: (google.firestore.admin.v1.Index.IndexField.ArrayConfig|keyof typeof google.firestore.admin.v1.Index.IndexField.ArrayConfig|null); + + /** IndexField vectorConfig. */ + public vectorConfig?: (google.firestore.admin.v1.Index.IndexField.IVectorConfig|null); + + /** IndexField searchConfig. */ + public searchConfig?: (google.firestore.admin.v1.Index.IndexField.ISearchConfig|null); + + /** IndexField valueMode. */ + public valueMode?: ("order"|"arrayConfig"|"vectorConfig"|"searchConfig"); + + /** + * Creates a new IndexField instance using the specified properties. + * @param [properties] Properties to set + * @returns IndexField instance + */ + public static create(properties?: google.firestore.admin.v1.Index.IIndexField): google.firestore.admin.v1.Index.IndexField; + + /** + * Encodes the specified IndexField message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.verify|verify} messages. + * @param message IndexField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Index.IIndexField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IndexField message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.verify|verify} messages. + * @param message IndexField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Index.IIndexField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IndexField message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IndexField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Index.IndexField; + + /** + * Decodes an IndexField message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IndexField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Index.IndexField; + + /** + * Verifies an IndexField message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IndexField message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IndexField + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Index.IndexField; + + /** + * Creates a plain object from an IndexField message. Also converts values to other types if specified. + * @param message IndexField + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Index.IndexField, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IndexField to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IndexField + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace IndexField { + + /** Order enum. */ + enum Order { + ORDER_UNSPECIFIED = 0, + ASCENDING = 1, + DESCENDING = 2 + } + + /** ArrayConfig enum. */ + enum ArrayConfig { + ARRAY_CONFIG_UNSPECIFIED = 0, + CONTAINS = 1 + } + + /** Properties of a VectorConfig. */ + interface IVectorConfig { + + /** VectorConfig dimension */ + dimension?: (number|null); + + /** VectorConfig flat */ + flat?: (google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex|null); + } + + /** Represents a VectorConfig. */ + class VectorConfig implements IVectorConfig { + + /** + * Constructs a new VectorConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Index.IndexField.IVectorConfig); + + /** VectorConfig dimension. */ + public dimension: number; + + /** VectorConfig flat. */ + public flat?: (google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex|null); + + /** VectorConfig type. */ + public type?: "flat"; + + /** + * Creates a new VectorConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns VectorConfig instance + */ + public static create(properties?: google.firestore.admin.v1.Index.IndexField.IVectorConfig): google.firestore.admin.v1.Index.IndexField.VectorConfig; + + /** + * Encodes the specified VectorConfig message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.VectorConfig.verify|verify} messages. + * @param message VectorConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Index.IndexField.IVectorConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VectorConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.VectorConfig.verify|verify} messages. + * @param message VectorConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Index.IndexField.IVectorConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VectorConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VectorConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Index.IndexField.VectorConfig; + + /** + * Decodes a VectorConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VectorConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Index.IndexField.VectorConfig; + + /** + * Verifies a VectorConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VectorConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VectorConfig + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Index.IndexField.VectorConfig; + + /** + * Creates a plain object from a VectorConfig message. Also converts values to other types if specified. + * @param message VectorConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Index.IndexField.VectorConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VectorConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VectorConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VectorConfig { + + /** Properties of a FlatIndex. */ + interface IFlatIndex { + } + + /** Represents a FlatIndex. */ + class FlatIndex implements IFlatIndex { + + /** + * Constructs a new FlatIndex. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex); + + /** + * Creates a new FlatIndex instance using the specified properties. + * @param [properties] Properties to set + * @returns FlatIndex instance + */ + public static create(properties?: google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex): google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex; + + /** + * Encodes the specified FlatIndex message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex.verify|verify} messages. + * @param message FlatIndex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FlatIndex message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex.verify|verify} messages. + * @param message FlatIndex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FlatIndex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FlatIndex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex; + + /** + * Decodes a FlatIndex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FlatIndex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex; + + /** + * Verifies a FlatIndex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FlatIndex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FlatIndex + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex; + + /** + * Creates a plain object from a FlatIndex message. Also converts values to other types if specified. + * @param message FlatIndex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FlatIndex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FlatIndex + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SearchConfig. */ + interface ISearchConfig { + + /** SearchConfig textSpec */ + textSpec?: (google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec|null); + + /** SearchConfig geoSpec */ + geoSpec?: (google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec|null); + } + + /** Represents a SearchConfig. */ + class SearchConfig implements ISearchConfig { + + /** + * Constructs a new SearchConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Index.IndexField.ISearchConfig); + + /** SearchConfig textSpec. */ + public textSpec?: (google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec|null); + + /** SearchConfig geoSpec. */ + public geoSpec?: (google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec|null); + + /** + * Creates a new SearchConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchConfig instance + */ + public static create(properties?: google.firestore.admin.v1.Index.IndexField.ISearchConfig): google.firestore.admin.v1.Index.IndexField.SearchConfig; + + /** + * Encodes the specified SearchConfig message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.verify|verify} messages. + * @param message SearchConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Index.IndexField.ISearchConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.verify|verify} messages. + * @param message SearchConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Index.IndexField.ISearchConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Index.IndexField.SearchConfig; + + /** + * Decodes a SearchConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Index.IndexField.SearchConfig; + + /** + * Verifies a SearchConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchConfig + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Index.IndexField.SearchConfig; + + /** + * Creates a plain object from a SearchConfig message. Also converts values to other types if specified. + * @param message SearchConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Index.IndexField.SearchConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SearchConfig { + + /** TextIndexType enum. */ + enum TextIndexType { + TEXT_INDEX_TYPE_UNSPECIFIED = 0, + TOKENIZED = 1 + } + + /** TextMatchType enum. */ + enum TextMatchType { + TEXT_MATCH_TYPE_UNSPECIFIED = 0, + MATCH_GLOBALLY = 1 + } + + /** Properties of a SearchTextIndexSpec. */ + interface ISearchTextIndexSpec { + + /** SearchTextIndexSpec indexType */ + indexType?: (google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType|keyof typeof google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType|null); + + /** SearchTextIndexSpec matchType */ + matchType?: (google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType|keyof typeof google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType|null); + } + + /** Represents a SearchTextIndexSpec. */ + class SearchTextIndexSpec implements ISearchTextIndexSpec { + + /** + * Constructs a new SearchTextIndexSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec); + + /** SearchTextIndexSpec indexType. */ + public indexType: (google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType|keyof typeof google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType); + + /** SearchTextIndexSpec matchType. */ + public matchType: (google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType|keyof typeof google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType); + + /** + * Creates a new SearchTextIndexSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchTextIndexSpec instance + */ + public static create(properties?: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec; + + /** + * Encodes the specified SearchTextIndexSpec message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec.verify|verify} messages. + * @param message SearchTextIndexSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchTextIndexSpec message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec.verify|verify} messages. + * @param message SearchTextIndexSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchTextIndexSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchTextIndexSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec; + + /** + * Decodes a SearchTextIndexSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchTextIndexSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec; + + /** + * Verifies a SearchTextIndexSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchTextIndexSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchTextIndexSpec + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec; + + /** + * Creates a plain object from a SearchTextIndexSpec message. Also converts values to other types if specified. + * @param message SearchTextIndexSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchTextIndexSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchTextIndexSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchTextSpec. */ + interface ISearchTextSpec { + + /** SearchTextSpec indexSpecs */ + indexSpecs?: (google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec[]|null); + } + + /** Represents a SearchTextSpec. */ + class SearchTextSpec implements ISearchTextSpec { + + /** + * Constructs a new SearchTextSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec); + + /** SearchTextSpec indexSpecs. */ + public indexSpecs: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec[]; + + /** + * Creates a new SearchTextSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchTextSpec instance + */ + public static create(properties?: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec; + + /** + * Encodes the specified SearchTextSpec message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.verify|verify} messages. + * @param message SearchTextSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchTextSpec message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.verify|verify} messages. + * @param message SearchTextSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchTextSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchTextSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec; + + /** + * Decodes a SearchTextSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchTextSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec; + + /** + * Verifies a SearchTextSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchTextSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchTextSpec + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec; + + /** + * Creates a plain object from a SearchTextSpec message. Also converts values to other types if specified. + * @param message SearchTextSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchTextSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchTextSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchGeoSpec. */ + interface ISearchGeoSpec { + + /** SearchGeoSpec geoJsonIndexingDisabled */ + geoJsonIndexingDisabled?: (boolean|null); + } + + /** Represents a SearchGeoSpec. */ + class SearchGeoSpec implements ISearchGeoSpec { + + /** + * Constructs a new SearchGeoSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec); + + /** SearchGeoSpec geoJsonIndexingDisabled. */ + public geoJsonIndexingDisabled: boolean; + + /** + * Creates a new SearchGeoSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchGeoSpec instance + */ + public static create(properties?: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec; + + /** + * Encodes the specified SearchGeoSpec message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec.verify|verify} messages. + * @param message SearchGeoSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchGeoSpec message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec.verify|verify} messages. + * @param message SearchGeoSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchGeoSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchGeoSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec; + + /** + * Decodes a SearchGeoSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchGeoSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec; + + /** + * Verifies a SearchGeoSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchGeoSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchGeoSpec + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec; + + /** + * Creates a plain object from a SearchGeoSpec message. Also converts values to other types if specified. + * @param message SearchGeoSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchGeoSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchGeoSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + READY = 2, + NEEDS_REPAIR = 3 + } + + /** Density enum. */ + enum Density { + DENSITY_UNSPECIFIED = 0, + SPARSE_ALL = 1, + SPARSE_ANY = 2, + DENSE = 3 + } + + /** Properties of a SearchIndexOptions. */ + interface ISearchIndexOptions { + + /** SearchIndexOptions textLanguage */ + textLanguage?: (string|null); + + /** SearchIndexOptions textLanguageOverrideFieldPath */ + textLanguageOverrideFieldPath?: (string|null); + } + + /** Represents a SearchIndexOptions. */ + class SearchIndexOptions implements ISearchIndexOptions { + + /** + * Constructs a new SearchIndexOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.Index.ISearchIndexOptions); + + /** SearchIndexOptions textLanguage. */ + public textLanguage: string; + + /** SearchIndexOptions textLanguageOverrideFieldPath. */ + public textLanguageOverrideFieldPath: string; + + /** + * Creates a new SearchIndexOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchIndexOptions instance + */ + public static create(properties?: google.firestore.admin.v1.Index.ISearchIndexOptions): google.firestore.admin.v1.Index.SearchIndexOptions; + + /** + * Encodes the specified SearchIndexOptions message. Does not implicitly {@link google.firestore.admin.v1.Index.SearchIndexOptions.verify|verify} messages. + * @param message SearchIndexOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.Index.ISearchIndexOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchIndexOptions message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.SearchIndexOptions.verify|verify} messages. + * @param message SearchIndexOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.Index.ISearchIndexOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchIndexOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchIndexOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Index.SearchIndexOptions; + + /** + * Decodes a SearchIndexOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchIndexOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Index.SearchIndexOptions; + + /** + * Verifies a SearchIndexOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchIndexOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchIndexOptions + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Index.SearchIndexOptions; + + /** + * Creates a plain object from a SearchIndexOptions message. Also converts values to other types if specified. + * @param message SearchIndexOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Index.SearchIndexOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchIndexOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchIndexOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Represents a FirestoreAdmin */ + class FirestoreAdmin extends $protobuf.rpc.Service { + + /** + * Constructs a new FirestoreAdmin service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new FirestoreAdmin service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): FirestoreAdmin; + + /** + * Calls CreateIndex. + * @param request CreateIndexRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createIndex(request: google.firestore.admin.v1.ICreateIndexRequest, callback: google.firestore.admin.v1.FirestoreAdmin.CreateIndexCallback): void; + + /** + * Calls CreateIndex. + * @param request CreateIndexRequest message or plain object + * @returns Promise + */ + public createIndex(request: google.firestore.admin.v1.ICreateIndexRequest): Promise; + + /** + * Calls ListIndexes. + * @param request ListIndexesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListIndexesResponse + */ + public listIndexes(request: google.firestore.admin.v1.IListIndexesRequest, callback: google.firestore.admin.v1.FirestoreAdmin.ListIndexesCallback): void; + + /** + * Calls ListIndexes. + * @param request ListIndexesRequest message or plain object + * @returns Promise + */ + public listIndexes(request: google.firestore.admin.v1.IListIndexesRequest): Promise; + + /** + * Calls GetIndex. + * @param request GetIndexRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Index + */ + public getIndex(request: google.firestore.admin.v1.IGetIndexRequest, callback: google.firestore.admin.v1.FirestoreAdmin.GetIndexCallback): void; + + /** + * Calls GetIndex. + * @param request GetIndexRequest message or plain object + * @returns Promise + */ + public getIndex(request: google.firestore.admin.v1.IGetIndexRequest): Promise; + + /** + * Calls DeleteIndex. + * @param request DeleteIndexRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteIndex(request: google.firestore.admin.v1.IDeleteIndexRequest, callback: google.firestore.admin.v1.FirestoreAdmin.DeleteIndexCallback): void; + + /** + * Calls DeleteIndex. + * @param request DeleteIndexRequest message or plain object + * @returns Promise + */ + public deleteIndex(request: google.firestore.admin.v1.IDeleteIndexRequest): Promise; + + /** + * Calls GetField. + * @param request GetFieldRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Field + */ + public getField(request: google.firestore.admin.v1.IGetFieldRequest, callback: google.firestore.admin.v1.FirestoreAdmin.GetFieldCallback): void; + + /** + * Calls GetField. + * @param request GetFieldRequest message or plain object + * @returns Promise + */ + public getField(request: google.firestore.admin.v1.IGetFieldRequest): Promise; + + /** + * Calls UpdateField. + * @param request UpdateFieldRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateField(request: google.firestore.admin.v1.IUpdateFieldRequest, callback: google.firestore.admin.v1.FirestoreAdmin.UpdateFieldCallback): void; + + /** + * Calls UpdateField. + * @param request UpdateFieldRequest message or plain object + * @returns Promise + */ + public updateField(request: google.firestore.admin.v1.IUpdateFieldRequest): Promise; + + /** + * Calls ListFields. + * @param request ListFieldsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListFieldsResponse + */ + public listFields(request: google.firestore.admin.v1.IListFieldsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.ListFieldsCallback): void; + + /** + * Calls ListFields. + * @param request ListFieldsRequest message or plain object + * @returns Promise + */ + public listFields(request: google.firestore.admin.v1.IListFieldsRequest): Promise; + + /** + * Calls ExportDocuments. + * @param request ExportDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public exportDocuments(request: google.firestore.admin.v1.IExportDocumentsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.ExportDocumentsCallback): void; + + /** + * Calls ExportDocuments. + * @param request ExportDocumentsRequest message or plain object + * @returns Promise + */ + public exportDocuments(request: google.firestore.admin.v1.IExportDocumentsRequest): Promise; + + /** + * Calls ImportDocuments. + * @param request ImportDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importDocuments(request: google.firestore.admin.v1.IImportDocumentsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.ImportDocumentsCallback): void; + + /** + * Calls ImportDocuments. + * @param request ImportDocumentsRequest message or plain object + * @returns Promise + */ + public importDocuments(request: google.firestore.admin.v1.IImportDocumentsRequest): Promise; + + /** + * Calls BulkDeleteDocuments. + * @param request BulkDeleteDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public bulkDeleteDocuments(request: google.firestore.admin.v1.IBulkDeleteDocumentsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocumentsCallback): void; + + /** + * Calls BulkDeleteDocuments. + * @param request BulkDeleteDocumentsRequest message or plain object + * @returns Promise + */ + public bulkDeleteDocuments(request: google.firestore.admin.v1.IBulkDeleteDocumentsRequest): Promise; + + /** + * Calls CreateDatabase. + * @param request CreateDatabaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createDatabase(request: google.firestore.admin.v1.ICreateDatabaseRequest, callback: google.firestore.admin.v1.FirestoreAdmin.CreateDatabaseCallback): void; + + /** + * Calls CreateDatabase. + * @param request CreateDatabaseRequest message or plain object + * @returns Promise + */ + public createDatabase(request: google.firestore.admin.v1.ICreateDatabaseRequest): Promise; + + /** + * Calls GetDatabase. + * @param request GetDatabaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Database + */ + public getDatabase(request: google.firestore.admin.v1.IGetDatabaseRequest, callback: google.firestore.admin.v1.FirestoreAdmin.GetDatabaseCallback): void; + + /** + * Calls GetDatabase. + * @param request GetDatabaseRequest message or plain object + * @returns Promise + */ + public getDatabase(request: google.firestore.admin.v1.IGetDatabaseRequest): Promise; + + /** + * Calls ListDatabases. + * @param request ListDatabasesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListDatabasesResponse + */ + public listDatabases(request: google.firestore.admin.v1.IListDatabasesRequest, callback: google.firestore.admin.v1.FirestoreAdmin.ListDatabasesCallback): void; + + /** + * Calls ListDatabases. + * @param request ListDatabasesRequest message or plain object + * @returns Promise + */ + public listDatabases(request: google.firestore.admin.v1.IListDatabasesRequest): Promise; + + /** + * Calls UpdateDatabase. + * @param request UpdateDatabaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateDatabase(request: google.firestore.admin.v1.IUpdateDatabaseRequest, callback: google.firestore.admin.v1.FirestoreAdmin.UpdateDatabaseCallback): void; + + /** + * Calls UpdateDatabase. + * @param request UpdateDatabaseRequest message or plain object + * @returns Promise + */ + public updateDatabase(request: google.firestore.admin.v1.IUpdateDatabaseRequest): Promise; + + /** + * Calls DeleteDatabase. + * @param request DeleteDatabaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteDatabase(request: google.firestore.admin.v1.IDeleteDatabaseRequest, callback: google.firestore.admin.v1.FirestoreAdmin.DeleteDatabaseCallback): void; + + /** + * Calls DeleteDatabase. + * @param request DeleteDatabaseRequest message or plain object + * @returns Promise + */ + public deleteDatabase(request: google.firestore.admin.v1.IDeleteDatabaseRequest): Promise; + + /** + * Calls CreateUserCreds. + * @param request CreateUserCredsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserCreds + */ + public createUserCreds(request: google.firestore.admin.v1.ICreateUserCredsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.CreateUserCredsCallback): void; + + /** + * Calls CreateUserCreds. + * @param request CreateUserCredsRequest message or plain object + * @returns Promise + */ + public createUserCreds(request: google.firestore.admin.v1.ICreateUserCredsRequest): Promise; + + /** + * Calls GetUserCreds. + * @param request GetUserCredsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserCreds + */ + public getUserCreds(request: google.firestore.admin.v1.IGetUserCredsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.GetUserCredsCallback): void; + + /** + * Calls GetUserCreds. + * @param request GetUserCredsRequest message or plain object + * @returns Promise + */ + public getUserCreds(request: google.firestore.admin.v1.IGetUserCredsRequest): Promise; + + /** + * Calls ListUserCreds. + * @param request ListUserCredsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListUserCredsResponse + */ + public listUserCreds(request: google.firestore.admin.v1.IListUserCredsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.ListUserCredsCallback): void; + + /** + * Calls ListUserCreds. + * @param request ListUserCredsRequest message or plain object + * @returns Promise + */ + public listUserCreds(request: google.firestore.admin.v1.IListUserCredsRequest): Promise; + + /** + * Calls EnableUserCreds. + * @param request EnableUserCredsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserCreds + */ + public enableUserCreds(request: google.firestore.admin.v1.IEnableUserCredsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.EnableUserCredsCallback): void; + + /** + * Calls EnableUserCreds. + * @param request EnableUserCredsRequest message or plain object + * @returns Promise + */ + public enableUserCreds(request: google.firestore.admin.v1.IEnableUserCredsRequest): Promise; + + /** + * Calls DisableUserCreds. + * @param request DisableUserCredsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserCreds + */ + public disableUserCreds(request: google.firestore.admin.v1.IDisableUserCredsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.DisableUserCredsCallback): void; + + /** + * Calls DisableUserCreds. + * @param request DisableUserCredsRequest message or plain object + * @returns Promise + */ + public disableUserCreds(request: google.firestore.admin.v1.IDisableUserCredsRequest): Promise; + + /** + * Calls ResetUserPassword. + * @param request ResetUserPasswordRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserCreds + */ + public resetUserPassword(request: google.firestore.admin.v1.IResetUserPasswordRequest, callback: google.firestore.admin.v1.FirestoreAdmin.ResetUserPasswordCallback): void; + + /** + * Calls ResetUserPassword. + * @param request ResetUserPasswordRequest message or plain object + * @returns Promise + */ + public resetUserPassword(request: google.firestore.admin.v1.IResetUserPasswordRequest): Promise; + + /** + * Calls DeleteUserCreds. + * @param request DeleteUserCredsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteUserCreds(request: google.firestore.admin.v1.IDeleteUserCredsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.DeleteUserCredsCallback): void; + + /** + * Calls DeleteUserCreds. + * @param request DeleteUserCredsRequest message or plain object + * @returns Promise + */ + public deleteUserCreds(request: google.firestore.admin.v1.IDeleteUserCredsRequest): Promise; + + /** + * Calls GetBackup. + * @param request GetBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Backup + */ + public getBackup(request: google.firestore.admin.v1.IGetBackupRequest, callback: google.firestore.admin.v1.FirestoreAdmin.GetBackupCallback): void; + + /** + * Calls GetBackup. + * @param request GetBackupRequest message or plain object + * @returns Promise + */ + public getBackup(request: google.firestore.admin.v1.IGetBackupRequest): Promise; + + /** + * Calls ListBackups. + * @param request ListBackupsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListBackupsResponse + */ + public listBackups(request: google.firestore.admin.v1.IListBackupsRequest, callback: google.firestore.admin.v1.FirestoreAdmin.ListBackupsCallback): void; + + /** + * Calls ListBackups. + * @param request ListBackupsRequest message or plain object + * @returns Promise + */ + public listBackups(request: google.firestore.admin.v1.IListBackupsRequest): Promise; + + /** + * Calls DeleteBackup. + * @param request DeleteBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteBackup(request: google.firestore.admin.v1.IDeleteBackupRequest, callback: google.firestore.admin.v1.FirestoreAdmin.DeleteBackupCallback): void; + + /** + * Calls DeleteBackup. + * @param request DeleteBackupRequest message or plain object + * @returns Promise + */ + public deleteBackup(request: google.firestore.admin.v1.IDeleteBackupRequest): Promise; + + /** + * Calls RestoreDatabase. + * @param request RestoreDatabaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public restoreDatabase(request: google.firestore.admin.v1.IRestoreDatabaseRequest, callback: google.firestore.admin.v1.FirestoreAdmin.RestoreDatabaseCallback): void; + + /** + * Calls RestoreDatabase. + * @param request RestoreDatabaseRequest message or plain object + * @returns Promise + */ + public restoreDatabase(request: google.firestore.admin.v1.IRestoreDatabaseRequest): Promise; + + /** + * Calls CreateBackupSchedule. + * @param request CreateBackupScheduleRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupSchedule + */ + public createBackupSchedule(request: google.firestore.admin.v1.ICreateBackupScheduleRequest, callback: google.firestore.admin.v1.FirestoreAdmin.CreateBackupScheduleCallback): void; + + /** + * Calls CreateBackupSchedule. + * @param request CreateBackupScheduleRequest message or plain object + * @returns Promise + */ + public createBackupSchedule(request: google.firestore.admin.v1.ICreateBackupScheduleRequest): Promise; + + /** + * Calls GetBackupSchedule. + * @param request GetBackupScheduleRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupSchedule + */ + public getBackupSchedule(request: google.firestore.admin.v1.IGetBackupScheduleRequest, callback: google.firestore.admin.v1.FirestoreAdmin.GetBackupScheduleCallback): void; + + /** + * Calls GetBackupSchedule. + * @param request GetBackupScheduleRequest message or plain object + * @returns Promise + */ + public getBackupSchedule(request: google.firestore.admin.v1.IGetBackupScheduleRequest): Promise; + + /** + * Calls ListBackupSchedules. + * @param request ListBackupSchedulesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListBackupSchedulesResponse + */ + public listBackupSchedules(request: google.firestore.admin.v1.IListBackupSchedulesRequest, callback: google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedulesCallback): void; + + /** + * Calls ListBackupSchedules. + * @param request ListBackupSchedulesRequest message or plain object + * @returns Promise + */ + public listBackupSchedules(request: google.firestore.admin.v1.IListBackupSchedulesRequest): Promise; + + /** + * Calls UpdateBackupSchedule. + * @param request UpdateBackupScheduleRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupSchedule + */ + public updateBackupSchedule(request: google.firestore.admin.v1.IUpdateBackupScheduleRequest, callback: google.firestore.admin.v1.FirestoreAdmin.UpdateBackupScheduleCallback): void; + + /** + * Calls UpdateBackupSchedule. + * @param request UpdateBackupScheduleRequest message or plain object + * @returns Promise + */ + public updateBackupSchedule(request: google.firestore.admin.v1.IUpdateBackupScheduleRequest): Promise; + + /** + * Calls DeleteBackupSchedule. + * @param request DeleteBackupScheduleRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteBackupSchedule(request: google.firestore.admin.v1.IDeleteBackupScheduleRequest, callback: google.firestore.admin.v1.FirestoreAdmin.DeleteBackupScheduleCallback): void; + + /** + * Calls DeleteBackupSchedule. + * @param request DeleteBackupScheduleRequest message or plain object + * @returns Promise + */ + public deleteBackupSchedule(request: google.firestore.admin.v1.IDeleteBackupScheduleRequest): Promise; + + /** + * Calls CloneDatabase. + * @param request CloneDatabaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public cloneDatabase(request: google.firestore.admin.v1.ICloneDatabaseRequest, callback: google.firestore.admin.v1.FirestoreAdmin.CloneDatabaseCallback): void; + + /** + * Calls CloneDatabase. + * @param request CloneDatabaseRequest message or plain object + * @returns Promise + */ + public cloneDatabase(request: google.firestore.admin.v1.ICloneDatabaseRequest): Promise; + } + + namespace FirestoreAdmin { + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|createIndex}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateIndexCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listIndexes}. + * @param error Error, if any + * @param [response] ListIndexesResponse + */ + type ListIndexesCallback = (error: (Error|null), response?: google.firestore.admin.v1.ListIndexesResponse) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getIndex}. + * @param error Error, if any + * @param [response] Index + */ + type GetIndexCallback = (error: (Error|null), response?: google.firestore.admin.v1.Index) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteIndex}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteIndexCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getField}. + * @param error Error, if any + * @param [response] Field + */ + type GetFieldCallback = (error: (Error|null), response?: google.firestore.admin.v1.Field) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|updateField}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateFieldCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listFields}. + * @param error Error, if any + * @param [response] ListFieldsResponse + */ + type ListFieldsCallback = (error: (Error|null), response?: google.firestore.admin.v1.ListFieldsResponse) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|exportDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|importDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|bulkDeleteDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type BulkDeleteDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|createDatabase}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateDatabaseCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getDatabase}. + * @param error Error, if any + * @param [response] Database + */ + type GetDatabaseCallback = (error: (Error|null), response?: google.firestore.admin.v1.Database) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listDatabases}. + * @param error Error, if any + * @param [response] ListDatabasesResponse + */ + type ListDatabasesCallback = (error: (Error|null), response?: google.firestore.admin.v1.ListDatabasesResponse) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|updateDatabase}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateDatabaseCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteDatabase}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteDatabaseCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|createUserCreds}. + * @param error Error, if any + * @param [response] UserCreds + */ + type CreateUserCredsCallback = (error: (Error|null), response?: google.firestore.admin.v1.UserCreds) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getUserCreds}. + * @param error Error, if any + * @param [response] UserCreds + */ + type GetUserCredsCallback = (error: (Error|null), response?: google.firestore.admin.v1.UserCreds) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listUserCreds}. + * @param error Error, if any + * @param [response] ListUserCredsResponse + */ + type ListUserCredsCallback = (error: (Error|null), response?: google.firestore.admin.v1.ListUserCredsResponse) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|enableUserCreds}. + * @param error Error, if any + * @param [response] UserCreds + */ + type EnableUserCredsCallback = (error: (Error|null), response?: google.firestore.admin.v1.UserCreds) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|disableUserCreds}. + * @param error Error, if any + * @param [response] UserCreds + */ + type DisableUserCredsCallback = (error: (Error|null), response?: google.firestore.admin.v1.UserCreds) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|resetUserPassword}. + * @param error Error, if any + * @param [response] UserCreds + */ + type ResetUserPasswordCallback = (error: (Error|null), response?: google.firestore.admin.v1.UserCreds) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteUserCreds}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteUserCredsCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getBackup}. + * @param error Error, if any + * @param [response] Backup + */ + type GetBackupCallback = (error: (Error|null), response?: google.firestore.admin.v1.Backup) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listBackups}. + * @param error Error, if any + * @param [response] ListBackupsResponse + */ + type ListBackupsCallback = (error: (Error|null), response?: google.firestore.admin.v1.ListBackupsResponse) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteBackup}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteBackupCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|restoreDatabase}. + * @param error Error, if any + * @param [response] Operation + */ + type RestoreDatabaseCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|createBackupSchedule}. + * @param error Error, if any + * @param [response] BackupSchedule + */ + type CreateBackupScheduleCallback = (error: (Error|null), response?: google.firestore.admin.v1.BackupSchedule) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getBackupSchedule}. + * @param error Error, if any + * @param [response] BackupSchedule + */ + type GetBackupScheduleCallback = (error: (Error|null), response?: google.firestore.admin.v1.BackupSchedule) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listBackupSchedules}. + * @param error Error, if any + * @param [response] ListBackupSchedulesResponse + */ + type ListBackupSchedulesCallback = (error: (Error|null), response?: google.firestore.admin.v1.ListBackupSchedulesResponse) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|updateBackupSchedule}. + * @param error Error, if any + * @param [response] BackupSchedule + */ + type UpdateBackupScheduleCallback = (error: (Error|null), response?: google.firestore.admin.v1.BackupSchedule) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteBackupSchedule}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteBackupScheduleCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|cloneDatabase}. + * @param error Error, if any + * @param [response] Operation + */ + type CloneDatabaseCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ListDatabasesRequest. */ + interface IListDatabasesRequest { + + /** ListDatabasesRequest parent */ + parent?: (string|null); + + /** ListDatabasesRequest showDeleted */ + showDeleted?: (boolean|null); + } + + /** Represents a ListDatabasesRequest. */ + class ListDatabasesRequest implements IListDatabasesRequest { + + /** + * Constructs a new ListDatabasesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListDatabasesRequest); + + /** ListDatabasesRequest parent. */ + public parent: string; + + /** ListDatabasesRequest showDeleted. */ + public showDeleted: boolean; + + /** + * Creates a new ListDatabasesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDatabasesRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IListDatabasesRequest): google.firestore.admin.v1.ListDatabasesRequest; + + /** + * Encodes the specified ListDatabasesRequest message. Does not implicitly {@link google.firestore.admin.v1.ListDatabasesRequest.verify|verify} messages. + * @param message ListDatabasesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListDatabasesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDatabasesRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListDatabasesRequest.verify|verify} messages. + * @param message ListDatabasesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListDatabasesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDatabasesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDatabasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListDatabasesRequest; + + /** + * Decodes a ListDatabasesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDatabasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListDatabasesRequest; + + /** + * Verifies a ListDatabasesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDatabasesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDatabasesRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListDatabasesRequest; + + /** + * Creates a plain object from a ListDatabasesRequest message. Also converts values to other types if specified. + * @param message ListDatabasesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListDatabasesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDatabasesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDatabasesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateDatabaseRequest. */ + interface ICreateDatabaseRequest { + + /** CreateDatabaseRequest parent */ + parent?: (string|null); + + /** CreateDatabaseRequest database */ + database?: (google.firestore.admin.v1.IDatabase|null); + + /** CreateDatabaseRequest databaseId */ + databaseId?: (string|null); + } + + /** Represents a CreateDatabaseRequest. */ + class CreateDatabaseRequest implements ICreateDatabaseRequest { + + /** + * Constructs a new CreateDatabaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.ICreateDatabaseRequest); + + /** CreateDatabaseRequest parent. */ + public parent: string; + + /** CreateDatabaseRequest database. */ + public database?: (google.firestore.admin.v1.IDatabase|null); + + /** CreateDatabaseRequest databaseId. */ + public databaseId: string; + + /** + * Creates a new CreateDatabaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateDatabaseRequest instance + */ + public static create(properties?: google.firestore.admin.v1.ICreateDatabaseRequest): google.firestore.admin.v1.CreateDatabaseRequest; + + /** + * Encodes the specified CreateDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.CreateDatabaseRequest.verify|verify} messages. + * @param message CreateDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.ICreateDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateDatabaseRequest.verify|verify} messages. + * @param message CreateDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.ICreateDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateDatabaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.CreateDatabaseRequest; + + /** + * Decodes a CreateDatabaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.CreateDatabaseRequest; + + /** + * Verifies a CreateDatabaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateDatabaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.CreateDatabaseRequest; + + /** + * Creates a plain object from a CreateDatabaseRequest message. Also converts values to other types if specified. + * @param message CreateDatabaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.CreateDatabaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateDatabaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateDatabaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateDatabaseMetadata. */ + interface ICreateDatabaseMetadata { + } + + /** Represents a CreateDatabaseMetadata. */ + class CreateDatabaseMetadata implements ICreateDatabaseMetadata { + + /** + * Constructs a new CreateDatabaseMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.ICreateDatabaseMetadata); + + /** + * Creates a new CreateDatabaseMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateDatabaseMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.ICreateDatabaseMetadata): google.firestore.admin.v1.CreateDatabaseMetadata; + + /** + * Encodes the specified CreateDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.CreateDatabaseMetadata.verify|verify} messages. + * @param message CreateDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.ICreateDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateDatabaseMetadata.verify|verify} messages. + * @param message CreateDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.ICreateDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateDatabaseMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.CreateDatabaseMetadata; + + /** + * Decodes a CreateDatabaseMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.CreateDatabaseMetadata; + + /** + * Verifies a CreateDatabaseMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateDatabaseMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.CreateDatabaseMetadata; + + /** + * Creates a plain object from a CreateDatabaseMetadata message. Also converts values to other types if specified. + * @param message CreateDatabaseMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.CreateDatabaseMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateDatabaseMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateDatabaseMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListDatabasesResponse. */ + interface IListDatabasesResponse { + + /** ListDatabasesResponse databases */ + databases?: (google.firestore.admin.v1.IDatabase[]|null); + + /** ListDatabasesResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListDatabasesResponse. */ + class ListDatabasesResponse implements IListDatabasesResponse { + + /** + * Constructs a new ListDatabasesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListDatabasesResponse); + + /** ListDatabasesResponse databases. */ + public databases: google.firestore.admin.v1.IDatabase[]; + + /** ListDatabasesResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListDatabasesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDatabasesResponse instance + */ + public static create(properties?: google.firestore.admin.v1.IListDatabasesResponse): google.firestore.admin.v1.ListDatabasesResponse; + + /** + * Encodes the specified ListDatabasesResponse message. Does not implicitly {@link google.firestore.admin.v1.ListDatabasesResponse.verify|verify} messages. + * @param message ListDatabasesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListDatabasesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDatabasesResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListDatabasesResponse.verify|verify} messages. + * @param message ListDatabasesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListDatabasesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDatabasesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDatabasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListDatabasesResponse; + + /** + * Decodes a ListDatabasesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDatabasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListDatabasesResponse; + + /** + * Verifies a ListDatabasesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDatabasesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDatabasesResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListDatabasesResponse; + + /** + * Creates a plain object from a ListDatabasesResponse message. Also converts values to other types if specified. + * @param message ListDatabasesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListDatabasesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDatabasesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDatabasesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetDatabaseRequest. */ + interface IGetDatabaseRequest { + + /** GetDatabaseRequest name */ + name?: (string|null); + } + + /** Represents a GetDatabaseRequest. */ + class GetDatabaseRequest implements IGetDatabaseRequest { + + /** + * Constructs a new GetDatabaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IGetDatabaseRequest); + + /** GetDatabaseRequest name. */ + public name: string; + + /** + * Creates a new GetDatabaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetDatabaseRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IGetDatabaseRequest): google.firestore.admin.v1.GetDatabaseRequest; + + /** + * Encodes the specified GetDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.GetDatabaseRequest.verify|verify} messages. + * @param message GetDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IGetDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetDatabaseRequest.verify|verify} messages. + * @param message GetDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IGetDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetDatabaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.GetDatabaseRequest; + + /** + * Decodes a GetDatabaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.GetDatabaseRequest; + + /** + * Verifies a GetDatabaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetDatabaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.GetDatabaseRequest; + + /** + * Creates a plain object from a GetDatabaseRequest message. Also converts values to other types if specified. + * @param message GetDatabaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.GetDatabaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetDatabaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDatabaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateDatabaseRequest. */ + interface IUpdateDatabaseRequest { + + /** UpdateDatabaseRequest database */ + database?: (google.firestore.admin.v1.IDatabase|null); + + /** UpdateDatabaseRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateDatabaseRequest. */ + class UpdateDatabaseRequest implements IUpdateDatabaseRequest { + + /** + * Constructs a new UpdateDatabaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IUpdateDatabaseRequest); + + /** UpdateDatabaseRequest database. */ + public database?: (google.firestore.admin.v1.IDatabase|null); + + /** UpdateDatabaseRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateDatabaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateDatabaseRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IUpdateDatabaseRequest): google.firestore.admin.v1.UpdateDatabaseRequest; + + /** + * Encodes the specified UpdateDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.UpdateDatabaseRequest.verify|verify} messages. + * @param message UpdateDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IUpdateDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UpdateDatabaseRequest.verify|verify} messages. + * @param message UpdateDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IUpdateDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateDatabaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.UpdateDatabaseRequest; + + /** + * Decodes an UpdateDatabaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.UpdateDatabaseRequest; + + /** + * Verifies an UpdateDatabaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateDatabaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.UpdateDatabaseRequest; + + /** + * Creates a plain object from an UpdateDatabaseRequest message. Also converts values to other types if specified. + * @param message UpdateDatabaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.UpdateDatabaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateDatabaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateDatabaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateDatabaseMetadata. */ + interface IUpdateDatabaseMetadata { + } + + /** Represents an UpdateDatabaseMetadata. */ + class UpdateDatabaseMetadata implements IUpdateDatabaseMetadata { + + /** + * Constructs a new UpdateDatabaseMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IUpdateDatabaseMetadata); + + /** + * Creates a new UpdateDatabaseMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateDatabaseMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.IUpdateDatabaseMetadata): google.firestore.admin.v1.UpdateDatabaseMetadata; + + /** + * Encodes the specified UpdateDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.UpdateDatabaseMetadata.verify|verify} messages. + * @param message UpdateDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IUpdateDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UpdateDatabaseMetadata.verify|verify} messages. + * @param message UpdateDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IUpdateDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateDatabaseMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.UpdateDatabaseMetadata; + + /** + * Decodes an UpdateDatabaseMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.UpdateDatabaseMetadata; + + /** + * Verifies an UpdateDatabaseMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateDatabaseMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.UpdateDatabaseMetadata; + + /** + * Creates a plain object from an UpdateDatabaseMetadata message. Also converts values to other types if specified. + * @param message UpdateDatabaseMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.UpdateDatabaseMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateDatabaseMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateDatabaseMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteDatabaseRequest. */ + interface IDeleteDatabaseRequest { + + /** DeleteDatabaseRequest name */ + name?: (string|null); + + /** DeleteDatabaseRequest etag */ + etag?: (string|null); + } + + /** Represents a DeleteDatabaseRequest. */ + class DeleteDatabaseRequest implements IDeleteDatabaseRequest { + + /** + * Constructs a new DeleteDatabaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IDeleteDatabaseRequest); + + /** DeleteDatabaseRequest name. */ + public name: string; + + /** DeleteDatabaseRequest etag. */ + public etag: string; + + /** + * Creates a new DeleteDatabaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteDatabaseRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IDeleteDatabaseRequest): google.firestore.admin.v1.DeleteDatabaseRequest; + + /** + * Encodes the specified DeleteDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteDatabaseRequest.verify|verify} messages. + * @param message DeleteDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IDeleteDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteDatabaseRequest.verify|verify} messages. + * @param message DeleteDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IDeleteDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteDatabaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.DeleteDatabaseRequest; + + /** + * Decodes a DeleteDatabaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.DeleteDatabaseRequest; + + /** + * Verifies a DeleteDatabaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteDatabaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.DeleteDatabaseRequest; + + /** + * Creates a plain object from a DeleteDatabaseRequest message. Also converts values to other types if specified. + * @param message DeleteDatabaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.DeleteDatabaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteDatabaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteDatabaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteDatabaseMetadata. */ + interface IDeleteDatabaseMetadata { + } + + /** Represents a DeleteDatabaseMetadata. */ + class DeleteDatabaseMetadata implements IDeleteDatabaseMetadata { + + /** + * Constructs a new DeleteDatabaseMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IDeleteDatabaseMetadata); + + /** + * Creates a new DeleteDatabaseMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteDatabaseMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.IDeleteDatabaseMetadata): google.firestore.admin.v1.DeleteDatabaseMetadata; + + /** + * Encodes the specified DeleteDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.DeleteDatabaseMetadata.verify|verify} messages. + * @param message DeleteDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IDeleteDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteDatabaseMetadata.verify|verify} messages. + * @param message DeleteDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IDeleteDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteDatabaseMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.DeleteDatabaseMetadata; + + /** + * Decodes a DeleteDatabaseMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.DeleteDatabaseMetadata; + + /** + * Verifies a DeleteDatabaseMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteDatabaseMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.DeleteDatabaseMetadata; + + /** + * Creates a plain object from a DeleteDatabaseMetadata message. Also converts values to other types if specified. + * @param message DeleteDatabaseMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.DeleteDatabaseMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteDatabaseMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteDatabaseMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateUserCredsRequest. */ + interface ICreateUserCredsRequest { + + /** CreateUserCredsRequest parent */ + parent?: (string|null); + + /** CreateUserCredsRequest userCreds */ + userCreds?: (google.firestore.admin.v1.IUserCreds|null); + + /** CreateUserCredsRequest userCredsId */ + userCredsId?: (string|null); + } + + /** Represents a CreateUserCredsRequest. */ + class CreateUserCredsRequest implements ICreateUserCredsRequest { + + /** + * Constructs a new CreateUserCredsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.ICreateUserCredsRequest); + + /** CreateUserCredsRequest parent. */ + public parent: string; + + /** CreateUserCredsRequest userCreds. */ + public userCreds?: (google.firestore.admin.v1.IUserCreds|null); + + /** CreateUserCredsRequest userCredsId. */ + public userCredsId: string; + + /** + * Creates a new CreateUserCredsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateUserCredsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.ICreateUserCredsRequest): google.firestore.admin.v1.CreateUserCredsRequest; + + /** + * Encodes the specified CreateUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.CreateUserCredsRequest.verify|verify} messages. + * @param message CreateUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.ICreateUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateUserCredsRequest.verify|verify} messages. + * @param message CreateUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.ICreateUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateUserCredsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.CreateUserCredsRequest; + + /** + * Decodes a CreateUserCredsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.CreateUserCredsRequest; + + /** + * Verifies a CreateUserCredsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateUserCredsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.CreateUserCredsRequest; + + /** + * Creates a plain object from a CreateUserCredsRequest message. Also converts values to other types if specified. + * @param message CreateUserCredsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.CreateUserCredsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateUserCredsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateUserCredsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetUserCredsRequest. */ + interface IGetUserCredsRequest { + + /** GetUserCredsRequest name */ + name?: (string|null); + } + + /** Represents a GetUserCredsRequest. */ + class GetUserCredsRequest implements IGetUserCredsRequest { + + /** + * Constructs a new GetUserCredsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IGetUserCredsRequest); + + /** GetUserCredsRequest name. */ + public name: string; + + /** + * Creates a new GetUserCredsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetUserCredsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IGetUserCredsRequest): google.firestore.admin.v1.GetUserCredsRequest; + + /** + * Encodes the specified GetUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.GetUserCredsRequest.verify|verify} messages. + * @param message GetUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IGetUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetUserCredsRequest.verify|verify} messages. + * @param message GetUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IGetUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetUserCredsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.GetUserCredsRequest; + + /** + * Decodes a GetUserCredsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.GetUserCredsRequest; + + /** + * Verifies a GetUserCredsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetUserCredsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.GetUserCredsRequest; + + /** + * Creates a plain object from a GetUserCredsRequest message. Also converts values to other types if specified. + * @param message GetUserCredsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.GetUserCredsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetUserCredsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetUserCredsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListUserCredsRequest. */ + interface IListUserCredsRequest { + + /** ListUserCredsRequest parent */ + parent?: (string|null); + } + + /** Represents a ListUserCredsRequest. */ + class ListUserCredsRequest implements IListUserCredsRequest { + + /** + * Constructs a new ListUserCredsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListUserCredsRequest); + + /** ListUserCredsRequest parent. */ + public parent: string; + + /** + * Creates a new ListUserCredsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListUserCredsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IListUserCredsRequest): google.firestore.admin.v1.ListUserCredsRequest; + + /** + * Encodes the specified ListUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.ListUserCredsRequest.verify|verify} messages. + * @param message ListUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListUserCredsRequest.verify|verify} messages. + * @param message ListUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListUserCredsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListUserCredsRequest; + + /** + * Decodes a ListUserCredsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListUserCredsRequest; + + /** + * Verifies a ListUserCredsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListUserCredsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListUserCredsRequest; + + /** + * Creates a plain object from a ListUserCredsRequest message. Also converts values to other types if specified. + * @param message ListUserCredsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListUserCredsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListUserCredsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListUserCredsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListUserCredsResponse. */ + interface IListUserCredsResponse { + + /** ListUserCredsResponse userCreds */ + userCreds?: (google.firestore.admin.v1.IUserCreds[]|null); + } + + /** Represents a ListUserCredsResponse. */ + class ListUserCredsResponse implements IListUserCredsResponse { + + /** + * Constructs a new ListUserCredsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListUserCredsResponse); + + /** ListUserCredsResponse userCreds. */ + public userCreds: google.firestore.admin.v1.IUserCreds[]; + + /** + * Creates a new ListUserCredsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListUserCredsResponse instance + */ + public static create(properties?: google.firestore.admin.v1.IListUserCredsResponse): google.firestore.admin.v1.ListUserCredsResponse; + + /** + * Encodes the specified ListUserCredsResponse message. Does not implicitly {@link google.firestore.admin.v1.ListUserCredsResponse.verify|verify} messages. + * @param message ListUserCredsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListUserCredsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListUserCredsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListUserCredsResponse.verify|verify} messages. + * @param message ListUserCredsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListUserCredsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListUserCredsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListUserCredsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListUserCredsResponse; + + /** + * Decodes a ListUserCredsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListUserCredsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListUserCredsResponse; + + /** + * Verifies a ListUserCredsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListUserCredsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListUserCredsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListUserCredsResponse; + + /** + * Creates a plain object from a ListUserCredsResponse message. Also converts values to other types if specified. + * @param message ListUserCredsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListUserCredsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListUserCredsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListUserCredsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnableUserCredsRequest. */ + interface IEnableUserCredsRequest { + + /** EnableUserCredsRequest name */ + name?: (string|null); + } + + /** Represents an EnableUserCredsRequest. */ + class EnableUserCredsRequest implements IEnableUserCredsRequest { + + /** + * Constructs a new EnableUserCredsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IEnableUserCredsRequest); + + /** EnableUserCredsRequest name. */ + public name: string; + + /** + * Creates a new EnableUserCredsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableUserCredsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IEnableUserCredsRequest): google.firestore.admin.v1.EnableUserCredsRequest; + + /** + * Encodes the specified EnableUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.EnableUserCredsRequest.verify|verify} messages. + * @param message EnableUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IEnableUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.EnableUserCredsRequest.verify|verify} messages. + * @param message EnableUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IEnableUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableUserCredsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.EnableUserCredsRequest; + + /** + * Decodes an EnableUserCredsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.EnableUserCredsRequest; + + /** + * Verifies an EnableUserCredsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnableUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableUserCredsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.EnableUserCredsRequest; + + /** + * Creates a plain object from an EnableUserCredsRequest message. Also converts values to other types if specified. + * @param message EnableUserCredsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.EnableUserCredsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableUserCredsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnableUserCredsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DisableUserCredsRequest. */ + interface IDisableUserCredsRequest { + + /** DisableUserCredsRequest name */ + name?: (string|null); + } + + /** Represents a DisableUserCredsRequest. */ + class DisableUserCredsRequest implements IDisableUserCredsRequest { + + /** + * Constructs a new DisableUserCredsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IDisableUserCredsRequest); + + /** DisableUserCredsRequest name. */ + public name: string; + + /** + * Creates a new DisableUserCredsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableUserCredsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IDisableUserCredsRequest): google.firestore.admin.v1.DisableUserCredsRequest; + + /** + * Encodes the specified DisableUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.DisableUserCredsRequest.verify|verify} messages. + * @param message DisableUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IDisableUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DisableUserCredsRequest.verify|verify} messages. + * @param message DisableUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IDisableUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableUserCredsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.DisableUserCredsRequest; + + /** + * Decodes a DisableUserCredsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.DisableUserCredsRequest; + + /** + * Verifies a DisableUserCredsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableUserCredsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.DisableUserCredsRequest; + + /** + * Creates a plain object from a DisableUserCredsRequest message. Also converts values to other types if specified. + * @param message DisableUserCredsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.DisableUserCredsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableUserCredsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DisableUserCredsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ResetUserPasswordRequest. */ + interface IResetUserPasswordRequest { + + /** ResetUserPasswordRequest name */ + name?: (string|null); + } + + /** Represents a ResetUserPasswordRequest. */ + class ResetUserPasswordRequest implements IResetUserPasswordRequest { + + /** + * Constructs a new ResetUserPasswordRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IResetUserPasswordRequest); + + /** ResetUserPasswordRequest name. */ + public name: string; + + /** + * Creates a new ResetUserPasswordRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ResetUserPasswordRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IResetUserPasswordRequest): google.firestore.admin.v1.ResetUserPasswordRequest; + + /** + * Encodes the specified ResetUserPasswordRequest message. Does not implicitly {@link google.firestore.admin.v1.ResetUserPasswordRequest.verify|verify} messages. + * @param message ResetUserPasswordRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IResetUserPasswordRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResetUserPasswordRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ResetUserPasswordRequest.verify|verify} messages. + * @param message ResetUserPasswordRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IResetUserPasswordRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResetUserPasswordRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResetUserPasswordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ResetUserPasswordRequest; + + /** + * Decodes a ResetUserPasswordRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResetUserPasswordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ResetUserPasswordRequest; + + /** + * Verifies a ResetUserPasswordRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResetUserPasswordRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResetUserPasswordRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ResetUserPasswordRequest; + + /** + * Creates a plain object from a ResetUserPasswordRequest message. Also converts values to other types if specified. + * @param message ResetUserPasswordRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ResetUserPasswordRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResetUserPasswordRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResetUserPasswordRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteUserCredsRequest. */ + interface IDeleteUserCredsRequest { + + /** DeleteUserCredsRequest name */ + name?: (string|null); + } + + /** Represents a DeleteUserCredsRequest. */ + class DeleteUserCredsRequest implements IDeleteUserCredsRequest { + + /** + * Constructs a new DeleteUserCredsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IDeleteUserCredsRequest); + + /** DeleteUserCredsRequest name. */ + public name: string; + + /** + * Creates a new DeleteUserCredsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteUserCredsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IDeleteUserCredsRequest): google.firestore.admin.v1.DeleteUserCredsRequest; + + /** + * Encodes the specified DeleteUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteUserCredsRequest.verify|verify} messages. + * @param message DeleteUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IDeleteUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteUserCredsRequest.verify|verify} messages. + * @param message DeleteUserCredsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IDeleteUserCredsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteUserCredsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.DeleteUserCredsRequest; + + /** + * Decodes a DeleteUserCredsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.DeleteUserCredsRequest; + + /** + * Verifies a DeleteUserCredsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteUserCredsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.DeleteUserCredsRequest; + + /** + * Creates a plain object from a DeleteUserCredsRequest message. Also converts values to other types if specified. + * @param message DeleteUserCredsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.DeleteUserCredsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteUserCredsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteUserCredsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateBackupScheduleRequest. */ + interface ICreateBackupScheduleRequest { + + /** CreateBackupScheduleRequest parent */ + parent?: (string|null); + + /** CreateBackupScheduleRequest backupSchedule */ + backupSchedule?: (google.firestore.admin.v1.IBackupSchedule|null); + } + + /** Represents a CreateBackupScheduleRequest. */ + class CreateBackupScheduleRequest implements ICreateBackupScheduleRequest { + + /** + * Constructs a new CreateBackupScheduleRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.ICreateBackupScheduleRequest); + + /** CreateBackupScheduleRequest parent. */ + public parent: string; + + /** CreateBackupScheduleRequest backupSchedule. */ + public backupSchedule?: (google.firestore.admin.v1.IBackupSchedule|null); + + /** + * Creates a new CreateBackupScheduleRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateBackupScheduleRequest instance + */ + public static create(properties?: google.firestore.admin.v1.ICreateBackupScheduleRequest): google.firestore.admin.v1.CreateBackupScheduleRequest; + + /** + * Encodes the specified CreateBackupScheduleRequest message. Does not implicitly {@link google.firestore.admin.v1.CreateBackupScheduleRequest.verify|verify} messages. + * @param message CreateBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.ICreateBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateBackupScheduleRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateBackupScheduleRequest.verify|verify} messages. + * @param message CreateBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.ICreateBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateBackupScheduleRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.CreateBackupScheduleRequest; + + /** + * Decodes a CreateBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.CreateBackupScheduleRequest; + + /** + * Verifies a CreateBackupScheduleRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateBackupScheduleRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.CreateBackupScheduleRequest; + + /** + * Creates a plain object from a CreateBackupScheduleRequest message. Also converts values to other types if specified. + * @param message CreateBackupScheduleRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.CreateBackupScheduleRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateBackupScheduleRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateBackupScheduleRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetBackupScheduleRequest. */ + interface IGetBackupScheduleRequest { + + /** GetBackupScheduleRequest name */ + name?: (string|null); + } + + /** Represents a GetBackupScheduleRequest. */ + class GetBackupScheduleRequest implements IGetBackupScheduleRequest { + + /** + * Constructs a new GetBackupScheduleRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IGetBackupScheduleRequest); + + /** GetBackupScheduleRequest name. */ + public name: string; + + /** + * Creates a new GetBackupScheduleRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetBackupScheduleRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IGetBackupScheduleRequest): google.firestore.admin.v1.GetBackupScheduleRequest; + + /** + * Encodes the specified GetBackupScheduleRequest message. Does not implicitly {@link google.firestore.admin.v1.GetBackupScheduleRequest.verify|verify} messages. + * @param message GetBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IGetBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetBackupScheduleRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetBackupScheduleRequest.verify|verify} messages. + * @param message GetBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IGetBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetBackupScheduleRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.GetBackupScheduleRequest; + + /** + * Decodes a GetBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.GetBackupScheduleRequest; + + /** + * Verifies a GetBackupScheduleRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetBackupScheduleRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.GetBackupScheduleRequest; + + /** + * Creates a plain object from a GetBackupScheduleRequest message. Also converts values to other types if specified. + * @param message GetBackupScheduleRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.GetBackupScheduleRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetBackupScheduleRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetBackupScheduleRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateBackupScheduleRequest. */ + interface IUpdateBackupScheduleRequest { + + /** UpdateBackupScheduleRequest backupSchedule */ + backupSchedule?: (google.firestore.admin.v1.IBackupSchedule|null); + + /** UpdateBackupScheduleRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateBackupScheduleRequest. */ + class UpdateBackupScheduleRequest implements IUpdateBackupScheduleRequest { + + /** + * Constructs a new UpdateBackupScheduleRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IUpdateBackupScheduleRequest); + + /** UpdateBackupScheduleRequest backupSchedule. */ + public backupSchedule?: (google.firestore.admin.v1.IBackupSchedule|null); + + /** UpdateBackupScheduleRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateBackupScheduleRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateBackupScheduleRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IUpdateBackupScheduleRequest): google.firestore.admin.v1.UpdateBackupScheduleRequest; + + /** + * Encodes the specified UpdateBackupScheduleRequest message. Does not implicitly {@link google.firestore.admin.v1.UpdateBackupScheduleRequest.verify|verify} messages. + * @param message UpdateBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IUpdateBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateBackupScheduleRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UpdateBackupScheduleRequest.verify|verify} messages. + * @param message UpdateBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IUpdateBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateBackupScheduleRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.UpdateBackupScheduleRequest; + + /** + * Decodes an UpdateBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.UpdateBackupScheduleRequest; + + /** + * Verifies an UpdateBackupScheduleRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateBackupScheduleRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.UpdateBackupScheduleRequest; + + /** + * Creates a plain object from an UpdateBackupScheduleRequest message. Also converts values to other types if specified. + * @param message UpdateBackupScheduleRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.UpdateBackupScheduleRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateBackupScheduleRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateBackupScheduleRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListBackupSchedulesRequest. */ + interface IListBackupSchedulesRequest { + + /** ListBackupSchedulesRequest parent */ + parent?: (string|null); + } + + /** Represents a ListBackupSchedulesRequest. */ + class ListBackupSchedulesRequest implements IListBackupSchedulesRequest { + + /** + * Constructs a new ListBackupSchedulesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListBackupSchedulesRequest); + + /** ListBackupSchedulesRequest parent. */ + public parent: string; + + /** + * Creates a new ListBackupSchedulesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBackupSchedulesRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IListBackupSchedulesRequest): google.firestore.admin.v1.ListBackupSchedulesRequest; + + /** + * Encodes the specified ListBackupSchedulesRequest message. Does not implicitly {@link google.firestore.admin.v1.ListBackupSchedulesRequest.verify|verify} messages. + * @param message ListBackupSchedulesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListBackupSchedulesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBackupSchedulesRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListBackupSchedulesRequest.verify|verify} messages. + * @param message ListBackupSchedulesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListBackupSchedulesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBackupSchedulesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBackupSchedulesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListBackupSchedulesRequest; + + /** + * Decodes a ListBackupSchedulesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBackupSchedulesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListBackupSchedulesRequest; + + /** + * Verifies a ListBackupSchedulesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBackupSchedulesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBackupSchedulesRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListBackupSchedulesRequest; + + /** + * Creates a plain object from a ListBackupSchedulesRequest message. Also converts values to other types if specified. + * @param message ListBackupSchedulesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListBackupSchedulesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBackupSchedulesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBackupSchedulesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListBackupSchedulesResponse. */ + interface IListBackupSchedulesResponse { + + /** ListBackupSchedulesResponse backupSchedules */ + backupSchedules?: (google.firestore.admin.v1.IBackupSchedule[]|null); + } + + /** Represents a ListBackupSchedulesResponse. */ + class ListBackupSchedulesResponse implements IListBackupSchedulesResponse { + + /** + * Constructs a new ListBackupSchedulesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListBackupSchedulesResponse); + + /** ListBackupSchedulesResponse backupSchedules. */ + public backupSchedules: google.firestore.admin.v1.IBackupSchedule[]; + + /** + * Creates a new ListBackupSchedulesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBackupSchedulesResponse instance + */ + public static create(properties?: google.firestore.admin.v1.IListBackupSchedulesResponse): google.firestore.admin.v1.ListBackupSchedulesResponse; + + /** + * Encodes the specified ListBackupSchedulesResponse message. Does not implicitly {@link google.firestore.admin.v1.ListBackupSchedulesResponse.verify|verify} messages. + * @param message ListBackupSchedulesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListBackupSchedulesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBackupSchedulesResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListBackupSchedulesResponse.verify|verify} messages. + * @param message ListBackupSchedulesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListBackupSchedulesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBackupSchedulesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBackupSchedulesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListBackupSchedulesResponse; + + /** + * Decodes a ListBackupSchedulesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBackupSchedulesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListBackupSchedulesResponse; + + /** + * Verifies a ListBackupSchedulesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBackupSchedulesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBackupSchedulesResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListBackupSchedulesResponse; + + /** + * Creates a plain object from a ListBackupSchedulesResponse message. Also converts values to other types if specified. + * @param message ListBackupSchedulesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListBackupSchedulesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBackupSchedulesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBackupSchedulesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteBackupScheduleRequest. */ + interface IDeleteBackupScheduleRequest { + + /** DeleteBackupScheduleRequest name */ + name?: (string|null); + } + + /** Represents a DeleteBackupScheduleRequest. */ + class DeleteBackupScheduleRequest implements IDeleteBackupScheduleRequest { + + /** + * Constructs a new DeleteBackupScheduleRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IDeleteBackupScheduleRequest); + + /** DeleteBackupScheduleRequest name. */ + public name: string; + + /** + * Creates a new DeleteBackupScheduleRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteBackupScheduleRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IDeleteBackupScheduleRequest): google.firestore.admin.v1.DeleteBackupScheduleRequest; + + /** + * Encodes the specified DeleteBackupScheduleRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteBackupScheduleRequest.verify|verify} messages. + * @param message DeleteBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IDeleteBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteBackupScheduleRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteBackupScheduleRequest.verify|verify} messages. + * @param message DeleteBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IDeleteBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteBackupScheduleRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.DeleteBackupScheduleRequest; + + /** + * Decodes a DeleteBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.DeleteBackupScheduleRequest; + + /** + * Verifies a DeleteBackupScheduleRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteBackupScheduleRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.DeleteBackupScheduleRequest; + + /** + * Creates a plain object from a DeleteBackupScheduleRequest message. Also converts values to other types if specified. + * @param message DeleteBackupScheduleRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.DeleteBackupScheduleRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteBackupScheduleRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteBackupScheduleRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateIndexRequest. */ + interface ICreateIndexRequest { + + /** CreateIndexRequest parent */ + parent?: (string|null); + + /** CreateIndexRequest index */ + index?: (google.firestore.admin.v1.IIndex|null); + } + + /** Represents a CreateIndexRequest. */ + class CreateIndexRequest implements ICreateIndexRequest { + + /** + * Constructs a new CreateIndexRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.ICreateIndexRequest); + + /** CreateIndexRequest parent. */ + public parent: string; + + /** CreateIndexRequest index. */ + public index?: (google.firestore.admin.v1.IIndex|null); + + /** + * Creates a new CreateIndexRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateIndexRequest instance + */ + public static create(properties?: google.firestore.admin.v1.ICreateIndexRequest): google.firestore.admin.v1.CreateIndexRequest; + + /** + * Encodes the specified CreateIndexRequest message. Does not implicitly {@link google.firestore.admin.v1.CreateIndexRequest.verify|verify} messages. + * @param message CreateIndexRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.ICreateIndexRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateIndexRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateIndexRequest.verify|verify} messages. + * @param message CreateIndexRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.ICreateIndexRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateIndexRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.CreateIndexRequest; + + /** + * Decodes a CreateIndexRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.CreateIndexRequest; + + /** + * Verifies a CreateIndexRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateIndexRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateIndexRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.CreateIndexRequest; + + /** + * Creates a plain object from a CreateIndexRequest message. Also converts values to other types if specified. + * @param message CreateIndexRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.CreateIndexRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateIndexRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateIndexRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListIndexesRequest. */ + interface IListIndexesRequest { + + /** ListIndexesRequest parent */ + parent?: (string|null); + + /** ListIndexesRequest filter */ + filter?: (string|null); + + /** ListIndexesRequest pageSize */ + pageSize?: (number|null); + + /** ListIndexesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListIndexesRequest. */ + class ListIndexesRequest implements IListIndexesRequest { + + /** + * Constructs a new ListIndexesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListIndexesRequest); + + /** ListIndexesRequest parent. */ + public parent: string; + + /** ListIndexesRequest filter. */ + public filter: string; + + /** ListIndexesRequest pageSize. */ + public pageSize: number; + + /** ListIndexesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListIndexesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListIndexesRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IListIndexesRequest): google.firestore.admin.v1.ListIndexesRequest; + + /** + * Encodes the specified ListIndexesRequest message. Does not implicitly {@link google.firestore.admin.v1.ListIndexesRequest.verify|verify} messages. + * @param message ListIndexesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListIndexesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListIndexesRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListIndexesRequest.verify|verify} messages. + * @param message ListIndexesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListIndexesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListIndexesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListIndexesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListIndexesRequest; + + /** + * Decodes a ListIndexesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListIndexesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListIndexesRequest; + + /** + * Verifies a ListIndexesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListIndexesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListIndexesRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListIndexesRequest; + + /** + * Creates a plain object from a ListIndexesRequest message. Also converts values to other types if specified. + * @param message ListIndexesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListIndexesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListIndexesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListIndexesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListIndexesResponse. */ + interface IListIndexesResponse { + + /** ListIndexesResponse indexes */ + indexes?: (google.firestore.admin.v1.IIndex[]|null); + + /** ListIndexesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListIndexesResponse. */ + class ListIndexesResponse implements IListIndexesResponse { + + /** + * Constructs a new ListIndexesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListIndexesResponse); + + /** ListIndexesResponse indexes. */ + public indexes: google.firestore.admin.v1.IIndex[]; + + /** ListIndexesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListIndexesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListIndexesResponse instance + */ + public static create(properties?: google.firestore.admin.v1.IListIndexesResponse): google.firestore.admin.v1.ListIndexesResponse; + + /** + * Encodes the specified ListIndexesResponse message. Does not implicitly {@link google.firestore.admin.v1.ListIndexesResponse.verify|verify} messages. + * @param message ListIndexesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListIndexesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListIndexesResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListIndexesResponse.verify|verify} messages. + * @param message ListIndexesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListIndexesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListIndexesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListIndexesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListIndexesResponse; + + /** + * Decodes a ListIndexesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListIndexesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListIndexesResponse; + + /** + * Verifies a ListIndexesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListIndexesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListIndexesResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListIndexesResponse; + + /** + * Creates a plain object from a ListIndexesResponse message. Also converts values to other types if specified. + * @param message ListIndexesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListIndexesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListIndexesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListIndexesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetIndexRequest. */ + interface IGetIndexRequest { + + /** GetIndexRequest name */ + name?: (string|null); + } + + /** Represents a GetIndexRequest. */ + class GetIndexRequest implements IGetIndexRequest { + + /** + * Constructs a new GetIndexRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IGetIndexRequest); + + /** GetIndexRequest name. */ + public name: string; + + /** + * Creates a new GetIndexRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetIndexRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IGetIndexRequest): google.firestore.admin.v1.GetIndexRequest; + + /** + * Encodes the specified GetIndexRequest message. Does not implicitly {@link google.firestore.admin.v1.GetIndexRequest.verify|verify} messages. + * @param message GetIndexRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IGetIndexRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetIndexRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetIndexRequest.verify|verify} messages. + * @param message GetIndexRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IGetIndexRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetIndexRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.GetIndexRequest; + + /** + * Decodes a GetIndexRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.GetIndexRequest; + + /** + * Verifies a GetIndexRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetIndexRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetIndexRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.GetIndexRequest; + + /** + * Creates a plain object from a GetIndexRequest message. Also converts values to other types if specified. + * @param message GetIndexRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.GetIndexRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetIndexRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetIndexRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteIndexRequest. */ + interface IDeleteIndexRequest { + + /** DeleteIndexRequest name */ + name?: (string|null); + } + + /** Represents a DeleteIndexRequest. */ + class DeleteIndexRequest implements IDeleteIndexRequest { + + /** + * Constructs a new DeleteIndexRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IDeleteIndexRequest); + + /** DeleteIndexRequest name. */ + public name: string; + + /** + * Creates a new DeleteIndexRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteIndexRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IDeleteIndexRequest): google.firestore.admin.v1.DeleteIndexRequest; + + /** + * Encodes the specified DeleteIndexRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteIndexRequest.verify|verify} messages. + * @param message DeleteIndexRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IDeleteIndexRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteIndexRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteIndexRequest.verify|verify} messages. + * @param message DeleteIndexRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IDeleteIndexRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteIndexRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.DeleteIndexRequest; + + /** + * Decodes a DeleteIndexRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.DeleteIndexRequest; + + /** + * Verifies a DeleteIndexRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteIndexRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteIndexRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.DeleteIndexRequest; + + /** + * Creates a plain object from a DeleteIndexRequest message. Also converts values to other types if specified. + * @param message DeleteIndexRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.DeleteIndexRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteIndexRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteIndexRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateFieldRequest. */ + interface IUpdateFieldRequest { + + /** UpdateFieldRequest field */ + field?: (google.firestore.admin.v1.IField|null); + + /** UpdateFieldRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateFieldRequest. */ + class UpdateFieldRequest implements IUpdateFieldRequest { + + /** + * Constructs a new UpdateFieldRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IUpdateFieldRequest); + + /** UpdateFieldRequest field. */ + public field?: (google.firestore.admin.v1.IField|null); + + /** UpdateFieldRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateFieldRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateFieldRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IUpdateFieldRequest): google.firestore.admin.v1.UpdateFieldRequest; + + /** + * Encodes the specified UpdateFieldRequest message. Does not implicitly {@link google.firestore.admin.v1.UpdateFieldRequest.verify|verify} messages. + * @param message UpdateFieldRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IUpdateFieldRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateFieldRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UpdateFieldRequest.verify|verify} messages. + * @param message UpdateFieldRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IUpdateFieldRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateFieldRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateFieldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.UpdateFieldRequest; + + /** + * Decodes an UpdateFieldRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateFieldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.UpdateFieldRequest; + + /** + * Verifies an UpdateFieldRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateFieldRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateFieldRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.UpdateFieldRequest; + + /** + * Creates a plain object from an UpdateFieldRequest message. Also converts values to other types if specified. + * @param message UpdateFieldRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.UpdateFieldRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateFieldRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateFieldRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetFieldRequest. */ + interface IGetFieldRequest { + + /** GetFieldRequest name */ + name?: (string|null); + } + + /** Represents a GetFieldRequest. */ + class GetFieldRequest implements IGetFieldRequest { + + /** + * Constructs a new GetFieldRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IGetFieldRequest); + + /** GetFieldRequest name. */ + public name: string; + + /** + * Creates a new GetFieldRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetFieldRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IGetFieldRequest): google.firestore.admin.v1.GetFieldRequest; + + /** + * Encodes the specified GetFieldRequest message. Does not implicitly {@link google.firestore.admin.v1.GetFieldRequest.verify|verify} messages. + * @param message GetFieldRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IGetFieldRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetFieldRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetFieldRequest.verify|verify} messages. + * @param message GetFieldRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IGetFieldRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetFieldRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetFieldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.GetFieldRequest; + + /** + * Decodes a GetFieldRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetFieldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.GetFieldRequest; + + /** + * Verifies a GetFieldRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetFieldRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetFieldRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.GetFieldRequest; + + /** + * Creates a plain object from a GetFieldRequest message. Also converts values to other types if specified. + * @param message GetFieldRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.GetFieldRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetFieldRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetFieldRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListFieldsRequest. */ + interface IListFieldsRequest { + + /** ListFieldsRequest parent */ + parent?: (string|null); + + /** ListFieldsRequest filter */ + filter?: (string|null); + + /** ListFieldsRequest pageSize */ + pageSize?: (number|null); + + /** ListFieldsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListFieldsRequest. */ + class ListFieldsRequest implements IListFieldsRequest { + + /** + * Constructs a new ListFieldsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListFieldsRequest); + + /** ListFieldsRequest parent. */ + public parent: string; + + /** ListFieldsRequest filter. */ + public filter: string; + + /** ListFieldsRequest pageSize. */ + public pageSize: number; + + /** ListFieldsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListFieldsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFieldsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IListFieldsRequest): google.firestore.admin.v1.ListFieldsRequest; + + /** + * Encodes the specified ListFieldsRequest message. Does not implicitly {@link google.firestore.admin.v1.ListFieldsRequest.verify|verify} messages. + * @param message ListFieldsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListFieldsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFieldsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListFieldsRequest.verify|verify} messages. + * @param message ListFieldsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListFieldsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFieldsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFieldsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListFieldsRequest; + + /** + * Decodes a ListFieldsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFieldsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListFieldsRequest; + + /** + * Verifies a ListFieldsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFieldsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFieldsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListFieldsRequest; + + /** + * Creates a plain object from a ListFieldsRequest message. Also converts values to other types if specified. + * @param message ListFieldsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListFieldsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFieldsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFieldsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListFieldsResponse. */ + interface IListFieldsResponse { + + /** ListFieldsResponse fields */ + fields?: (google.firestore.admin.v1.IField[]|null); + + /** ListFieldsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListFieldsResponse. */ + class ListFieldsResponse implements IListFieldsResponse { + + /** + * Constructs a new ListFieldsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListFieldsResponse); + + /** ListFieldsResponse fields. */ + public fields: google.firestore.admin.v1.IField[]; + + /** ListFieldsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListFieldsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFieldsResponse instance + */ + public static create(properties?: google.firestore.admin.v1.IListFieldsResponse): google.firestore.admin.v1.ListFieldsResponse; + + /** + * Encodes the specified ListFieldsResponse message. Does not implicitly {@link google.firestore.admin.v1.ListFieldsResponse.verify|verify} messages. + * @param message ListFieldsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListFieldsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFieldsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListFieldsResponse.verify|verify} messages. + * @param message ListFieldsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListFieldsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFieldsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFieldsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListFieldsResponse; + + /** + * Decodes a ListFieldsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFieldsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListFieldsResponse; + + /** + * Verifies a ListFieldsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFieldsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFieldsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListFieldsResponse; + + /** + * Creates a plain object from a ListFieldsResponse message. Also converts values to other types if specified. + * @param message ListFieldsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListFieldsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFieldsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFieldsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportDocumentsRequest. */ + interface IExportDocumentsRequest { + + /** ExportDocumentsRequest name */ + name?: (string|null); + + /** ExportDocumentsRequest collectionIds */ + collectionIds?: (string[]|null); + + /** ExportDocumentsRequest outputUriPrefix */ + outputUriPrefix?: (string|null); + + /** ExportDocumentsRequest namespaceIds */ + namespaceIds?: (string[]|null); + + /** ExportDocumentsRequest snapshotTime */ + snapshotTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an ExportDocumentsRequest. */ + class ExportDocumentsRequest implements IExportDocumentsRequest { + + /** + * Constructs a new ExportDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IExportDocumentsRequest); + + /** ExportDocumentsRequest name. */ + public name: string; + + /** ExportDocumentsRequest collectionIds. */ + public collectionIds: string[]; + + /** ExportDocumentsRequest outputUriPrefix. */ + public outputUriPrefix: string; + + /** ExportDocumentsRequest namespaceIds. */ + public namespaceIds: string[]; + + /** ExportDocumentsRequest snapshotTime. */ + public snapshotTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ExportDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportDocumentsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IExportDocumentsRequest): google.firestore.admin.v1.ExportDocumentsRequest; + + /** + * Encodes the specified ExportDocumentsRequest message. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsRequest.verify|verify} messages. + * @param message ExportDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IExportDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsRequest.verify|verify} messages. + * @param message ExportDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IExportDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ExportDocumentsRequest; + + /** + * Decodes an ExportDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ExportDocumentsRequest; + + /** + * Verifies an ExportDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ExportDocumentsRequest; + + /** + * Creates a plain object from an ExportDocumentsRequest message. Also converts values to other types if specified. + * @param message ExportDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ExportDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportDocumentsRequest. */ + interface IImportDocumentsRequest { + + /** ImportDocumentsRequest name */ + name?: (string|null); + + /** ImportDocumentsRequest collectionIds */ + collectionIds?: (string[]|null); + + /** ImportDocumentsRequest inputUriPrefix */ + inputUriPrefix?: (string|null); + + /** ImportDocumentsRequest namespaceIds */ + namespaceIds?: (string[]|null); + } + + /** Represents an ImportDocumentsRequest. */ + class ImportDocumentsRequest implements IImportDocumentsRequest { + + /** + * Constructs a new ImportDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IImportDocumentsRequest); + + /** ImportDocumentsRequest name. */ + public name: string; + + /** ImportDocumentsRequest collectionIds. */ + public collectionIds: string[]; + + /** ImportDocumentsRequest inputUriPrefix. */ + public inputUriPrefix: string; + + /** ImportDocumentsRequest namespaceIds. */ + public namespaceIds: string[]; + + /** + * Creates a new ImportDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportDocumentsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IImportDocumentsRequest): google.firestore.admin.v1.ImportDocumentsRequest; + + /** + * Encodes the specified ImportDocumentsRequest message. Does not implicitly {@link google.firestore.admin.v1.ImportDocumentsRequest.verify|verify} messages. + * @param message ImportDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IImportDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ImportDocumentsRequest.verify|verify} messages. + * @param message ImportDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IImportDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ImportDocumentsRequest; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ImportDocumentsRequest; + + /** + * Verifies an ImportDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ImportDocumentsRequest; + + /** + * Creates a plain object from an ImportDocumentsRequest message. Also converts values to other types if specified. + * @param message ImportDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ImportDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BulkDeleteDocumentsRequest. */ + interface IBulkDeleteDocumentsRequest { + + /** BulkDeleteDocumentsRequest name */ + name?: (string|null); + + /** BulkDeleteDocumentsRequest collectionIds */ + collectionIds?: (string[]|null); + + /** BulkDeleteDocumentsRequest namespaceIds */ + namespaceIds?: (string[]|null); + } + + /** Represents a BulkDeleteDocumentsRequest. */ + class BulkDeleteDocumentsRequest implements IBulkDeleteDocumentsRequest { + + /** + * Constructs a new BulkDeleteDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IBulkDeleteDocumentsRequest); + + /** BulkDeleteDocumentsRequest name. */ + public name: string; + + /** BulkDeleteDocumentsRequest collectionIds. */ + public collectionIds: string[]; + + /** BulkDeleteDocumentsRequest namespaceIds. */ + public namespaceIds: string[]; + + /** + * Creates a new BulkDeleteDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BulkDeleteDocumentsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IBulkDeleteDocumentsRequest): google.firestore.admin.v1.BulkDeleteDocumentsRequest; + + /** + * Encodes the specified BulkDeleteDocumentsRequest message. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsRequest.verify|verify} messages. + * @param message BulkDeleteDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IBulkDeleteDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BulkDeleteDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsRequest.verify|verify} messages. + * @param message BulkDeleteDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IBulkDeleteDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BulkDeleteDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BulkDeleteDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.BulkDeleteDocumentsRequest; + + /** + * Decodes a BulkDeleteDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BulkDeleteDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.BulkDeleteDocumentsRequest; + + /** + * Verifies a BulkDeleteDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BulkDeleteDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BulkDeleteDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.BulkDeleteDocumentsRequest; + + /** + * Creates a plain object from a BulkDeleteDocumentsRequest message. Also converts values to other types if specified. + * @param message BulkDeleteDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.BulkDeleteDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BulkDeleteDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BulkDeleteDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BulkDeleteDocumentsResponse. */ + interface IBulkDeleteDocumentsResponse { + } + + /** Represents a BulkDeleteDocumentsResponse. */ + class BulkDeleteDocumentsResponse implements IBulkDeleteDocumentsResponse { + + /** + * Constructs a new BulkDeleteDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IBulkDeleteDocumentsResponse); + + /** + * Creates a new BulkDeleteDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BulkDeleteDocumentsResponse instance + */ + public static create(properties?: google.firestore.admin.v1.IBulkDeleteDocumentsResponse): google.firestore.admin.v1.BulkDeleteDocumentsResponse; + + /** + * Encodes the specified BulkDeleteDocumentsResponse message. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsResponse.verify|verify} messages. + * @param message BulkDeleteDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IBulkDeleteDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BulkDeleteDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsResponse.verify|verify} messages. + * @param message BulkDeleteDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IBulkDeleteDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BulkDeleteDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BulkDeleteDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.BulkDeleteDocumentsResponse; + + /** + * Decodes a BulkDeleteDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BulkDeleteDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.BulkDeleteDocumentsResponse; + + /** + * Verifies a BulkDeleteDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BulkDeleteDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BulkDeleteDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.BulkDeleteDocumentsResponse; + + /** + * Creates a plain object from a BulkDeleteDocumentsResponse message. Also converts values to other types if specified. + * @param message BulkDeleteDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.BulkDeleteDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BulkDeleteDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BulkDeleteDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetBackupRequest. */ + interface IGetBackupRequest { + + /** GetBackupRequest name */ + name?: (string|null); + } + + /** Represents a GetBackupRequest. */ + class GetBackupRequest implements IGetBackupRequest { + + /** + * Constructs a new GetBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IGetBackupRequest); + + /** GetBackupRequest name. */ + public name: string; + + /** + * Creates a new GetBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetBackupRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IGetBackupRequest): google.firestore.admin.v1.GetBackupRequest; + + /** + * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.firestore.admin.v1.GetBackupRequest.verify|verify} messages. + * @param message GetBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetBackupRequest.verify|verify} messages. + * @param message GetBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.GetBackupRequest; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.GetBackupRequest; + + /** + * Verifies a GetBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.GetBackupRequest; + + /** + * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. + * @param message GetBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.GetBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListBackupsRequest. */ + interface IListBackupsRequest { + + /** ListBackupsRequest parent */ + parent?: (string|null); + + /** ListBackupsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListBackupsRequest. */ + class ListBackupsRequest implements IListBackupsRequest { + + /** + * Constructs a new ListBackupsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListBackupsRequest); + + /** ListBackupsRequest parent. */ + public parent: string; + + /** ListBackupsRequest filter. */ + public filter: string; + + /** + * Creates a new ListBackupsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBackupsRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IListBackupsRequest): google.firestore.admin.v1.ListBackupsRequest; + + /** + * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.firestore.admin.v1.ListBackupsRequest.verify|verify} messages. + * @param message ListBackupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListBackupsRequest.verify|verify} messages. + * @param message ListBackupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListBackupsRequest; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListBackupsRequest; + + /** + * Verifies a ListBackupsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBackupsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListBackupsRequest; + + /** + * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. + * @param message ListBackupsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListBackupsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBackupsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBackupsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListBackupsResponse. */ + interface IListBackupsResponse { + + /** ListBackupsResponse backups */ + backups?: (google.firestore.admin.v1.IBackup[]|null); + + /** ListBackupsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListBackupsResponse. */ + class ListBackupsResponse implements IListBackupsResponse { + + /** + * Constructs a new ListBackupsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IListBackupsResponse); + + /** ListBackupsResponse backups. */ + public backups: google.firestore.admin.v1.IBackup[]; + + /** ListBackupsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListBackupsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBackupsResponse instance + */ + public static create(properties?: google.firestore.admin.v1.IListBackupsResponse): google.firestore.admin.v1.ListBackupsResponse; + + /** + * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.firestore.admin.v1.ListBackupsResponse.verify|verify} messages. + * @param message ListBackupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListBackupsResponse.verify|verify} messages. + * @param message ListBackupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ListBackupsResponse; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ListBackupsResponse; + + /** + * Verifies a ListBackupsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBackupsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ListBackupsResponse; + + /** + * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. + * @param message ListBackupsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ListBackupsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBackupsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBackupsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteBackupRequest. */ + interface IDeleteBackupRequest { + + /** DeleteBackupRequest name */ + name?: (string|null); + } + + /** Represents a DeleteBackupRequest. */ + class DeleteBackupRequest implements IDeleteBackupRequest { + + /** + * Constructs a new DeleteBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IDeleteBackupRequest); + + /** DeleteBackupRequest name. */ + public name: string; + + /** + * Creates a new DeleteBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteBackupRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IDeleteBackupRequest): google.firestore.admin.v1.DeleteBackupRequest; + + /** + * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteBackupRequest.verify|verify} messages. + * @param message DeleteBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteBackupRequest.verify|verify} messages. + * @param message DeleteBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.DeleteBackupRequest; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.DeleteBackupRequest; + + /** + * Verifies a DeleteBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.DeleteBackupRequest; + + /** + * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. + * @param message DeleteBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.DeleteBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RestoreDatabaseRequest. */ + interface IRestoreDatabaseRequest { + + /** RestoreDatabaseRequest parent */ + parent?: (string|null); + + /** RestoreDatabaseRequest databaseId */ + databaseId?: (string|null); + + /** RestoreDatabaseRequest backup */ + backup?: (string|null); + + /** RestoreDatabaseRequest encryptionConfig */ + encryptionConfig?: (google.firestore.admin.v1.Database.IEncryptionConfig|null); + + /** RestoreDatabaseRequest tags */ + tags?: ({ [k: string]: string }|null); + } + + /** Represents a RestoreDatabaseRequest. */ + class RestoreDatabaseRequest implements IRestoreDatabaseRequest { + + /** + * Constructs a new RestoreDatabaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IRestoreDatabaseRequest); + + /** RestoreDatabaseRequest parent. */ + public parent: string; + + /** RestoreDatabaseRequest databaseId. */ + public databaseId: string; + + /** RestoreDatabaseRequest backup. */ + public backup: string; + + /** RestoreDatabaseRequest encryptionConfig. */ + public encryptionConfig?: (google.firestore.admin.v1.Database.IEncryptionConfig|null); + + /** RestoreDatabaseRequest tags. */ + public tags: { [k: string]: string }; + + /** + * Creates a new RestoreDatabaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RestoreDatabaseRequest instance + */ + public static create(properties?: google.firestore.admin.v1.IRestoreDatabaseRequest): google.firestore.admin.v1.RestoreDatabaseRequest; + + /** + * Encodes the specified RestoreDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.RestoreDatabaseRequest.verify|verify} messages. + * @param message RestoreDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IRestoreDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RestoreDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.RestoreDatabaseRequest.verify|verify} messages. + * @param message RestoreDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IRestoreDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RestoreDatabaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RestoreDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.RestoreDatabaseRequest; + + /** + * Decodes a RestoreDatabaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RestoreDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.RestoreDatabaseRequest; + + /** + * Verifies a RestoreDatabaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RestoreDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RestoreDatabaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.RestoreDatabaseRequest; + + /** + * Creates a plain object from a RestoreDatabaseRequest message. Also converts values to other types if specified. + * @param message RestoreDatabaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.RestoreDatabaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RestoreDatabaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RestoreDatabaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CloneDatabaseRequest. */ + interface ICloneDatabaseRequest { + + /** CloneDatabaseRequest parent */ + parent?: (string|null); + + /** CloneDatabaseRequest databaseId */ + databaseId?: (string|null); + + /** CloneDatabaseRequest pitrSnapshot */ + pitrSnapshot?: (google.firestore.admin.v1.IPitrSnapshot|null); + + /** CloneDatabaseRequest encryptionConfig */ + encryptionConfig?: (google.firestore.admin.v1.Database.IEncryptionConfig|null); + + /** CloneDatabaseRequest tags */ + tags?: ({ [k: string]: string }|null); + } + + /** Represents a CloneDatabaseRequest. */ + class CloneDatabaseRequest implements ICloneDatabaseRequest { + + /** + * Constructs a new CloneDatabaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.ICloneDatabaseRequest); + + /** CloneDatabaseRequest parent. */ + public parent: string; + + /** CloneDatabaseRequest databaseId. */ + public databaseId: string; + + /** CloneDatabaseRequest pitrSnapshot. */ + public pitrSnapshot?: (google.firestore.admin.v1.IPitrSnapshot|null); + + /** CloneDatabaseRequest encryptionConfig. */ + public encryptionConfig?: (google.firestore.admin.v1.Database.IEncryptionConfig|null); + + /** CloneDatabaseRequest tags. */ + public tags: { [k: string]: string }; + + /** + * Creates a new CloneDatabaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CloneDatabaseRequest instance + */ + public static create(properties?: google.firestore.admin.v1.ICloneDatabaseRequest): google.firestore.admin.v1.CloneDatabaseRequest; + + /** + * Encodes the specified CloneDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.CloneDatabaseRequest.verify|verify} messages. + * @param message CloneDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.ICloneDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloneDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CloneDatabaseRequest.verify|verify} messages. + * @param message CloneDatabaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.ICloneDatabaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloneDatabaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloneDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.CloneDatabaseRequest; + + /** + * Decodes a CloneDatabaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloneDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.CloneDatabaseRequest; + + /** + * Verifies a CloneDatabaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloneDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloneDatabaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.CloneDatabaseRequest; + + /** + * Creates a plain object from a CloneDatabaseRequest message. Also converts values to other types if specified. + * @param message CloneDatabaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.CloneDatabaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloneDatabaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloneDatabaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an IndexOperationMetadata. */ + interface IIndexOperationMetadata { + + /** IndexOperationMetadata startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** IndexOperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** IndexOperationMetadata index */ + index?: (string|null); + + /** IndexOperationMetadata state */ + state?: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState|null); + + /** IndexOperationMetadata progressDocuments */ + progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** IndexOperationMetadata progressBytes */ + progressBytes?: (google.firestore.admin.v1.IProgress|null); + } + + /** Represents an IndexOperationMetadata. */ + class IndexOperationMetadata implements IIndexOperationMetadata { + + /** + * Constructs a new IndexOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IIndexOperationMetadata); + + /** IndexOperationMetadata startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** IndexOperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** IndexOperationMetadata index. */ + public index: string; + + /** IndexOperationMetadata state. */ + public state: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState); + + /** IndexOperationMetadata progressDocuments. */ + public progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** IndexOperationMetadata progressBytes. */ + public progressBytes?: (google.firestore.admin.v1.IProgress|null); + + /** + * Creates a new IndexOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns IndexOperationMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.IIndexOperationMetadata): google.firestore.admin.v1.IndexOperationMetadata; + + /** + * Encodes the specified IndexOperationMetadata message. Does not implicitly {@link google.firestore.admin.v1.IndexOperationMetadata.verify|verify} messages. + * @param message IndexOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IIndexOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IndexOperationMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.IndexOperationMetadata.verify|verify} messages. + * @param message IndexOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IIndexOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IndexOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IndexOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.IndexOperationMetadata; + + /** + * Decodes an IndexOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IndexOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.IndexOperationMetadata; + + /** + * Verifies an IndexOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IndexOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IndexOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.IndexOperationMetadata; + + /** + * Creates a plain object from an IndexOperationMetadata message. Also converts values to other types if specified. + * @param message IndexOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.IndexOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IndexOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IndexOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldOperationMetadata. */ + interface IFieldOperationMetadata { + + /** FieldOperationMetadata startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** FieldOperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** FieldOperationMetadata field */ + field?: (string|null); + + /** FieldOperationMetadata indexConfigDeltas */ + indexConfigDeltas?: (google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta[]|null); + + /** FieldOperationMetadata state */ + state?: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState|null); + + /** FieldOperationMetadata progressDocuments */ + progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** FieldOperationMetadata progressBytes */ + progressBytes?: (google.firestore.admin.v1.IProgress|null); + + /** FieldOperationMetadata ttlConfigDelta */ + ttlConfigDelta?: (google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta|null); + } + + /** Represents a FieldOperationMetadata. */ + class FieldOperationMetadata implements IFieldOperationMetadata { + + /** + * Constructs a new FieldOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IFieldOperationMetadata); + + /** FieldOperationMetadata startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** FieldOperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** FieldOperationMetadata field. */ + public field: string; + + /** FieldOperationMetadata indexConfigDeltas. */ + public indexConfigDeltas: google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta[]; + + /** FieldOperationMetadata state. */ + public state: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState); + + /** FieldOperationMetadata progressDocuments. */ + public progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** FieldOperationMetadata progressBytes. */ + public progressBytes?: (google.firestore.admin.v1.IProgress|null); + + /** FieldOperationMetadata ttlConfigDelta. */ + public ttlConfigDelta?: (google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta|null); + + /** + * Creates a new FieldOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldOperationMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.IFieldOperationMetadata): google.firestore.admin.v1.FieldOperationMetadata; + + /** + * Encodes the specified FieldOperationMetadata message. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.verify|verify} messages. + * @param message FieldOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IFieldOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldOperationMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.verify|verify} messages. + * @param message FieldOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IFieldOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.FieldOperationMetadata; + + /** + * Decodes a FieldOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.FieldOperationMetadata; + + /** + * Verifies a FieldOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.FieldOperationMetadata; + + /** + * Creates a plain object from a FieldOperationMetadata message. Also converts values to other types if specified. + * @param message FieldOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.FieldOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldOperationMetadata { + + /** Properties of an IndexConfigDelta. */ + interface IIndexConfigDelta { + + /** IndexConfigDelta changeType */ + changeType?: (google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType|keyof typeof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType|null); + + /** IndexConfigDelta index */ + index?: (google.firestore.admin.v1.IIndex|null); + } + + /** Represents an IndexConfigDelta. */ + class IndexConfigDelta implements IIndexConfigDelta { + + /** + * Constructs a new IndexConfigDelta. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta); + + /** IndexConfigDelta changeType. */ + public changeType: (google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType|keyof typeof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType); + + /** IndexConfigDelta index. */ + public index?: (google.firestore.admin.v1.IIndex|null); + + /** + * Creates a new IndexConfigDelta instance using the specified properties. + * @param [properties] Properties to set + * @returns IndexConfigDelta instance + */ + public static create(properties?: google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta): google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta; + + /** + * Encodes the specified IndexConfigDelta message. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.verify|verify} messages. + * @param message IndexConfigDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IndexConfigDelta message, length delimited. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.verify|verify} messages. + * @param message IndexConfigDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IndexConfigDelta message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IndexConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta; + + /** + * Decodes an IndexConfigDelta message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IndexConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta; + + /** + * Verifies an IndexConfigDelta message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IndexConfigDelta message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IndexConfigDelta + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta; + + /** + * Creates a plain object from an IndexConfigDelta message. Also converts values to other types if specified. + * @param message IndexConfigDelta + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IndexConfigDelta to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IndexConfigDelta + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace IndexConfigDelta { + + /** ChangeType enum. */ + enum ChangeType { + CHANGE_TYPE_UNSPECIFIED = 0, + ADD = 1, + REMOVE = 2 + } + } + + /** Properties of a TtlConfigDelta. */ + interface ITtlConfigDelta { + + /** TtlConfigDelta changeType */ + changeType?: (google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType|keyof typeof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType|null); + + /** TtlConfigDelta expirationOffset */ + expirationOffset?: (google.protobuf.IDuration|null); + } + + /** Represents a TtlConfigDelta. */ + class TtlConfigDelta implements ITtlConfigDelta { + + /** + * Constructs a new TtlConfigDelta. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta); + + /** TtlConfigDelta changeType. */ + public changeType: (google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType|keyof typeof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType); + + /** TtlConfigDelta expirationOffset. */ + public expirationOffset?: (google.protobuf.IDuration|null); + + /** + * Creates a new TtlConfigDelta instance using the specified properties. + * @param [properties] Properties to set + * @returns TtlConfigDelta instance + */ + public static create(properties?: google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta): google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta; + + /** + * Encodes the specified TtlConfigDelta message. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.verify|verify} messages. + * @param message TtlConfigDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TtlConfigDelta message, length delimited. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.verify|verify} messages. + * @param message TtlConfigDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TtlConfigDelta message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TtlConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta; + + /** + * Decodes a TtlConfigDelta message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TtlConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta; + + /** + * Verifies a TtlConfigDelta message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TtlConfigDelta message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TtlConfigDelta + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta; + + /** + * Creates a plain object from a TtlConfigDelta message. Also converts values to other types if specified. + * @param message TtlConfigDelta + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TtlConfigDelta to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TtlConfigDelta + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TtlConfigDelta { + + /** ChangeType enum. */ + enum ChangeType { + CHANGE_TYPE_UNSPECIFIED = 0, + ADD = 1, + REMOVE = 2 + } + } + } + + /** Properties of an ExportDocumentsMetadata. */ + interface IExportDocumentsMetadata { + + /** ExportDocumentsMetadata startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** ExportDocumentsMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** ExportDocumentsMetadata operationState */ + operationState?: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState|null); + + /** ExportDocumentsMetadata progressDocuments */ + progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** ExportDocumentsMetadata progressBytes */ + progressBytes?: (google.firestore.admin.v1.IProgress|null); + + /** ExportDocumentsMetadata collectionIds */ + collectionIds?: (string[]|null); + + /** ExportDocumentsMetadata outputUriPrefix */ + outputUriPrefix?: (string|null); + + /** ExportDocumentsMetadata namespaceIds */ + namespaceIds?: (string[]|null); + + /** ExportDocumentsMetadata snapshotTime */ + snapshotTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an ExportDocumentsMetadata. */ + class ExportDocumentsMetadata implements IExportDocumentsMetadata { + + /** + * Constructs a new ExportDocumentsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IExportDocumentsMetadata); + + /** ExportDocumentsMetadata startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** ExportDocumentsMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** ExportDocumentsMetadata operationState. */ + public operationState: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState); + + /** ExportDocumentsMetadata progressDocuments. */ + public progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** ExportDocumentsMetadata progressBytes. */ + public progressBytes?: (google.firestore.admin.v1.IProgress|null); + + /** ExportDocumentsMetadata collectionIds. */ + public collectionIds: string[]; + + /** ExportDocumentsMetadata outputUriPrefix. */ + public outputUriPrefix: string; + + /** ExportDocumentsMetadata namespaceIds. */ + public namespaceIds: string[]; + + /** ExportDocumentsMetadata snapshotTime. */ + public snapshotTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ExportDocumentsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportDocumentsMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.IExportDocumentsMetadata): google.firestore.admin.v1.ExportDocumentsMetadata; + + /** + * Encodes the specified ExportDocumentsMetadata message. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsMetadata.verify|verify} messages. + * @param message ExportDocumentsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IExportDocumentsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportDocumentsMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsMetadata.verify|verify} messages. + * @param message ExportDocumentsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IExportDocumentsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportDocumentsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ExportDocumentsMetadata; + + /** + * Decodes an ExportDocumentsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ExportDocumentsMetadata; + + /** + * Verifies an ExportDocumentsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportDocumentsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportDocumentsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ExportDocumentsMetadata; + + /** + * Creates a plain object from an ExportDocumentsMetadata message. Also converts values to other types if specified. + * @param message ExportDocumentsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ExportDocumentsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportDocumentsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportDocumentsMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportDocumentsMetadata. */ + interface IImportDocumentsMetadata { + + /** ImportDocumentsMetadata startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** ImportDocumentsMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** ImportDocumentsMetadata operationState */ + operationState?: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState|null); + + /** ImportDocumentsMetadata progressDocuments */ + progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** ImportDocumentsMetadata progressBytes */ + progressBytes?: (google.firestore.admin.v1.IProgress|null); + + /** ImportDocumentsMetadata collectionIds */ + collectionIds?: (string[]|null); + + /** ImportDocumentsMetadata inputUriPrefix */ + inputUriPrefix?: (string|null); + + /** ImportDocumentsMetadata namespaceIds */ + namespaceIds?: (string[]|null); + } + + /** Represents an ImportDocumentsMetadata. */ + class ImportDocumentsMetadata implements IImportDocumentsMetadata { + + /** + * Constructs a new ImportDocumentsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IImportDocumentsMetadata); + + /** ImportDocumentsMetadata startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** ImportDocumentsMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** ImportDocumentsMetadata operationState. */ + public operationState: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState); + + /** ImportDocumentsMetadata progressDocuments. */ + public progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** ImportDocumentsMetadata progressBytes. */ + public progressBytes?: (google.firestore.admin.v1.IProgress|null); + + /** ImportDocumentsMetadata collectionIds. */ + public collectionIds: string[]; + + /** ImportDocumentsMetadata inputUriPrefix. */ + public inputUriPrefix: string; + + /** ImportDocumentsMetadata namespaceIds. */ + public namespaceIds: string[]; + + /** + * Creates a new ImportDocumentsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportDocumentsMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.IImportDocumentsMetadata): google.firestore.admin.v1.ImportDocumentsMetadata; + + /** + * Encodes the specified ImportDocumentsMetadata message. Does not implicitly {@link google.firestore.admin.v1.ImportDocumentsMetadata.verify|verify} messages. + * @param message ImportDocumentsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IImportDocumentsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportDocumentsMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ImportDocumentsMetadata.verify|verify} messages. + * @param message ImportDocumentsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IImportDocumentsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportDocumentsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ImportDocumentsMetadata; + + /** + * Decodes an ImportDocumentsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ImportDocumentsMetadata; + + /** + * Verifies an ImportDocumentsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportDocumentsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportDocumentsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ImportDocumentsMetadata; + + /** + * Creates a plain object from an ImportDocumentsMetadata message. Also converts values to other types if specified. + * @param message ImportDocumentsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ImportDocumentsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportDocumentsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportDocumentsMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BulkDeleteDocumentsMetadata. */ + interface IBulkDeleteDocumentsMetadata { + + /** BulkDeleteDocumentsMetadata startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** BulkDeleteDocumentsMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** BulkDeleteDocumentsMetadata operationState */ + operationState?: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState|null); + + /** BulkDeleteDocumentsMetadata progressDocuments */ + progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** BulkDeleteDocumentsMetadata progressBytes */ + progressBytes?: (google.firestore.admin.v1.IProgress|null); + + /** BulkDeleteDocumentsMetadata collectionIds */ + collectionIds?: (string[]|null); + + /** BulkDeleteDocumentsMetadata namespaceIds */ + namespaceIds?: (string[]|null); + + /** BulkDeleteDocumentsMetadata snapshotTime */ + snapshotTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BulkDeleteDocumentsMetadata. */ + class BulkDeleteDocumentsMetadata implements IBulkDeleteDocumentsMetadata { + + /** + * Constructs a new BulkDeleteDocumentsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IBulkDeleteDocumentsMetadata); + + /** BulkDeleteDocumentsMetadata startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** BulkDeleteDocumentsMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** BulkDeleteDocumentsMetadata operationState. */ + public operationState: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState); + + /** BulkDeleteDocumentsMetadata progressDocuments. */ + public progressDocuments?: (google.firestore.admin.v1.IProgress|null); + + /** BulkDeleteDocumentsMetadata progressBytes. */ + public progressBytes?: (google.firestore.admin.v1.IProgress|null); + + /** BulkDeleteDocumentsMetadata collectionIds. */ + public collectionIds: string[]; + + /** BulkDeleteDocumentsMetadata namespaceIds. */ + public namespaceIds: string[]; + + /** BulkDeleteDocumentsMetadata snapshotTime. */ + public snapshotTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BulkDeleteDocumentsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BulkDeleteDocumentsMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.IBulkDeleteDocumentsMetadata): google.firestore.admin.v1.BulkDeleteDocumentsMetadata; + + /** + * Encodes the specified BulkDeleteDocumentsMetadata message. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsMetadata.verify|verify} messages. + * @param message BulkDeleteDocumentsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IBulkDeleteDocumentsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BulkDeleteDocumentsMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsMetadata.verify|verify} messages. + * @param message BulkDeleteDocumentsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IBulkDeleteDocumentsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BulkDeleteDocumentsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BulkDeleteDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.BulkDeleteDocumentsMetadata; + + /** + * Decodes a BulkDeleteDocumentsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BulkDeleteDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.BulkDeleteDocumentsMetadata; + + /** + * Verifies a BulkDeleteDocumentsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BulkDeleteDocumentsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BulkDeleteDocumentsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.BulkDeleteDocumentsMetadata; + + /** + * Creates a plain object from a BulkDeleteDocumentsMetadata message. Also converts values to other types if specified. + * @param message BulkDeleteDocumentsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.BulkDeleteDocumentsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BulkDeleteDocumentsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BulkDeleteDocumentsMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportDocumentsResponse. */ + interface IExportDocumentsResponse { + + /** ExportDocumentsResponse outputUriPrefix */ + outputUriPrefix?: (string|null); + } + + /** Represents an ExportDocumentsResponse. */ + class ExportDocumentsResponse implements IExportDocumentsResponse { + + /** + * Constructs a new ExportDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IExportDocumentsResponse); + + /** ExportDocumentsResponse outputUriPrefix. */ + public outputUriPrefix: string; + + /** + * Creates a new ExportDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportDocumentsResponse instance + */ + public static create(properties?: google.firestore.admin.v1.IExportDocumentsResponse): google.firestore.admin.v1.ExportDocumentsResponse; + + /** + * Encodes the specified ExportDocumentsResponse message. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsResponse.verify|verify} messages. + * @param message ExportDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IExportDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsResponse.verify|verify} messages. + * @param message ExportDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IExportDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.ExportDocumentsResponse; + + /** + * Decodes an ExportDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.ExportDocumentsResponse; + + /** + * Verifies an ExportDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.ExportDocumentsResponse; + + /** + * Creates a plain object from an ExportDocumentsResponse message. Also converts values to other types if specified. + * @param message ExportDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.ExportDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RestoreDatabaseMetadata. */ + interface IRestoreDatabaseMetadata { + + /** RestoreDatabaseMetadata startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** RestoreDatabaseMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** RestoreDatabaseMetadata operationState */ + operationState?: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState|null); + + /** RestoreDatabaseMetadata database */ + database?: (string|null); + + /** RestoreDatabaseMetadata backup */ + backup?: (string|null); + + /** RestoreDatabaseMetadata progressPercentage */ + progressPercentage?: (google.firestore.admin.v1.IProgress|null); + } + + /** Represents a RestoreDatabaseMetadata. */ + class RestoreDatabaseMetadata implements IRestoreDatabaseMetadata { + + /** + * Constructs a new RestoreDatabaseMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IRestoreDatabaseMetadata); + + /** RestoreDatabaseMetadata startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** RestoreDatabaseMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** RestoreDatabaseMetadata operationState. */ + public operationState: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState); + + /** RestoreDatabaseMetadata database. */ + public database: string; + + /** RestoreDatabaseMetadata backup. */ + public backup: string; + + /** RestoreDatabaseMetadata progressPercentage. */ + public progressPercentage?: (google.firestore.admin.v1.IProgress|null); + + /** + * Creates a new RestoreDatabaseMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RestoreDatabaseMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.IRestoreDatabaseMetadata): google.firestore.admin.v1.RestoreDatabaseMetadata; + + /** + * Encodes the specified RestoreDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.RestoreDatabaseMetadata.verify|verify} messages. + * @param message RestoreDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IRestoreDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RestoreDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.RestoreDatabaseMetadata.verify|verify} messages. + * @param message RestoreDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IRestoreDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RestoreDatabaseMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RestoreDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.RestoreDatabaseMetadata; + + /** + * Decodes a RestoreDatabaseMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RestoreDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.RestoreDatabaseMetadata; + + /** + * Verifies a RestoreDatabaseMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RestoreDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RestoreDatabaseMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.RestoreDatabaseMetadata; + + /** + * Creates a plain object from a RestoreDatabaseMetadata message. Also converts values to other types if specified. + * @param message RestoreDatabaseMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.RestoreDatabaseMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RestoreDatabaseMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RestoreDatabaseMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CloneDatabaseMetadata. */ + interface ICloneDatabaseMetadata { + + /** CloneDatabaseMetadata startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** CloneDatabaseMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** CloneDatabaseMetadata operationState */ + operationState?: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState|null); + + /** CloneDatabaseMetadata database */ + database?: (string|null); + + /** CloneDatabaseMetadata pitrSnapshot */ + pitrSnapshot?: (google.firestore.admin.v1.IPitrSnapshot|null); + + /** CloneDatabaseMetadata progressPercentage */ + progressPercentage?: (google.firestore.admin.v1.IProgress|null); + } + + /** Represents a CloneDatabaseMetadata. */ + class CloneDatabaseMetadata implements ICloneDatabaseMetadata { + + /** + * Constructs a new CloneDatabaseMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.ICloneDatabaseMetadata); + + /** CloneDatabaseMetadata startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** CloneDatabaseMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** CloneDatabaseMetadata operationState. */ + public operationState: (google.firestore.admin.v1.OperationState|keyof typeof google.firestore.admin.v1.OperationState); + + /** CloneDatabaseMetadata database. */ + public database: string; + + /** CloneDatabaseMetadata pitrSnapshot. */ + public pitrSnapshot?: (google.firestore.admin.v1.IPitrSnapshot|null); + + /** CloneDatabaseMetadata progressPercentage. */ + public progressPercentage?: (google.firestore.admin.v1.IProgress|null); + + /** + * Creates a new CloneDatabaseMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CloneDatabaseMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.ICloneDatabaseMetadata): google.firestore.admin.v1.CloneDatabaseMetadata; + + /** + * Encodes the specified CloneDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.CloneDatabaseMetadata.verify|verify} messages. + * @param message CloneDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.ICloneDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloneDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CloneDatabaseMetadata.verify|verify} messages. + * @param message CloneDatabaseMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.ICloneDatabaseMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloneDatabaseMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloneDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.CloneDatabaseMetadata; + + /** + * Decodes a CloneDatabaseMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloneDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.CloneDatabaseMetadata; + + /** + * Verifies a CloneDatabaseMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloneDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloneDatabaseMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.CloneDatabaseMetadata; + + /** + * Creates a plain object from a CloneDatabaseMetadata message. Also converts values to other types if specified. + * @param message CloneDatabaseMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.CloneDatabaseMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloneDatabaseMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloneDatabaseMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Progress. */ + interface IProgress { + + /** Progress estimatedWork */ + estimatedWork?: (number|Long|string|null); + + /** Progress completedWork */ + completedWork?: (number|Long|string|null); + } + + /** Represents a Progress. */ + class Progress implements IProgress { + + /** + * Constructs a new Progress. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IProgress); + + /** Progress estimatedWork. */ + public estimatedWork: (number|Long|string); + + /** Progress completedWork. */ + public completedWork: (number|Long|string); + + /** + * Creates a new Progress instance using the specified properties. + * @param [properties] Properties to set + * @returns Progress instance + */ + public static create(properties?: google.firestore.admin.v1.IProgress): google.firestore.admin.v1.Progress; + + /** + * Encodes the specified Progress message. Does not implicitly {@link google.firestore.admin.v1.Progress.verify|verify} messages. + * @param message Progress message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IProgress, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Progress message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Progress.verify|verify} messages. + * @param message Progress message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IProgress, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Progress message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Progress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.Progress; + + /** + * Decodes a Progress message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Progress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.Progress; + + /** + * Verifies a Progress message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Progress message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Progress + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.Progress; + + /** + * Creates a plain object from a Progress message. Also converts values to other types if specified. + * @param message Progress + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.Progress, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Progress to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Progress + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** OperationState enum. */ + enum OperationState { + OPERATION_STATE_UNSPECIFIED = 0, + INITIALIZING = 1, + PROCESSING = 2, + CANCELLING = 3, + FINALIZING = 4, + SUCCESSFUL = 5, + FAILED = 6, + CANCELLED = 7 + } + + /** Properties of a PitrSnapshot. */ + interface IPitrSnapshot { + + /** PitrSnapshot database */ + database?: (string|null); + + /** PitrSnapshot databaseUid */ + databaseUid?: (Uint8Array|Buffer|string|null); + + /** PitrSnapshot snapshotTime */ + snapshotTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a PitrSnapshot. */ + class PitrSnapshot implements IPitrSnapshot { + + /** + * Constructs a new PitrSnapshot. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IPitrSnapshot); + + /** PitrSnapshot database. */ + public database: string; + + /** PitrSnapshot databaseUid. */ + public databaseUid: (Uint8Array|Buffer|string); + + /** PitrSnapshot snapshotTime. */ + public snapshotTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new PitrSnapshot instance using the specified properties. + * @param [properties] Properties to set + * @returns PitrSnapshot instance + */ + public static create(properties?: google.firestore.admin.v1.IPitrSnapshot): google.firestore.admin.v1.PitrSnapshot; + + /** + * Encodes the specified PitrSnapshot message. Does not implicitly {@link google.firestore.admin.v1.PitrSnapshot.verify|verify} messages. + * @param message PitrSnapshot message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IPitrSnapshot, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PitrSnapshot message, length delimited. Does not implicitly {@link google.firestore.admin.v1.PitrSnapshot.verify|verify} messages. + * @param message PitrSnapshot message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IPitrSnapshot, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PitrSnapshot message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PitrSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.PitrSnapshot; + + /** + * Decodes a PitrSnapshot message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PitrSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.PitrSnapshot; + + /** + * Verifies a PitrSnapshot message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PitrSnapshot message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PitrSnapshot + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.PitrSnapshot; + + /** + * Creates a plain object from a PitrSnapshot message. Also converts values to other types if specified. + * @param message PitrSnapshot + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.PitrSnapshot, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PitrSnapshot to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PitrSnapshot + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupSchedule. */ + interface IBackupSchedule { + + /** BackupSchedule name */ + name?: (string|null); + + /** BackupSchedule createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** BackupSchedule updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** BackupSchedule retention */ + retention?: (google.protobuf.IDuration|null); + + /** BackupSchedule dailyRecurrence */ + dailyRecurrence?: (google.firestore.admin.v1.IDailyRecurrence|null); + + /** BackupSchedule weeklyRecurrence */ + weeklyRecurrence?: (google.firestore.admin.v1.IWeeklyRecurrence|null); + } + + /** Represents a BackupSchedule. */ + class BackupSchedule implements IBackupSchedule { + + /** + * Constructs a new BackupSchedule. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IBackupSchedule); + + /** BackupSchedule name. */ + public name: string; + + /** BackupSchedule createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** BackupSchedule updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** BackupSchedule retention. */ + public retention?: (google.protobuf.IDuration|null); + + /** BackupSchedule dailyRecurrence. */ + public dailyRecurrence?: (google.firestore.admin.v1.IDailyRecurrence|null); + + /** BackupSchedule weeklyRecurrence. */ + public weeklyRecurrence?: (google.firestore.admin.v1.IWeeklyRecurrence|null); + + /** BackupSchedule recurrence. */ + public recurrence?: ("dailyRecurrence"|"weeklyRecurrence"); + + /** + * Creates a new BackupSchedule instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupSchedule instance + */ + public static create(properties?: google.firestore.admin.v1.IBackupSchedule): google.firestore.admin.v1.BackupSchedule; + + /** + * Encodes the specified BackupSchedule message. Does not implicitly {@link google.firestore.admin.v1.BackupSchedule.verify|verify} messages. + * @param message BackupSchedule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IBackupSchedule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupSchedule message, length delimited. Does not implicitly {@link google.firestore.admin.v1.BackupSchedule.verify|verify} messages. + * @param message BackupSchedule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IBackupSchedule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupSchedule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupSchedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.BackupSchedule; + + /** + * Decodes a BackupSchedule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupSchedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.BackupSchedule; + + /** + * Verifies a BackupSchedule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupSchedule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupSchedule + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.BackupSchedule; + + /** + * Creates a plain object from a BackupSchedule message. Also converts values to other types if specified. + * @param message BackupSchedule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.BackupSchedule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupSchedule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupSchedule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DailyRecurrence. */ + interface IDailyRecurrence { + } + + /** Represents a DailyRecurrence. */ + class DailyRecurrence implements IDailyRecurrence { + + /** + * Constructs a new DailyRecurrence. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IDailyRecurrence); + + /** + * Creates a new DailyRecurrence instance using the specified properties. + * @param [properties] Properties to set + * @returns DailyRecurrence instance + */ + public static create(properties?: google.firestore.admin.v1.IDailyRecurrence): google.firestore.admin.v1.DailyRecurrence; + + /** + * Encodes the specified DailyRecurrence message. Does not implicitly {@link google.firestore.admin.v1.DailyRecurrence.verify|verify} messages. + * @param message DailyRecurrence message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IDailyRecurrence, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DailyRecurrence message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DailyRecurrence.verify|verify} messages. + * @param message DailyRecurrence message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IDailyRecurrence, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DailyRecurrence message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DailyRecurrence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.DailyRecurrence; + + /** + * Decodes a DailyRecurrence message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DailyRecurrence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.DailyRecurrence; + + /** + * Verifies a DailyRecurrence message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DailyRecurrence message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DailyRecurrence + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.DailyRecurrence; + + /** + * Creates a plain object from a DailyRecurrence message. Also converts values to other types if specified. + * @param message DailyRecurrence + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.DailyRecurrence, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DailyRecurrence to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DailyRecurrence + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WeeklyRecurrence. */ + interface IWeeklyRecurrence { + + /** WeeklyRecurrence day */ + day?: (google.type.DayOfWeek|keyof typeof google.type.DayOfWeek|null); + } + + /** Represents a WeeklyRecurrence. */ + class WeeklyRecurrence implements IWeeklyRecurrence { + + /** + * Constructs a new WeeklyRecurrence. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IWeeklyRecurrence); + + /** WeeklyRecurrence day. */ + public day: (google.type.DayOfWeek|keyof typeof google.type.DayOfWeek); + + /** + * Creates a new WeeklyRecurrence instance using the specified properties. + * @param [properties] Properties to set + * @returns WeeklyRecurrence instance + */ + public static create(properties?: google.firestore.admin.v1.IWeeklyRecurrence): google.firestore.admin.v1.WeeklyRecurrence; + + /** + * Encodes the specified WeeklyRecurrence message. Does not implicitly {@link google.firestore.admin.v1.WeeklyRecurrence.verify|verify} messages. + * @param message WeeklyRecurrence message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IWeeklyRecurrence, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WeeklyRecurrence message, length delimited. Does not implicitly {@link google.firestore.admin.v1.WeeklyRecurrence.verify|verify} messages. + * @param message WeeklyRecurrence message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IWeeklyRecurrence, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WeeklyRecurrence message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WeeklyRecurrence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.WeeklyRecurrence; + + /** + * Decodes a WeeklyRecurrence message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WeeklyRecurrence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.WeeklyRecurrence; + + /** + * Verifies a WeeklyRecurrence message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WeeklyRecurrence message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WeeklyRecurrence + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.WeeklyRecurrence; + + /** + * Creates a plain object from a WeeklyRecurrence message. Also converts values to other types if specified. + * @param message WeeklyRecurrence + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.WeeklyRecurrence, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WeeklyRecurrence to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WeeklyRecurrence + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UserCreds. */ + interface IUserCreds { + + /** UserCreds name */ + name?: (string|null); + + /** UserCreds createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** UserCreds updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** UserCreds state */ + state?: (google.firestore.admin.v1.UserCreds.State|keyof typeof google.firestore.admin.v1.UserCreds.State|null); + + /** UserCreds securePassword */ + securePassword?: (string|null); + + /** UserCreds resourceIdentity */ + resourceIdentity?: (google.firestore.admin.v1.UserCreds.IResourceIdentity|null); + } + + /** Represents a UserCreds. */ + class UserCreds implements IUserCreds { + + /** + * Constructs a new UserCreds. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.IUserCreds); + + /** UserCreds name. */ + public name: string; + + /** UserCreds createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** UserCreds updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** UserCreds state. */ + public state: (google.firestore.admin.v1.UserCreds.State|keyof typeof google.firestore.admin.v1.UserCreds.State); + + /** UserCreds securePassword. */ + public securePassword: string; + + /** UserCreds resourceIdentity. */ + public resourceIdentity?: (google.firestore.admin.v1.UserCreds.IResourceIdentity|null); + + /** UserCreds UserCredsIdentity. */ + public UserCredsIdentity?: "resourceIdentity"; + + /** + * Creates a new UserCreds instance using the specified properties. + * @param [properties] Properties to set + * @returns UserCreds instance + */ + public static create(properties?: google.firestore.admin.v1.IUserCreds): google.firestore.admin.v1.UserCreds; + + /** + * Encodes the specified UserCreds message. Does not implicitly {@link google.firestore.admin.v1.UserCreds.verify|verify} messages. + * @param message UserCreds message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.IUserCreds, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserCreds message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UserCreds.verify|verify} messages. + * @param message UserCreds message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.IUserCreds, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserCreds message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserCreds + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.UserCreds; + + /** + * Decodes a UserCreds message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserCreds + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.UserCreds; + + /** + * Verifies a UserCreds message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserCreds message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserCreds + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.UserCreds; + + /** + * Creates a plain object from a UserCreds message. Also converts values to other types if specified. + * @param message UserCreds + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.UserCreds, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserCreds to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserCreds + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UserCreds { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ENABLED = 1, + DISABLED = 2 + } + + /** Properties of a ResourceIdentity. */ + interface IResourceIdentity { + + /** ResourceIdentity principal */ + principal?: (string|null); + } + + /** Represents a ResourceIdentity. */ + class ResourceIdentity implements IResourceIdentity { + + /** + * Constructs a new ResourceIdentity. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.UserCreds.IResourceIdentity); + + /** ResourceIdentity principal. */ + public principal: string; + + /** + * Creates a new ResourceIdentity instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceIdentity instance + */ + public static create(properties?: google.firestore.admin.v1.UserCreds.IResourceIdentity): google.firestore.admin.v1.UserCreds.ResourceIdentity; + + /** + * Encodes the specified ResourceIdentity message. Does not implicitly {@link google.firestore.admin.v1.UserCreds.ResourceIdentity.verify|verify} messages. + * @param message ResourceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.UserCreds.IResourceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceIdentity message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UserCreds.ResourceIdentity.verify|verify} messages. + * @param message ResourceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.UserCreds.IResourceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceIdentity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.UserCreds.ResourceIdentity; + + /** + * Decodes a ResourceIdentity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.UserCreds.ResourceIdentity; + + /** + * Verifies a ResourceIdentity message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceIdentity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceIdentity + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.UserCreds.ResourceIdentity; + + /** + * Creates a plain object from a ResourceIdentity message. Also converts values to other types if specified. + * @param message ResourceIdentity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.UserCreds.ResourceIdentity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceIdentity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceIdentity + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a LocationMetadata. */ + interface ILocationMetadata { + } + + /** Represents a LocationMetadata. */ + class LocationMetadata implements ILocationMetadata { + + /** + * Constructs a new LocationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.admin.v1.ILocationMetadata); + + /** + * Creates a new LocationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns LocationMetadata instance + */ + public static create(properties?: google.firestore.admin.v1.ILocationMetadata): google.firestore.admin.v1.LocationMetadata; + + /** + * Encodes the specified LocationMetadata message. Does not implicitly {@link google.firestore.admin.v1.LocationMetadata.verify|verify} messages. + * @param message LocationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.admin.v1.ILocationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocationMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.LocationMetadata.verify|verify} messages. + * @param message LocationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.admin.v1.ILocationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.admin.v1.LocationMetadata; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.admin.v1.LocationMetadata; + + /** + * Verifies a LocationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.firestore.admin.v1.LocationMetadata; + + /** + * Creates a plain object from a LocationMetadata message. Also converts values to other types if specified. + * @param message LocationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.admin.v1.LocationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + + /** Namespace v1. */ + namespace v1 { + + /** Properties of an AggregationResult. */ + interface IAggregationResult { + + /** AggregationResult aggregateFields */ + aggregateFields?: ({ [k: string]: google.firestore.v1.IValue }|null); + } + + /** Represents an AggregationResult. */ + class AggregationResult implements IAggregationResult { + + /** + * Constructs a new AggregationResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IAggregationResult); + + /** AggregationResult aggregateFields. */ + public aggregateFields: { [k: string]: google.firestore.v1.IValue }; + + /** + * Creates a new AggregationResult instance using the specified properties. + * @param [properties] Properties to set + * @returns AggregationResult instance + */ + public static create(properties?: google.firestore.v1.IAggregationResult): google.firestore.v1.AggregationResult; + + /** + * Encodes the specified AggregationResult message. Does not implicitly {@link google.firestore.v1.AggregationResult.verify|verify} messages. + * @param message AggregationResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IAggregationResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AggregationResult message, length delimited. Does not implicitly {@link google.firestore.v1.AggregationResult.verify|verify} messages. + * @param message AggregationResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IAggregationResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AggregationResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AggregationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.AggregationResult; + + /** + * Decodes an AggregationResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AggregationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.AggregationResult; + + /** + * Verifies an AggregationResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AggregationResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AggregationResult + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.AggregationResult; + + /** + * Creates a plain object from an AggregationResult message. Also converts values to other types if specified. + * @param message AggregationResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.AggregationResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AggregationResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AggregationResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Document. */ + interface IDocument { + + /** Document name */ + name?: (string|null); + + /** Document fields */ + fields?: ({ [k: string]: google.firestore.v1.IValue }|null); + + /** Document createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Document updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Document. */ + class Document implements IDocument { + + /** + * Constructs a new Document. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IDocument); + + /** Document name. */ + public name: string; + + /** Document fields. */ + public fields: { [k: string]: google.firestore.v1.IValue }; + + /** Document createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Document updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Document instance using the specified properties. + * @param [properties] Properties to set + * @returns Document instance + */ + public static create(properties?: google.firestore.v1.IDocument): google.firestore.v1.Document; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.firestore.v1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.firestore.v1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Document message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Document; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Document; + + /** + * Verifies a Document message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Document + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Document; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @param message Document + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Document, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Document to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Document + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Value. */ + interface IValue { + + /** Value nullValue */ + nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value booleanValue */ + booleanValue?: (boolean|null); + + /** Value integerValue */ + integerValue?: (number|Long|string|null); + + /** Value doubleValue */ + doubleValue?: (number|null); + + /** Value timestampValue */ + timestampValue?: (google.protobuf.ITimestamp|null); + + /** Value stringValue */ + stringValue?: (string|null); + + /** Value bytesValue */ + bytesValue?: (Uint8Array|Buffer|string|null); + + /** Value referenceValue */ + referenceValue?: (string|null); + + /** Value geoPointValue */ + geoPointValue?: (google.type.ILatLng|null); + + /** Value arrayValue */ + arrayValue?: (google.firestore.v1.IArrayValue|null); + + /** Value mapValue */ + mapValue?: (google.firestore.v1.IMapValue|null); + + /** Value fieldReferenceValue */ + fieldReferenceValue?: (string|null); + + /** Value variableReferenceValue */ + variableReferenceValue?: (string|null); + + /** Value functionValue */ + functionValue?: (google.firestore.v1.IFunction|null); + + /** Value pipelineValue */ + pipelineValue?: (google.firestore.v1.IPipeline|null); + } + + /** Represents a Value. */ + class Value implements IValue { + + /** + * Constructs a new Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IValue); + + /** Value nullValue. */ + public nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value booleanValue. */ + public booleanValue?: (boolean|null); + + /** Value integerValue. */ + public integerValue?: (number|Long|string|null); + + /** Value doubleValue. */ + public doubleValue?: (number|null); + + /** Value timestampValue. */ + public timestampValue?: (google.protobuf.ITimestamp|null); + + /** Value stringValue. */ + public stringValue?: (string|null); + + /** Value bytesValue. */ + public bytesValue?: (Uint8Array|Buffer|string|null); + + /** Value referenceValue. */ + public referenceValue?: (string|null); + + /** Value geoPointValue. */ + public geoPointValue?: (google.type.ILatLng|null); + + /** Value arrayValue. */ + public arrayValue?: (google.firestore.v1.IArrayValue|null); + + /** Value mapValue. */ + public mapValue?: (google.firestore.v1.IMapValue|null); + + /** Value fieldReferenceValue. */ + public fieldReferenceValue?: (string|null); + + /** Value variableReferenceValue. */ + public variableReferenceValue?: (string|null); + + /** Value functionValue. */ + public functionValue?: (google.firestore.v1.IFunction|null); + + /** Value pipelineValue. */ + public pipelineValue?: (google.firestore.v1.IPipeline|null); + + /** Value valueType. */ + public valueType?: ("nullValue"|"booleanValue"|"integerValue"|"doubleValue"|"timestampValue"|"stringValue"|"bytesValue"|"referenceValue"|"geoPointValue"|"arrayValue"|"mapValue"|"fieldReferenceValue"|"variableReferenceValue"|"functionValue"|"pipelineValue"); + + /** + * Creates a new Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Value instance + */ + public static create(properties?: google.firestore.v1.IValue): google.firestore.v1.Value; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.firestore.v1.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.firestore.v1.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Value; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Value; + + /** + * Verifies a Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Value + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Value; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @param message Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ArrayValue. */ + interface IArrayValue { + + /** ArrayValue values */ + values?: (google.firestore.v1.IValue[]|null); + } + + /** Represents an ArrayValue. */ + class ArrayValue implements IArrayValue { + + /** + * Constructs a new ArrayValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IArrayValue); + + /** ArrayValue values. */ + public values: google.firestore.v1.IValue[]; + + /** + * Creates a new ArrayValue instance using the specified properties. + * @param [properties] Properties to set + * @returns ArrayValue instance + */ + public static create(properties?: google.firestore.v1.IArrayValue): google.firestore.v1.ArrayValue; + + /** + * Encodes the specified ArrayValue message. Does not implicitly {@link google.firestore.v1.ArrayValue.verify|verify} messages. + * @param message ArrayValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IArrayValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link google.firestore.v1.ArrayValue.verify|verify} messages. + * @param message ArrayValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IArrayValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ArrayValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ArrayValue; + + /** + * Decodes an ArrayValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ArrayValue; + + /** + * Verifies an ArrayValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ArrayValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ArrayValue + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ArrayValue; + + /** + * Creates a plain object from an ArrayValue message. Also converts values to other types if specified. + * @param message ArrayValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ArrayValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ArrayValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ArrayValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MapValue. */ + interface IMapValue { + + /** MapValue fields */ + fields?: ({ [k: string]: google.firestore.v1.IValue }|null); + } + + /** Represents a MapValue. */ + class MapValue implements IMapValue { + + /** + * Constructs a new MapValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IMapValue); + + /** MapValue fields. */ + public fields: { [k: string]: google.firestore.v1.IValue }; + + /** + * Creates a new MapValue instance using the specified properties. + * @param [properties] Properties to set + * @returns MapValue instance + */ + public static create(properties?: google.firestore.v1.IMapValue): google.firestore.v1.MapValue; + + /** + * Encodes the specified MapValue message. Does not implicitly {@link google.firestore.v1.MapValue.verify|verify} messages. + * @param message MapValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IMapValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MapValue message, length delimited. Does not implicitly {@link google.firestore.v1.MapValue.verify|verify} messages. + * @param message MapValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IMapValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MapValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MapValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.MapValue; + + /** + * Decodes a MapValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MapValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.MapValue; + + /** + * Verifies a MapValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MapValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MapValue + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.MapValue; + + /** + * Creates a plain object from a MapValue message. Also converts values to other types if specified. + * @param message MapValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.MapValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MapValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MapValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Function. */ + interface IFunction { + + /** Function name */ + name?: (string|null); + + /** Function args */ + args?: (google.firestore.v1.IValue[]|null); + + /** Function options */ + options?: ({ [k: string]: google.firestore.v1.IValue }|null); + } + + /** Represents a Function. */ + class Function implements IFunction { + + /** + * Constructs a new Function. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IFunction); + + /** Function name. */ + public name: string; + + /** Function args. */ + public args: google.firestore.v1.IValue[]; + + /** Function options. */ + public options: { [k: string]: google.firestore.v1.IValue }; + + /** + * Creates a new Function instance using the specified properties. + * @param [properties] Properties to set + * @returns Function instance + */ + public static create(properties?: google.firestore.v1.IFunction): google.firestore.v1.Function; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.firestore.v1.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.firestore.v1.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Function message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Function; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Function; + + /** + * Verifies a Function message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Function + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Function; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @param message Function + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Function, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Function to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Function + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Pipeline. */ + interface IPipeline { + + /** Pipeline stages */ + stages?: (google.firestore.v1.Pipeline.IStage[]|null); + } + + /** Represents a Pipeline. */ + class Pipeline implements IPipeline { + + /** + * Constructs a new Pipeline. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IPipeline); + + /** Pipeline stages. */ + public stages: google.firestore.v1.Pipeline.IStage[]; + + /** + * Creates a new Pipeline instance using the specified properties. + * @param [properties] Properties to set + * @returns Pipeline instance + */ + public static create(properties?: google.firestore.v1.IPipeline): google.firestore.v1.Pipeline; + + /** + * Encodes the specified Pipeline message. Does not implicitly {@link google.firestore.v1.Pipeline.verify|verify} messages. + * @param message Pipeline message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IPipeline, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Pipeline message, length delimited. Does not implicitly {@link google.firestore.v1.Pipeline.verify|verify} messages. + * @param message Pipeline message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IPipeline, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Pipeline message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Pipeline + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Pipeline; + + /** + * Decodes a Pipeline message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Pipeline + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Pipeline; + + /** + * Verifies a Pipeline message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Pipeline message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Pipeline + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Pipeline; + + /** + * Creates a plain object from a Pipeline message. Also converts values to other types if specified. + * @param message Pipeline + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Pipeline, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Pipeline to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Pipeline + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Pipeline { + + /** Properties of a Stage. */ + interface IStage { + + /** Stage name */ + name?: (string|null); + + /** Stage args */ + args?: (google.firestore.v1.IValue[]|null); + + /** Stage options */ + options?: ({ [k: string]: google.firestore.v1.IValue }|null); + } + + /** Represents a Stage. */ + class Stage implements IStage { + + /** + * Constructs a new Stage. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.Pipeline.IStage); + + /** Stage name. */ + public name: string; + + /** Stage args. */ + public args: google.firestore.v1.IValue[]; + + /** Stage options. */ + public options: { [k: string]: google.firestore.v1.IValue }; + + /** + * Creates a new Stage instance using the specified properties. + * @param [properties] Properties to set + * @returns Stage instance + */ + public static create(properties?: google.firestore.v1.Pipeline.IStage): google.firestore.v1.Pipeline.Stage; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.firestore.v1.Pipeline.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.Pipeline.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.firestore.v1.Pipeline.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.Pipeline.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Pipeline.Stage; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Pipeline.Stage; + + /** + * Verifies a Stage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Stage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Stage + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Pipeline.Stage; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @param message Stage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Pipeline.Stage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Stage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Stage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a BitSequence. */ + interface IBitSequence { + + /** BitSequence bitmap */ + bitmap?: (Uint8Array|Buffer|string|null); + + /** BitSequence padding */ + padding?: (number|null); + } + + /** Represents a BitSequence. */ + class BitSequence implements IBitSequence { + + /** + * Constructs a new BitSequence. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IBitSequence); + + /** BitSequence bitmap. */ + public bitmap: (Uint8Array|Buffer|string); + + /** BitSequence padding. */ + public padding: number; + + /** + * Creates a new BitSequence instance using the specified properties. + * @param [properties] Properties to set + * @returns BitSequence instance + */ + public static create(properties?: google.firestore.v1.IBitSequence): google.firestore.v1.BitSequence; + + /** + * Encodes the specified BitSequence message. Does not implicitly {@link google.firestore.v1.BitSequence.verify|verify} messages. + * @param message BitSequence message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IBitSequence, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BitSequence message, length delimited. Does not implicitly {@link google.firestore.v1.BitSequence.verify|verify} messages. + * @param message BitSequence message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IBitSequence, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BitSequence message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BitSequence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.BitSequence; + + /** + * Decodes a BitSequence message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BitSequence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.BitSequence; + + /** + * Verifies a BitSequence message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BitSequence message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BitSequence + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.BitSequence; + + /** + * Creates a plain object from a BitSequence message. Also converts values to other types if specified. + * @param message BitSequence + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.BitSequence, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BitSequence to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BitSequence + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BloomFilter. */ + interface IBloomFilter { + + /** BloomFilter bits */ + bits?: (google.firestore.v1.IBitSequence|null); + + /** BloomFilter hashCount */ + hashCount?: (number|null); + } + + /** Represents a BloomFilter. */ + class BloomFilter implements IBloomFilter { + + /** + * Constructs a new BloomFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IBloomFilter); + + /** BloomFilter bits. */ + public bits?: (google.firestore.v1.IBitSequence|null); + + /** BloomFilter hashCount. */ + public hashCount: number; + + /** + * Creates a new BloomFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns BloomFilter instance + */ + public static create(properties?: google.firestore.v1.IBloomFilter): google.firestore.v1.BloomFilter; + + /** + * Encodes the specified BloomFilter message. Does not implicitly {@link google.firestore.v1.BloomFilter.verify|verify} messages. + * @param message BloomFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IBloomFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BloomFilter message, length delimited. Does not implicitly {@link google.firestore.v1.BloomFilter.verify|verify} messages. + * @param message BloomFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IBloomFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BloomFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BloomFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.BloomFilter; + + /** + * Decodes a BloomFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BloomFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.BloomFilter; + + /** + * Verifies a BloomFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BloomFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BloomFilter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.BloomFilter; + + /** + * Creates a plain object from a BloomFilter message. Also converts values to other types if specified. + * @param message BloomFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.BloomFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BloomFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BloomFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentMask. */ + interface IDocumentMask { + + /** DocumentMask fieldPaths */ + fieldPaths?: (string[]|null); + } + + /** Represents a DocumentMask. */ + class DocumentMask implements IDocumentMask { + + /** + * Constructs a new DocumentMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IDocumentMask); + + /** DocumentMask fieldPaths. */ + public fieldPaths: string[]; + + /** + * Creates a new DocumentMask instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentMask instance + */ + public static create(properties?: google.firestore.v1.IDocumentMask): google.firestore.v1.DocumentMask; + + /** + * Encodes the specified DocumentMask message. Does not implicitly {@link google.firestore.v1.DocumentMask.verify|verify} messages. + * @param message DocumentMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IDocumentMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentMask message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentMask.verify|verify} messages. + * @param message DocumentMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IDocumentMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.DocumentMask; + + /** + * Decodes a DocumentMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.DocumentMask; + + /** + * Verifies a DocumentMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentMask + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.DocumentMask; + + /** + * Creates a plain object from a DocumentMask message. Also converts values to other types if specified. + * @param message DocumentMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.DocumentMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Precondition. */ + interface IPrecondition { + + /** Precondition exists */ + exists?: (boolean|null); + + /** Precondition updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Precondition. */ + class Precondition implements IPrecondition { + + /** + * Constructs a new Precondition. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IPrecondition); + + /** Precondition exists. */ + public exists?: (boolean|null); + + /** Precondition updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Precondition conditionType. */ + public conditionType?: ("exists"|"updateTime"); + + /** + * Creates a new Precondition instance using the specified properties. + * @param [properties] Properties to set + * @returns Precondition instance + */ + public static create(properties?: google.firestore.v1.IPrecondition): google.firestore.v1.Precondition; + + /** + * Encodes the specified Precondition message. Does not implicitly {@link google.firestore.v1.Precondition.verify|verify} messages. + * @param message Precondition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IPrecondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Precondition message, length delimited. Does not implicitly {@link google.firestore.v1.Precondition.verify|verify} messages. + * @param message Precondition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IPrecondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Precondition message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Precondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Precondition; + + /** + * Decodes a Precondition message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Precondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Precondition; + + /** + * Verifies a Precondition message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Precondition message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Precondition + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Precondition; + + /** + * Creates a plain object from a Precondition message. Also converts values to other types if specified. + * @param message Precondition + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Precondition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Precondition to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Precondition + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TransactionOptions. */ + interface ITransactionOptions { + + /** TransactionOptions readOnly */ + readOnly?: (google.firestore.v1.TransactionOptions.IReadOnly|null); + + /** TransactionOptions readWrite */ + readWrite?: (google.firestore.v1.TransactionOptions.IReadWrite|null); + } + + /** Represents a TransactionOptions. */ + class TransactionOptions implements ITransactionOptions { + + /** + * Constructs a new TransactionOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.ITransactionOptions); + + /** TransactionOptions readOnly. */ + public readOnly?: (google.firestore.v1.TransactionOptions.IReadOnly|null); + + /** TransactionOptions readWrite. */ + public readWrite?: (google.firestore.v1.TransactionOptions.IReadWrite|null); + + /** TransactionOptions mode. */ + public mode?: ("readOnly"|"readWrite"); + + /** + * Creates a new TransactionOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns TransactionOptions instance + */ + public static create(properties?: google.firestore.v1.ITransactionOptions): google.firestore.v1.TransactionOptions; + + /** + * Encodes the specified TransactionOptions message. Does not implicitly {@link google.firestore.v1.TransactionOptions.verify|verify} messages. + * @param message TransactionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.ITransactionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TransactionOptions message, length delimited. Does not implicitly {@link google.firestore.v1.TransactionOptions.verify|verify} messages. + * @param message TransactionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.ITransactionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TransactionOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TransactionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.TransactionOptions; + + /** + * Decodes a TransactionOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TransactionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.TransactionOptions; + + /** + * Verifies a TransactionOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TransactionOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TransactionOptions + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.TransactionOptions; + + /** + * Creates a plain object from a TransactionOptions message. Also converts values to other types if specified. + * @param message TransactionOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.TransactionOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TransactionOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TransactionOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TransactionOptions { + + /** ConcurrencyMode enum. */ + enum ConcurrencyMode { + CONCURRENCY_MODE_UNSPECIFIED = 0, + OPTIMISTIC = 1, + PESSIMISTIC = 2 + } + + /** Properties of a ReadWrite. */ + interface IReadWrite { + + /** ReadWrite retryTransaction */ + retryTransaction?: (Uint8Array|Buffer|string|null); + + /** ReadWrite concurrencyMode */ + concurrencyMode?: (google.firestore.v1.TransactionOptions.ConcurrencyMode|keyof typeof google.firestore.v1.TransactionOptions.ConcurrencyMode|null); + } + + /** Represents a ReadWrite. */ + class ReadWrite implements IReadWrite { + + /** + * Constructs a new ReadWrite. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.TransactionOptions.IReadWrite); + + /** ReadWrite retryTransaction. */ + public retryTransaction: (Uint8Array|Buffer|string); + + /** ReadWrite concurrencyMode. */ + public concurrencyMode: (google.firestore.v1.TransactionOptions.ConcurrencyMode|keyof typeof google.firestore.v1.TransactionOptions.ConcurrencyMode); + + /** + * Creates a new ReadWrite instance using the specified properties. + * @param [properties] Properties to set + * @returns ReadWrite instance + */ + public static create(properties?: google.firestore.v1.TransactionOptions.IReadWrite): google.firestore.v1.TransactionOptions.ReadWrite; + + /** + * Encodes the specified ReadWrite message. Does not implicitly {@link google.firestore.v1.TransactionOptions.ReadWrite.verify|verify} messages. + * @param message ReadWrite message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.TransactionOptions.IReadWrite, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReadWrite message, length delimited. Does not implicitly {@link google.firestore.v1.TransactionOptions.ReadWrite.verify|verify} messages. + * @param message ReadWrite message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.TransactionOptions.IReadWrite, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReadWrite message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReadWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.TransactionOptions.ReadWrite; + + /** + * Decodes a ReadWrite message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReadWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.TransactionOptions.ReadWrite; + + /** + * Verifies a ReadWrite message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReadWrite message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReadWrite + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.TransactionOptions.ReadWrite; + + /** + * Creates a plain object from a ReadWrite message. Also converts values to other types if specified. + * @param message ReadWrite + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.TransactionOptions.ReadWrite, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReadWrite to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReadWrite + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReadOnly. */ + interface IReadOnly { + + /** ReadOnly readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a ReadOnly. */ + class ReadOnly implements IReadOnly { + + /** + * Constructs a new ReadOnly. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.TransactionOptions.IReadOnly); + + /** ReadOnly readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** ReadOnly consistencySelector. */ + public consistencySelector?: "readTime"; + + /** + * Creates a new ReadOnly instance using the specified properties. + * @param [properties] Properties to set + * @returns ReadOnly instance + */ + public static create(properties?: google.firestore.v1.TransactionOptions.IReadOnly): google.firestore.v1.TransactionOptions.ReadOnly; + + /** + * Encodes the specified ReadOnly message. Does not implicitly {@link google.firestore.v1.TransactionOptions.ReadOnly.verify|verify} messages. + * @param message ReadOnly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.TransactionOptions.IReadOnly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReadOnly message, length delimited. Does not implicitly {@link google.firestore.v1.TransactionOptions.ReadOnly.verify|verify} messages. + * @param message ReadOnly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.TransactionOptions.IReadOnly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReadOnly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReadOnly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.TransactionOptions.ReadOnly; + + /** + * Decodes a ReadOnly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReadOnly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.TransactionOptions.ReadOnly; + + /** + * Verifies a ReadOnly message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReadOnly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReadOnly + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.TransactionOptions.ReadOnly; + + /** + * Creates a plain object from a ReadOnly message. Also converts values to other types if specified. + * @param message ReadOnly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.TransactionOptions.ReadOnly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReadOnly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReadOnly + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an ExplainStats. */ + interface IExplainStats { + + /** ExplainStats data */ + data?: (google.protobuf.IAny|null); + } + + /** Represents an ExplainStats. */ + class ExplainStats implements IExplainStats { + + /** + * Constructs a new ExplainStats. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IExplainStats); + + /** ExplainStats data. */ + public data?: (google.protobuf.IAny|null); + + /** + * Creates a new ExplainStats instance using the specified properties. + * @param [properties] Properties to set + * @returns ExplainStats instance + */ + public static create(properties?: google.firestore.v1.IExplainStats): google.firestore.v1.ExplainStats; + + /** + * Encodes the specified ExplainStats message. Does not implicitly {@link google.firestore.v1.ExplainStats.verify|verify} messages. + * @param message ExplainStats message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IExplainStats, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExplainStats message, length delimited. Does not implicitly {@link google.firestore.v1.ExplainStats.verify|verify} messages. + * @param message ExplainStats message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IExplainStats, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExplainStats message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExplainStats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ExplainStats; + + /** + * Decodes an ExplainStats message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExplainStats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ExplainStats; + + /** + * Verifies an ExplainStats message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExplainStats message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExplainStats + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ExplainStats; + + /** + * Creates a plain object from an ExplainStats message. Also converts values to other types if specified. + * @param message ExplainStats + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ExplainStats, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExplainStats to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExplainStats + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Firestore */ + class Firestore extends $protobuf.rpc.Service { + + /** + * Constructs a new Firestore service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Firestore service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Firestore; + + /** + * Calls GetDocument. + * @param request GetDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Document + */ + public getDocument(request: google.firestore.v1.IGetDocumentRequest, callback: google.firestore.v1.Firestore.GetDocumentCallback): void; + + /** + * Calls GetDocument. + * @param request GetDocumentRequest message or plain object + * @returns Promise + */ + public getDocument(request: google.firestore.v1.IGetDocumentRequest): Promise; + + /** + * Calls ListDocuments. + * @param request ListDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListDocumentsResponse + */ + public listDocuments(request: google.firestore.v1.IListDocumentsRequest, callback: google.firestore.v1.Firestore.ListDocumentsCallback): void; + + /** + * Calls ListDocuments. + * @param request ListDocumentsRequest message or plain object + * @returns Promise + */ + public listDocuments(request: google.firestore.v1.IListDocumentsRequest): Promise; + + /** + * Calls UpdateDocument. + * @param request UpdateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Document + */ + public updateDocument(request: google.firestore.v1.IUpdateDocumentRequest, callback: google.firestore.v1.Firestore.UpdateDocumentCallback): void; + + /** + * Calls UpdateDocument. + * @param request UpdateDocumentRequest message or plain object + * @returns Promise + */ + public updateDocument(request: google.firestore.v1.IUpdateDocumentRequest): Promise; + + /** + * Calls DeleteDocument. + * @param request DeleteDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteDocument(request: google.firestore.v1.IDeleteDocumentRequest, callback: google.firestore.v1.Firestore.DeleteDocumentCallback): void; + + /** + * Calls DeleteDocument. + * @param request DeleteDocumentRequest message or plain object + * @returns Promise + */ + public deleteDocument(request: google.firestore.v1.IDeleteDocumentRequest): Promise; + + /** + * Calls BatchGetDocuments. + * @param request BatchGetDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BatchGetDocumentsResponse + */ + public batchGetDocuments(request: google.firestore.v1.IBatchGetDocumentsRequest, callback: google.firestore.v1.Firestore.BatchGetDocumentsCallback): void; + + /** + * Calls BatchGetDocuments. + * @param request BatchGetDocumentsRequest message or plain object + * @returns Promise + */ + public batchGetDocuments(request: google.firestore.v1.IBatchGetDocumentsRequest): Promise; + + /** + * Calls BeginTransaction. + * @param request BeginTransactionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BeginTransactionResponse + */ + public beginTransaction(request: google.firestore.v1.IBeginTransactionRequest, callback: google.firestore.v1.Firestore.BeginTransactionCallback): void; + + /** + * Calls BeginTransaction. + * @param request BeginTransactionRequest message or plain object + * @returns Promise + */ + public beginTransaction(request: google.firestore.v1.IBeginTransactionRequest): Promise; + + /** + * Calls Commit. + * @param request CommitRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CommitResponse + */ + public commit(request: google.firestore.v1.ICommitRequest, callback: google.firestore.v1.Firestore.CommitCallback): void; + + /** + * Calls Commit. + * @param request CommitRequest message or plain object + * @returns Promise + */ + public commit(request: google.firestore.v1.ICommitRequest): Promise; + + /** + * Calls Rollback. + * @param request RollbackRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public rollback(request: google.firestore.v1.IRollbackRequest, callback: google.firestore.v1.Firestore.RollbackCallback): void; + + /** + * Calls Rollback. + * @param request RollbackRequest message or plain object + * @returns Promise + */ + public rollback(request: google.firestore.v1.IRollbackRequest): Promise; + + /** + * Calls RunQuery. + * @param request RunQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and RunQueryResponse + */ + public runQuery(request: google.firestore.v1.IRunQueryRequest, callback: google.firestore.v1.Firestore.RunQueryCallback): void; + + /** + * Calls RunQuery. + * @param request RunQueryRequest message or plain object + * @returns Promise + */ + public runQuery(request: google.firestore.v1.IRunQueryRequest): Promise; + + /** + * Calls ExecutePipeline. + * @param request ExecutePipelineRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ExecutePipelineResponse + */ + public executePipeline(request: google.firestore.v1.IExecutePipelineRequest, callback: google.firestore.v1.Firestore.ExecutePipelineCallback): void; + + /** + * Calls ExecutePipeline. + * @param request ExecutePipelineRequest message or plain object + * @returns Promise + */ + public executePipeline(request: google.firestore.v1.IExecutePipelineRequest): Promise; + + /** + * Calls RunAggregationQuery. + * @param request RunAggregationQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and RunAggregationQueryResponse + */ + public runAggregationQuery(request: google.firestore.v1.IRunAggregationQueryRequest, callback: google.firestore.v1.Firestore.RunAggregationQueryCallback): void; + + /** + * Calls RunAggregationQuery. + * @param request RunAggregationQueryRequest message or plain object + * @returns Promise + */ + public runAggregationQuery(request: google.firestore.v1.IRunAggregationQueryRequest): Promise; + + /** + * Calls PartitionQuery. + * @param request PartitionQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PartitionQueryResponse + */ + public partitionQuery(request: google.firestore.v1.IPartitionQueryRequest, callback: google.firestore.v1.Firestore.PartitionQueryCallback): void; + + /** + * Calls PartitionQuery. + * @param request PartitionQueryRequest message or plain object + * @returns Promise + */ + public partitionQuery(request: google.firestore.v1.IPartitionQueryRequest): Promise; + + /** + * Calls Write. + * @param request WriteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and WriteResponse + */ + public write(request: google.firestore.v1.IWriteRequest, callback: google.firestore.v1.Firestore.WriteCallback): void; + + /** + * Calls Write. + * @param request WriteRequest message or plain object + * @returns Promise + */ + public write(request: google.firestore.v1.IWriteRequest): Promise; + + /** + * Calls Listen. + * @param request ListenRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListenResponse + */ + public listen(request: google.firestore.v1.IListenRequest, callback: google.firestore.v1.Firestore.ListenCallback): void; + + /** + * Calls Listen. + * @param request ListenRequest message or plain object + * @returns Promise + */ + public listen(request: google.firestore.v1.IListenRequest): Promise; + + /** + * Calls ListCollectionIds. + * @param request ListCollectionIdsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCollectionIdsResponse + */ + public listCollectionIds(request: google.firestore.v1.IListCollectionIdsRequest, callback: google.firestore.v1.Firestore.ListCollectionIdsCallback): void; + + /** + * Calls ListCollectionIds. + * @param request ListCollectionIdsRequest message or plain object + * @returns Promise + */ + public listCollectionIds(request: google.firestore.v1.IListCollectionIdsRequest): Promise; + + /** + * Calls BatchWrite. + * @param request BatchWriteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BatchWriteResponse + */ + public batchWrite(request: google.firestore.v1.IBatchWriteRequest, callback: google.firestore.v1.Firestore.BatchWriteCallback): void; + + /** + * Calls BatchWrite. + * @param request BatchWriteRequest message or plain object + * @returns Promise + */ + public batchWrite(request: google.firestore.v1.IBatchWriteRequest): Promise; + + /** + * Calls CreateDocument. + * @param request CreateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Document + */ + public createDocument(request: google.firestore.v1.ICreateDocumentRequest, callback: google.firestore.v1.Firestore.CreateDocumentCallback): void; + + /** + * Calls CreateDocument. + * @param request CreateDocumentRequest message or plain object + * @returns Promise + */ + public createDocument(request: google.firestore.v1.ICreateDocumentRequest): Promise; + } + + namespace Firestore { + + /** + * Callback as used by {@link google.firestore.v1.Firestore|getDocument}. + * @param error Error, if any + * @param [response] Document + */ + type GetDocumentCallback = (error: (Error|null), response?: google.firestore.v1.Document) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|listDocuments}. + * @param error Error, if any + * @param [response] ListDocumentsResponse + */ + type ListDocumentsCallback = (error: (Error|null), response?: google.firestore.v1.ListDocumentsResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|updateDocument}. + * @param error Error, if any + * @param [response] Document + */ + type UpdateDocumentCallback = (error: (Error|null), response?: google.firestore.v1.Document) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|deleteDocument}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteDocumentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|batchGetDocuments}. + * @param error Error, if any + * @param [response] BatchGetDocumentsResponse + */ + type BatchGetDocumentsCallback = (error: (Error|null), response?: google.firestore.v1.BatchGetDocumentsResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|beginTransaction}. + * @param error Error, if any + * @param [response] BeginTransactionResponse + */ + type BeginTransactionCallback = (error: (Error|null), response?: google.firestore.v1.BeginTransactionResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|commit}. + * @param error Error, if any + * @param [response] CommitResponse + */ + type CommitCallback = (error: (Error|null), response?: google.firestore.v1.CommitResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|rollback}. + * @param error Error, if any + * @param [response] Empty + */ + type RollbackCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|runQuery}. + * @param error Error, if any + * @param [response] RunQueryResponse + */ + type RunQueryCallback = (error: (Error|null), response?: google.firestore.v1.RunQueryResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|executePipeline}. + * @param error Error, if any + * @param [response] ExecutePipelineResponse + */ + type ExecutePipelineCallback = (error: (Error|null), response?: google.firestore.v1.ExecutePipelineResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|runAggregationQuery}. + * @param error Error, if any + * @param [response] RunAggregationQueryResponse + */ + type RunAggregationQueryCallback = (error: (Error|null), response?: google.firestore.v1.RunAggregationQueryResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|partitionQuery}. + * @param error Error, if any + * @param [response] PartitionQueryResponse + */ + type PartitionQueryCallback = (error: (Error|null), response?: google.firestore.v1.PartitionQueryResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|write}. + * @param error Error, if any + * @param [response] WriteResponse + */ + type WriteCallback = (error: (Error|null), response?: google.firestore.v1.WriteResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|listen}. + * @param error Error, if any + * @param [response] ListenResponse + */ + type ListenCallback = (error: (Error|null), response?: google.firestore.v1.ListenResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|listCollectionIds}. + * @param error Error, if any + * @param [response] ListCollectionIdsResponse + */ + type ListCollectionIdsCallback = (error: (Error|null), response?: google.firestore.v1.ListCollectionIdsResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|batchWrite}. + * @param error Error, if any + * @param [response] BatchWriteResponse + */ + type BatchWriteCallback = (error: (Error|null), response?: google.firestore.v1.BatchWriteResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|createDocument}. + * @param error Error, if any + * @param [response] Document + */ + type CreateDocumentCallback = (error: (Error|null), response?: google.firestore.v1.Document) => void; + } + + /** Properties of a GetDocumentRequest. */ + interface IGetDocumentRequest { + + /** GetDocumentRequest name */ + name?: (string|null); + + /** GetDocumentRequest mask */ + mask?: (google.firestore.v1.IDocumentMask|null); + + /** GetDocumentRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** GetDocumentRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a GetDocumentRequest. */ + class GetDocumentRequest implements IGetDocumentRequest { + + /** + * Constructs a new GetDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IGetDocumentRequest); + + /** GetDocumentRequest name. */ + public name: string; + + /** GetDocumentRequest mask. */ + public mask?: (google.firestore.v1.IDocumentMask|null); + + /** GetDocumentRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** GetDocumentRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** GetDocumentRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"readTime"); + + /** + * Creates a new GetDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetDocumentRequest instance + */ + public static create(properties?: google.firestore.v1.IGetDocumentRequest): google.firestore.v1.GetDocumentRequest; + + /** + * Encodes the specified GetDocumentRequest message. Does not implicitly {@link google.firestore.v1.GetDocumentRequest.verify|verify} messages. + * @param message GetDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IGetDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1.GetDocumentRequest.verify|verify} messages. + * @param message GetDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IGetDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.GetDocumentRequest; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.GetDocumentRequest; + + /** + * Verifies a GetDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.GetDocumentRequest; + + /** + * Creates a plain object from a GetDocumentRequest message. Also converts values to other types if specified. + * @param message GetDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.GetDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListDocumentsRequest. */ + interface IListDocumentsRequest { + + /** ListDocumentsRequest parent */ + parent?: (string|null); + + /** ListDocumentsRequest collectionId */ + collectionId?: (string|null); + + /** ListDocumentsRequest pageSize */ + pageSize?: (number|null); + + /** ListDocumentsRequest pageToken */ + pageToken?: (string|null); + + /** ListDocumentsRequest orderBy */ + orderBy?: (string|null); + + /** ListDocumentsRequest mask */ + mask?: (google.firestore.v1.IDocumentMask|null); + + /** ListDocumentsRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** ListDocumentsRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** ListDocumentsRequest showMissing */ + showMissing?: (boolean|null); + } + + /** Represents a ListDocumentsRequest. */ + class ListDocumentsRequest implements IListDocumentsRequest { + + /** + * Constructs a new ListDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IListDocumentsRequest); + + /** ListDocumentsRequest parent. */ + public parent: string; + + /** ListDocumentsRequest collectionId. */ + public collectionId: string; + + /** ListDocumentsRequest pageSize. */ + public pageSize: number; + + /** ListDocumentsRequest pageToken. */ + public pageToken: string; + + /** ListDocumentsRequest orderBy. */ + public orderBy: string; + + /** ListDocumentsRequest mask. */ + public mask?: (google.firestore.v1.IDocumentMask|null); + + /** ListDocumentsRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** ListDocumentsRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** ListDocumentsRequest showMissing. */ + public showMissing: boolean; + + /** ListDocumentsRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"readTime"); + + /** + * Creates a new ListDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDocumentsRequest instance + */ + public static create(properties?: google.firestore.v1.IListDocumentsRequest): google.firestore.v1.ListDocumentsRequest; + + /** + * Encodes the specified ListDocumentsRequest message. Does not implicitly {@link google.firestore.v1.ListDocumentsRequest.verify|verify} messages. + * @param message ListDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IListDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.v1.ListDocumentsRequest.verify|verify} messages. + * @param message ListDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IListDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ListDocumentsRequest; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ListDocumentsRequest; + + /** + * Verifies a ListDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ListDocumentsRequest; + + /** + * Creates a plain object from a ListDocumentsRequest message. Also converts values to other types if specified. + * @param message ListDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ListDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListDocumentsResponse. */ + interface IListDocumentsResponse { + + /** ListDocumentsResponse documents */ + documents?: (google.firestore.v1.IDocument[]|null); + + /** ListDocumentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListDocumentsResponse. */ + class ListDocumentsResponse implements IListDocumentsResponse { + + /** + * Constructs a new ListDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IListDocumentsResponse); + + /** ListDocumentsResponse documents. */ + public documents: google.firestore.v1.IDocument[]; + + /** ListDocumentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDocumentsResponse instance + */ + public static create(properties?: google.firestore.v1.IListDocumentsResponse): google.firestore.v1.ListDocumentsResponse; + + /** + * Encodes the specified ListDocumentsResponse message. Does not implicitly {@link google.firestore.v1.ListDocumentsResponse.verify|verify} messages. + * @param message ListDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IListDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.v1.ListDocumentsResponse.verify|verify} messages. + * @param message ListDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IListDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ListDocumentsResponse; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ListDocumentsResponse; + + /** + * Verifies a ListDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ListDocumentsResponse; + + /** + * Creates a plain object from a ListDocumentsResponse message. Also converts values to other types if specified. + * @param message ListDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ListDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateDocumentRequest. */ + interface ICreateDocumentRequest { + + /** CreateDocumentRequest parent */ + parent?: (string|null); + + /** CreateDocumentRequest collectionId */ + collectionId?: (string|null); + + /** CreateDocumentRequest documentId */ + documentId?: (string|null); + + /** CreateDocumentRequest document */ + document?: (google.firestore.v1.IDocument|null); + + /** CreateDocumentRequest mask */ + mask?: (google.firestore.v1.IDocumentMask|null); + } + + /** Represents a CreateDocumentRequest. */ + class CreateDocumentRequest implements ICreateDocumentRequest { + + /** + * Constructs a new CreateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.ICreateDocumentRequest); + + /** CreateDocumentRequest parent. */ + public parent: string; + + /** CreateDocumentRequest collectionId. */ + public collectionId: string; + + /** CreateDocumentRequest documentId. */ + public documentId: string; + + /** CreateDocumentRequest document. */ + public document?: (google.firestore.v1.IDocument|null); + + /** CreateDocumentRequest mask. */ + public mask?: (google.firestore.v1.IDocumentMask|null); + + /** + * Creates a new CreateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateDocumentRequest instance + */ + public static create(properties?: google.firestore.v1.ICreateDocumentRequest): google.firestore.v1.CreateDocumentRequest; + + /** + * Encodes the specified CreateDocumentRequest message. Does not implicitly {@link google.firestore.v1.CreateDocumentRequest.verify|verify} messages. + * @param message CreateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.ICreateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1.CreateDocumentRequest.verify|verify} messages. + * @param message CreateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.ICreateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.CreateDocumentRequest; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.CreateDocumentRequest; + + /** + * Verifies a CreateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.CreateDocumentRequest; + + /** + * Creates a plain object from a CreateDocumentRequest message. Also converts values to other types if specified. + * @param message CreateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.CreateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateDocumentRequest. */ + interface IUpdateDocumentRequest { + + /** UpdateDocumentRequest document */ + document?: (google.firestore.v1.IDocument|null); + + /** UpdateDocumentRequest updateMask */ + updateMask?: (google.firestore.v1.IDocumentMask|null); + + /** UpdateDocumentRequest mask */ + mask?: (google.firestore.v1.IDocumentMask|null); + + /** UpdateDocumentRequest currentDocument */ + currentDocument?: (google.firestore.v1.IPrecondition|null); + } + + /** Represents an UpdateDocumentRequest. */ + class UpdateDocumentRequest implements IUpdateDocumentRequest { + + /** + * Constructs a new UpdateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IUpdateDocumentRequest); + + /** UpdateDocumentRequest document. */ + public document?: (google.firestore.v1.IDocument|null); + + /** UpdateDocumentRequest updateMask. */ + public updateMask?: (google.firestore.v1.IDocumentMask|null); + + /** UpdateDocumentRequest mask. */ + public mask?: (google.firestore.v1.IDocumentMask|null); + + /** UpdateDocumentRequest currentDocument. */ + public currentDocument?: (google.firestore.v1.IPrecondition|null); + + /** + * Creates a new UpdateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateDocumentRequest instance + */ + public static create(properties?: google.firestore.v1.IUpdateDocumentRequest): google.firestore.v1.UpdateDocumentRequest; + + /** + * Encodes the specified UpdateDocumentRequest message. Does not implicitly {@link google.firestore.v1.UpdateDocumentRequest.verify|verify} messages. + * @param message UpdateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IUpdateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1.UpdateDocumentRequest.verify|verify} messages. + * @param message UpdateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IUpdateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.UpdateDocumentRequest; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.UpdateDocumentRequest; + + /** + * Verifies an UpdateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.UpdateDocumentRequest; + + /** + * Creates a plain object from an UpdateDocumentRequest message. Also converts values to other types if specified. + * @param message UpdateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.UpdateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteDocumentRequest. */ + interface IDeleteDocumentRequest { + + /** DeleteDocumentRequest name */ + name?: (string|null); + + /** DeleteDocumentRequest currentDocument */ + currentDocument?: (google.firestore.v1.IPrecondition|null); + } + + /** Represents a DeleteDocumentRequest. */ + class DeleteDocumentRequest implements IDeleteDocumentRequest { + + /** + * Constructs a new DeleteDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IDeleteDocumentRequest); + + /** DeleteDocumentRequest name. */ + public name: string; + + /** DeleteDocumentRequest currentDocument. */ + public currentDocument?: (google.firestore.v1.IPrecondition|null); + + /** + * Creates a new DeleteDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteDocumentRequest instance + */ + public static create(properties?: google.firestore.v1.IDeleteDocumentRequest): google.firestore.v1.DeleteDocumentRequest; + + /** + * Encodes the specified DeleteDocumentRequest message. Does not implicitly {@link google.firestore.v1.DeleteDocumentRequest.verify|verify} messages. + * @param message DeleteDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IDeleteDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1.DeleteDocumentRequest.verify|verify} messages. + * @param message DeleteDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IDeleteDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.DeleteDocumentRequest; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.DeleteDocumentRequest; + + /** + * Verifies a DeleteDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.DeleteDocumentRequest; + + /** + * Creates a plain object from a DeleteDocumentRequest message. Also converts values to other types if specified. + * @param message DeleteDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.DeleteDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchGetDocumentsRequest. */ + interface IBatchGetDocumentsRequest { + + /** BatchGetDocumentsRequest database */ + database?: (string|null); + + /** BatchGetDocumentsRequest documents */ + documents?: (string[]|null); + + /** BatchGetDocumentsRequest mask */ + mask?: (google.firestore.v1.IDocumentMask|null); + + /** BatchGetDocumentsRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** BatchGetDocumentsRequest newTransaction */ + newTransaction?: (google.firestore.v1.ITransactionOptions|null); + + /** BatchGetDocumentsRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchGetDocumentsRequest. */ + class BatchGetDocumentsRequest implements IBatchGetDocumentsRequest { + + /** + * Constructs a new BatchGetDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IBatchGetDocumentsRequest); + + /** BatchGetDocumentsRequest database. */ + public database: string; + + /** BatchGetDocumentsRequest documents. */ + public documents: string[]; + + /** BatchGetDocumentsRequest mask. */ + public mask?: (google.firestore.v1.IDocumentMask|null); + + /** BatchGetDocumentsRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** BatchGetDocumentsRequest newTransaction. */ + public newTransaction?: (google.firestore.v1.ITransactionOptions|null); + + /** BatchGetDocumentsRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** BatchGetDocumentsRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"newTransaction"|"readTime"); + + /** + * Creates a new BatchGetDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchGetDocumentsRequest instance + */ + public static create(properties?: google.firestore.v1.IBatchGetDocumentsRequest): google.firestore.v1.BatchGetDocumentsRequest; + + /** + * Encodes the specified BatchGetDocumentsRequest message. Does not implicitly {@link google.firestore.v1.BatchGetDocumentsRequest.verify|verify} messages. + * @param message BatchGetDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IBatchGetDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchGetDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.v1.BatchGetDocumentsRequest.verify|verify} messages. + * @param message BatchGetDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IBatchGetDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchGetDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchGetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.BatchGetDocumentsRequest; + + /** + * Decodes a BatchGetDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchGetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.BatchGetDocumentsRequest; + + /** + * Verifies a BatchGetDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchGetDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchGetDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.BatchGetDocumentsRequest; + + /** + * Creates a plain object from a BatchGetDocumentsRequest message. Also converts values to other types if specified. + * @param message BatchGetDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.BatchGetDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchGetDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchGetDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchGetDocumentsResponse. */ + interface IBatchGetDocumentsResponse { + + /** BatchGetDocumentsResponse found */ + found?: (google.firestore.v1.IDocument|null); + + /** BatchGetDocumentsResponse missing */ + missing?: (string|null); + + /** BatchGetDocumentsResponse transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** BatchGetDocumentsResponse readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchGetDocumentsResponse. */ + class BatchGetDocumentsResponse implements IBatchGetDocumentsResponse { + + /** + * Constructs a new BatchGetDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IBatchGetDocumentsResponse); + + /** BatchGetDocumentsResponse found. */ + public found?: (google.firestore.v1.IDocument|null); + + /** BatchGetDocumentsResponse missing. */ + public missing?: (string|null); + + /** BatchGetDocumentsResponse transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** BatchGetDocumentsResponse readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** BatchGetDocumentsResponse result. */ + public result?: ("found"|"missing"); + + /** + * Creates a new BatchGetDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchGetDocumentsResponse instance + */ + public static create(properties?: google.firestore.v1.IBatchGetDocumentsResponse): google.firestore.v1.BatchGetDocumentsResponse; + + /** + * Encodes the specified BatchGetDocumentsResponse message. Does not implicitly {@link google.firestore.v1.BatchGetDocumentsResponse.verify|verify} messages. + * @param message BatchGetDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IBatchGetDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchGetDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.v1.BatchGetDocumentsResponse.verify|verify} messages. + * @param message BatchGetDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IBatchGetDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchGetDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchGetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.BatchGetDocumentsResponse; + + /** + * Decodes a BatchGetDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchGetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.BatchGetDocumentsResponse; + + /** + * Verifies a BatchGetDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchGetDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchGetDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.BatchGetDocumentsResponse; + + /** + * Creates a plain object from a BatchGetDocumentsResponse message. Also converts values to other types if specified. + * @param message BatchGetDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.BatchGetDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchGetDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchGetDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BeginTransactionRequest. */ + interface IBeginTransactionRequest { + + /** BeginTransactionRequest database */ + database?: (string|null); + + /** BeginTransactionRequest options */ + options?: (google.firestore.v1.ITransactionOptions|null); + } + + /** Represents a BeginTransactionRequest. */ + class BeginTransactionRequest implements IBeginTransactionRequest { + + /** + * Constructs a new BeginTransactionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IBeginTransactionRequest); + + /** BeginTransactionRequest database. */ + public database: string; + + /** BeginTransactionRequest options. */ + public options?: (google.firestore.v1.ITransactionOptions|null); + + /** + * Creates a new BeginTransactionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BeginTransactionRequest instance + */ + public static create(properties?: google.firestore.v1.IBeginTransactionRequest): google.firestore.v1.BeginTransactionRequest; + + /** + * Encodes the specified BeginTransactionRequest message. Does not implicitly {@link google.firestore.v1.BeginTransactionRequest.verify|verify} messages. + * @param message BeginTransactionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IBeginTransactionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BeginTransactionRequest message, length delimited. Does not implicitly {@link google.firestore.v1.BeginTransactionRequest.verify|verify} messages. + * @param message BeginTransactionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IBeginTransactionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BeginTransactionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BeginTransactionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.BeginTransactionRequest; + + /** + * Decodes a BeginTransactionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BeginTransactionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.BeginTransactionRequest; + + /** + * Verifies a BeginTransactionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BeginTransactionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BeginTransactionRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.BeginTransactionRequest; + + /** + * Creates a plain object from a BeginTransactionRequest message. Also converts values to other types if specified. + * @param message BeginTransactionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.BeginTransactionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BeginTransactionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BeginTransactionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BeginTransactionResponse. */ + interface IBeginTransactionResponse { + + /** BeginTransactionResponse transaction */ + transaction?: (Uint8Array|Buffer|string|null); + } + + /** Represents a BeginTransactionResponse. */ + class BeginTransactionResponse implements IBeginTransactionResponse { + + /** + * Constructs a new BeginTransactionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IBeginTransactionResponse); + + /** BeginTransactionResponse transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** + * Creates a new BeginTransactionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BeginTransactionResponse instance + */ + public static create(properties?: google.firestore.v1.IBeginTransactionResponse): google.firestore.v1.BeginTransactionResponse; + + /** + * Encodes the specified BeginTransactionResponse message. Does not implicitly {@link google.firestore.v1.BeginTransactionResponse.verify|verify} messages. + * @param message BeginTransactionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IBeginTransactionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BeginTransactionResponse message, length delimited. Does not implicitly {@link google.firestore.v1.BeginTransactionResponse.verify|verify} messages. + * @param message BeginTransactionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IBeginTransactionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BeginTransactionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BeginTransactionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.BeginTransactionResponse; + + /** + * Decodes a BeginTransactionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BeginTransactionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.BeginTransactionResponse; + + /** + * Verifies a BeginTransactionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BeginTransactionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BeginTransactionResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.BeginTransactionResponse; + + /** + * Creates a plain object from a BeginTransactionResponse message. Also converts values to other types if specified. + * @param message BeginTransactionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.BeginTransactionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BeginTransactionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BeginTransactionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CommitRequest. */ + interface ICommitRequest { + + /** CommitRequest database */ + database?: (string|null); + + /** CommitRequest writes */ + writes?: (google.firestore.v1.IWrite[]|null); + + /** CommitRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + } + + /** Represents a CommitRequest. */ + class CommitRequest implements ICommitRequest { + + /** + * Constructs a new CommitRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.ICommitRequest); + + /** CommitRequest database. */ + public database: string; + + /** CommitRequest writes. */ + public writes: google.firestore.v1.IWrite[]; + + /** CommitRequest transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** + * Creates a new CommitRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CommitRequest instance + */ + public static create(properties?: google.firestore.v1.ICommitRequest): google.firestore.v1.CommitRequest; + + /** + * Encodes the specified CommitRequest message. Does not implicitly {@link google.firestore.v1.CommitRequest.verify|verify} messages. + * @param message CommitRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.ICommitRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CommitRequest message, length delimited. Does not implicitly {@link google.firestore.v1.CommitRequest.verify|verify} messages. + * @param message CommitRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.ICommitRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommitRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CommitRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.CommitRequest; + + /** + * Decodes a CommitRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CommitRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.CommitRequest; + + /** + * Verifies a CommitRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CommitRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CommitRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.CommitRequest; + + /** + * Creates a plain object from a CommitRequest message. Also converts values to other types if specified. + * @param message CommitRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.CommitRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CommitRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CommitRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CommitResponse. */ + interface ICommitResponse { + + /** CommitResponse writeResults */ + writeResults?: (google.firestore.v1.IWriteResult[]|null); + + /** CommitResponse commitTime */ + commitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CommitResponse. */ + class CommitResponse implements ICommitResponse { + + /** + * Constructs a new CommitResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.ICommitResponse); + + /** CommitResponse writeResults. */ + public writeResults: google.firestore.v1.IWriteResult[]; + + /** CommitResponse commitTime. */ + public commitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new CommitResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns CommitResponse instance + */ + public static create(properties?: google.firestore.v1.ICommitResponse): google.firestore.v1.CommitResponse; + + /** + * Encodes the specified CommitResponse message. Does not implicitly {@link google.firestore.v1.CommitResponse.verify|verify} messages. + * @param message CommitResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.ICommitResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CommitResponse message, length delimited. Does not implicitly {@link google.firestore.v1.CommitResponse.verify|verify} messages. + * @param message CommitResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.ICommitResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommitResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CommitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.CommitResponse; + + /** + * Decodes a CommitResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CommitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.CommitResponse; + + /** + * Verifies a CommitResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CommitResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CommitResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.CommitResponse; + + /** + * Creates a plain object from a CommitResponse message. Also converts values to other types if specified. + * @param message CommitResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.CommitResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CommitResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CommitResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RollbackRequest. */ + interface IRollbackRequest { + + /** RollbackRequest database */ + database?: (string|null); + + /** RollbackRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + } + + /** Represents a RollbackRequest. */ + class RollbackRequest implements IRollbackRequest { + + /** + * Constructs a new RollbackRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IRollbackRequest); + + /** RollbackRequest database. */ + public database: string; + + /** RollbackRequest transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** + * Creates a new RollbackRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RollbackRequest instance + */ + public static create(properties?: google.firestore.v1.IRollbackRequest): google.firestore.v1.RollbackRequest; + + /** + * Encodes the specified RollbackRequest message. Does not implicitly {@link google.firestore.v1.RollbackRequest.verify|verify} messages. + * @param message RollbackRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IRollbackRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RollbackRequest message, length delimited. Does not implicitly {@link google.firestore.v1.RollbackRequest.verify|verify} messages. + * @param message RollbackRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IRollbackRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RollbackRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RollbackRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.RollbackRequest; + + /** + * Decodes a RollbackRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RollbackRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.RollbackRequest; + + /** + * Verifies a RollbackRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RollbackRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RollbackRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.RollbackRequest; + + /** + * Creates a plain object from a RollbackRequest message. Also converts values to other types if specified. + * @param message RollbackRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.RollbackRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RollbackRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RollbackRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RunQueryRequest. */ + interface IRunQueryRequest { + + /** RunQueryRequest parent */ + parent?: (string|null); + + /** RunQueryRequest structuredQuery */ + structuredQuery?: (google.firestore.v1.IStructuredQuery|null); + + /** RunQueryRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** RunQueryRequest newTransaction */ + newTransaction?: (google.firestore.v1.ITransactionOptions|null); + + /** RunQueryRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** RunQueryRequest explainOptions */ + explainOptions?: (google.firestore.v1.IExplainOptions|null); + } + + /** Represents a RunQueryRequest. */ + class RunQueryRequest implements IRunQueryRequest { + + /** + * Constructs a new RunQueryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IRunQueryRequest); + + /** RunQueryRequest parent. */ + public parent: string; + + /** RunQueryRequest structuredQuery. */ + public structuredQuery?: (google.firestore.v1.IStructuredQuery|null); + + /** RunQueryRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** RunQueryRequest newTransaction. */ + public newTransaction?: (google.firestore.v1.ITransactionOptions|null); + + /** RunQueryRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** RunQueryRequest explainOptions. */ + public explainOptions?: (google.firestore.v1.IExplainOptions|null); + + /** RunQueryRequest queryType. */ + public queryType?: "structuredQuery"; + + /** RunQueryRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"newTransaction"|"readTime"); + + /** + * Creates a new RunQueryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RunQueryRequest instance + */ + public static create(properties?: google.firestore.v1.IRunQueryRequest): google.firestore.v1.RunQueryRequest; + + /** + * Encodes the specified RunQueryRequest message. Does not implicitly {@link google.firestore.v1.RunQueryRequest.verify|verify} messages. + * @param message RunQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IRunQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RunQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1.RunQueryRequest.verify|verify} messages. + * @param message RunQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IRunQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RunQueryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RunQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.RunQueryRequest; + + /** + * Decodes a RunQueryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RunQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.RunQueryRequest; + + /** + * Verifies a RunQueryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RunQueryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RunQueryRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.RunQueryRequest; + + /** + * Creates a plain object from a RunQueryRequest message. Also converts values to other types if specified. + * @param message RunQueryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.RunQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RunQueryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RunQueryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RunQueryResponse. */ + interface IRunQueryResponse { + + /** RunQueryResponse transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** RunQueryResponse document */ + document?: (google.firestore.v1.IDocument|null); + + /** RunQueryResponse readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** RunQueryResponse skippedResults */ + skippedResults?: (number|null); + + /** RunQueryResponse done */ + done?: (boolean|null); + + /** RunQueryResponse explainMetrics */ + explainMetrics?: (google.firestore.v1.IExplainMetrics|null); + } + + /** Represents a RunQueryResponse. */ + class RunQueryResponse implements IRunQueryResponse { + + /** + * Constructs a new RunQueryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IRunQueryResponse); + + /** RunQueryResponse transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** RunQueryResponse document. */ + public document?: (google.firestore.v1.IDocument|null); + + /** RunQueryResponse readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** RunQueryResponse skippedResults. */ + public skippedResults: number; + + /** RunQueryResponse done. */ + public done?: (boolean|null); + + /** RunQueryResponse explainMetrics. */ + public explainMetrics?: (google.firestore.v1.IExplainMetrics|null); + + /** RunQueryResponse continuationSelector. */ + public continuationSelector?: "done"; + + /** + * Creates a new RunQueryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RunQueryResponse instance + */ + public static create(properties?: google.firestore.v1.IRunQueryResponse): google.firestore.v1.RunQueryResponse; + + /** + * Encodes the specified RunQueryResponse message. Does not implicitly {@link google.firestore.v1.RunQueryResponse.verify|verify} messages. + * @param message RunQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IRunQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RunQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1.RunQueryResponse.verify|verify} messages. + * @param message RunQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IRunQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RunQueryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RunQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.RunQueryResponse; + + /** + * Decodes a RunQueryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RunQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.RunQueryResponse; + + /** + * Verifies a RunQueryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RunQueryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RunQueryResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.RunQueryResponse; + + /** + * Creates a plain object from a RunQueryResponse message. Also converts values to other types if specified. + * @param message RunQueryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.RunQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RunQueryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RunQueryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExecutePipelineRequest. */ + interface IExecutePipelineRequest { + + /** ExecutePipelineRequest database */ + database?: (string|null); + + /** ExecutePipelineRequest structuredPipeline */ + structuredPipeline?: (google.firestore.v1.IStructuredPipeline|null); + + /** ExecutePipelineRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** ExecutePipelineRequest newTransaction */ + newTransaction?: (google.firestore.v1.ITransactionOptions|null); + + /** ExecutePipelineRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** ExecutePipelineRequest autoCommitTransaction */ + autoCommitTransaction?: (boolean|null); + } + + /** Represents an ExecutePipelineRequest. */ + class ExecutePipelineRequest implements IExecutePipelineRequest { + + /** + * Constructs a new ExecutePipelineRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IExecutePipelineRequest); + + /** ExecutePipelineRequest database. */ + public database: string; + + /** ExecutePipelineRequest structuredPipeline. */ + public structuredPipeline?: (google.firestore.v1.IStructuredPipeline|null); + + /** ExecutePipelineRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** ExecutePipelineRequest newTransaction. */ + public newTransaction?: (google.firestore.v1.ITransactionOptions|null); + + /** ExecutePipelineRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** ExecutePipelineRequest autoCommitTransaction. */ + public autoCommitTransaction: boolean; + + /** ExecutePipelineRequest pipelineType. */ + public pipelineType?: "structuredPipeline"; + + /** ExecutePipelineRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"newTransaction"|"readTime"); + + /** + * Creates a new ExecutePipelineRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ExecutePipelineRequest instance + */ + public static create(properties?: google.firestore.v1.IExecutePipelineRequest): google.firestore.v1.ExecutePipelineRequest; + + /** + * Encodes the specified ExecutePipelineRequest message. Does not implicitly {@link google.firestore.v1.ExecutePipelineRequest.verify|verify} messages. + * @param message ExecutePipelineRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IExecutePipelineRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExecutePipelineRequest message, length delimited. Does not implicitly {@link google.firestore.v1.ExecutePipelineRequest.verify|verify} messages. + * @param message ExecutePipelineRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IExecutePipelineRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExecutePipelineRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExecutePipelineRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ExecutePipelineRequest; + + /** + * Decodes an ExecutePipelineRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExecutePipelineRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ExecutePipelineRequest; + + /** + * Verifies an ExecutePipelineRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExecutePipelineRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExecutePipelineRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ExecutePipelineRequest; + + /** + * Creates a plain object from an ExecutePipelineRequest message. Also converts values to other types if specified. + * @param message ExecutePipelineRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ExecutePipelineRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExecutePipelineRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExecutePipelineRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExecutePipelineResponse. */ + interface IExecutePipelineResponse { + + /** ExecutePipelineResponse transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** ExecutePipelineResponse results */ + results?: (google.firestore.v1.IDocument[]|null); + + /** ExecutePipelineResponse executionTime */ + executionTime?: (google.protobuf.ITimestamp|null); + + /** ExecutePipelineResponse explainStats */ + explainStats?: (google.firestore.v1.IExplainStats|null); + } + + /** Represents an ExecutePipelineResponse. */ + class ExecutePipelineResponse implements IExecutePipelineResponse { + + /** + * Constructs a new ExecutePipelineResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IExecutePipelineResponse); + + /** ExecutePipelineResponse transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** ExecutePipelineResponse results. */ + public results: google.firestore.v1.IDocument[]; + + /** ExecutePipelineResponse executionTime. */ + public executionTime?: (google.protobuf.ITimestamp|null); + + /** ExecutePipelineResponse explainStats. */ + public explainStats?: (google.firestore.v1.IExplainStats|null); + + /** + * Creates a new ExecutePipelineResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExecutePipelineResponse instance + */ + public static create(properties?: google.firestore.v1.IExecutePipelineResponse): google.firestore.v1.ExecutePipelineResponse; + + /** + * Encodes the specified ExecutePipelineResponse message. Does not implicitly {@link google.firestore.v1.ExecutePipelineResponse.verify|verify} messages. + * @param message ExecutePipelineResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IExecutePipelineResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExecutePipelineResponse message, length delimited. Does not implicitly {@link google.firestore.v1.ExecutePipelineResponse.verify|verify} messages. + * @param message ExecutePipelineResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IExecutePipelineResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExecutePipelineResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExecutePipelineResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ExecutePipelineResponse; + + /** + * Decodes an ExecutePipelineResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExecutePipelineResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ExecutePipelineResponse; + + /** + * Verifies an ExecutePipelineResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExecutePipelineResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExecutePipelineResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ExecutePipelineResponse; + + /** + * Creates a plain object from an ExecutePipelineResponse message. Also converts values to other types if specified. + * @param message ExecutePipelineResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ExecutePipelineResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExecutePipelineResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExecutePipelineResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RunAggregationQueryRequest. */ + interface IRunAggregationQueryRequest { + + /** RunAggregationQueryRequest parent */ + parent?: (string|null); + + /** RunAggregationQueryRequest structuredAggregationQuery */ + structuredAggregationQuery?: (google.firestore.v1.IStructuredAggregationQuery|null); + + /** RunAggregationQueryRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** RunAggregationQueryRequest newTransaction */ + newTransaction?: (google.firestore.v1.ITransactionOptions|null); + + /** RunAggregationQueryRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** RunAggregationQueryRequest explainOptions */ + explainOptions?: (google.firestore.v1.IExplainOptions|null); + } + + /** Represents a RunAggregationQueryRequest. */ + class RunAggregationQueryRequest implements IRunAggregationQueryRequest { + + /** + * Constructs a new RunAggregationQueryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IRunAggregationQueryRequest); + + /** RunAggregationQueryRequest parent. */ + public parent: string; + + /** RunAggregationQueryRequest structuredAggregationQuery. */ + public structuredAggregationQuery?: (google.firestore.v1.IStructuredAggregationQuery|null); + + /** RunAggregationQueryRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** RunAggregationQueryRequest newTransaction. */ + public newTransaction?: (google.firestore.v1.ITransactionOptions|null); + + /** RunAggregationQueryRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** RunAggregationQueryRequest explainOptions. */ + public explainOptions?: (google.firestore.v1.IExplainOptions|null); + + /** RunAggregationQueryRequest queryType. */ + public queryType?: "structuredAggregationQuery"; + + /** RunAggregationQueryRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"newTransaction"|"readTime"); + + /** + * Creates a new RunAggregationQueryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RunAggregationQueryRequest instance + */ + public static create(properties?: google.firestore.v1.IRunAggregationQueryRequest): google.firestore.v1.RunAggregationQueryRequest; + + /** + * Encodes the specified RunAggregationQueryRequest message. Does not implicitly {@link google.firestore.v1.RunAggregationQueryRequest.verify|verify} messages. + * @param message RunAggregationQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IRunAggregationQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RunAggregationQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1.RunAggregationQueryRequest.verify|verify} messages. + * @param message RunAggregationQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IRunAggregationQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RunAggregationQueryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RunAggregationQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.RunAggregationQueryRequest; + + /** + * Decodes a RunAggregationQueryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RunAggregationQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.RunAggregationQueryRequest; + + /** + * Verifies a RunAggregationQueryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RunAggregationQueryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RunAggregationQueryRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.RunAggregationQueryRequest; + + /** + * Creates a plain object from a RunAggregationQueryRequest message. Also converts values to other types if specified. + * @param message RunAggregationQueryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.RunAggregationQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RunAggregationQueryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RunAggregationQueryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RunAggregationQueryResponse. */ + interface IRunAggregationQueryResponse { + + /** RunAggregationQueryResponse result */ + result?: (google.firestore.v1.IAggregationResult|null); + + /** RunAggregationQueryResponse transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** RunAggregationQueryResponse readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** RunAggregationQueryResponse explainMetrics */ + explainMetrics?: (google.firestore.v1.IExplainMetrics|null); + } + + /** Represents a RunAggregationQueryResponse. */ + class RunAggregationQueryResponse implements IRunAggregationQueryResponse { + + /** + * Constructs a new RunAggregationQueryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IRunAggregationQueryResponse); + + /** RunAggregationQueryResponse result. */ + public result?: (google.firestore.v1.IAggregationResult|null); + + /** RunAggregationQueryResponse transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** RunAggregationQueryResponse readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** RunAggregationQueryResponse explainMetrics. */ + public explainMetrics?: (google.firestore.v1.IExplainMetrics|null); + + /** + * Creates a new RunAggregationQueryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RunAggregationQueryResponse instance + */ + public static create(properties?: google.firestore.v1.IRunAggregationQueryResponse): google.firestore.v1.RunAggregationQueryResponse; + + /** + * Encodes the specified RunAggregationQueryResponse message. Does not implicitly {@link google.firestore.v1.RunAggregationQueryResponse.verify|verify} messages. + * @param message RunAggregationQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IRunAggregationQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RunAggregationQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1.RunAggregationQueryResponse.verify|verify} messages. + * @param message RunAggregationQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IRunAggregationQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RunAggregationQueryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RunAggregationQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.RunAggregationQueryResponse; + + /** + * Decodes a RunAggregationQueryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RunAggregationQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.RunAggregationQueryResponse; + + /** + * Verifies a RunAggregationQueryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RunAggregationQueryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RunAggregationQueryResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.RunAggregationQueryResponse; + + /** + * Creates a plain object from a RunAggregationQueryResponse message. Also converts values to other types if specified. + * @param message RunAggregationQueryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.RunAggregationQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RunAggregationQueryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RunAggregationQueryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PartitionQueryRequest. */ + interface IPartitionQueryRequest { + + /** PartitionQueryRequest parent */ + parent?: (string|null); + + /** PartitionQueryRequest structuredQuery */ + structuredQuery?: (google.firestore.v1.IStructuredQuery|null); + + /** PartitionQueryRequest partitionCount */ + partitionCount?: (number|Long|string|null); + + /** PartitionQueryRequest pageToken */ + pageToken?: (string|null); + + /** PartitionQueryRequest pageSize */ + pageSize?: (number|null); + + /** PartitionQueryRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a PartitionQueryRequest. */ + class PartitionQueryRequest implements IPartitionQueryRequest { + + /** + * Constructs a new PartitionQueryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IPartitionQueryRequest); + + /** PartitionQueryRequest parent. */ + public parent: string; + + /** PartitionQueryRequest structuredQuery. */ + public structuredQuery?: (google.firestore.v1.IStructuredQuery|null); + + /** PartitionQueryRequest partitionCount. */ + public partitionCount: (number|Long|string); + + /** PartitionQueryRequest pageToken. */ + public pageToken: string; + + /** PartitionQueryRequest pageSize. */ + public pageSize: number; + + /** PartitionQueryRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** PartitionQueryRequest queryType. */ + public queryType?: "structuredQuery"; + + /** PartitionQueryRequest consistencySelector. */ + public consistencySelector?: "readTime"; + + /** + * Creates a new PartitionQueryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PartitionQueryRequest instance + */ + public static create(properties?: google.firestore.v1.IPartitionQueryRequest): google.firestore.v1.PartitionQueryRequest; + + /** + * Encodes the specified PartitionQueryRequest message. Does not implicitly {@link google.firestore.v1.PartitionQueryRequest.verify|verify} messages. + * @param message PartitionQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IPartitionQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PartitionQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1.PartitionQueryRequest.verify|verify} messages. + * @param message PartitionQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IPartitionQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PartitionQueryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PartitionQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.PartitionQueryRequest; + + /** + * Decodes a PartitionQueryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PartitionQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.PartitionQueryRequest; + + /** + * Verifies a PartitionQueryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PartitionQueryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PartitionQueryRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.PartitionQueryRequest; + + /** + * Creates a plain object from a PartitionQueryRequest message. Also converts values to other types if specified. + * @param message PartitionQueryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.PartitionQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PartitionQueryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PartitionQueryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PartitionQueryResponse. */ + interface IPartitionQueryResponse { + + /** PartitionQueryResponse partitions */ + partitions?: (google.firestore.v1.ICursor[]|null); + + /** PartitionQueryResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a PartitionQueryResponse. */ + class PartitionQueryResponse implements IPartitionQueryResponse { + + /** + * Constructs a new PartitionQueryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IPartitionQueryResponse); + + /** PartitionQueryResponse partitions. */ + public partitions: google.firestore.v1.ICursor[]; + + /** PartitionQueryResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new PartitionQueryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PartitionQueryResponse instance + */ + public static create(properties?: google.firestore.v1.IPartitionQueryResponse): google.firestore.v1.PartitionQueryResponse; + + /** + * Encodes the specified PartitionQueryResponse message. Does not implicitly {@link google.firestore.v1.PartitionQueryResponse.verify|verify} messages. + * @param message PartitionQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IPartitionQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PartitionQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1.PartitionQueryResponse.verify|verify} messages. + * @param message PartitionQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IPartitionQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PartitionQueryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PartitionQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.PartitionQueryResponse; + + /** + * Decodes a PartitionQueryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PartitionQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.PartitionQueryResponse; + + /** + * Verifies a PartitionQueryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PartitionQueryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PartitionQueryResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.PartitionQueryResponse; + + /** + * Creates a plain object from a PartitionQueryResponse message. Also converts values to other types if specified. + * @param message PartitionQueryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.PartitionQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PartitionQueryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PartitionQueryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WriteRequest. */ + interface IWriteRequest { + + /** WriteRequest database */ + database?: (string|null); + + /** WriteRequest streamId */ + streamId?: (string|null); + + /** WriteRequest writes */ + writes?: (google.firestore.v1.IWrite[]|null); + + /** WriteRequest streamToken */ + streamToken?: (Uint8Array|Buffer|string|null); + + /** WriteRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a WriteRequest. */ + class WriteRequest implements IWriteRequest { + + /** + * Constructs a new WriteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IWriteRequest); + + /** WriteRequest database. */ + public database: string; + + /** WriteRequest streamId. */ + public streamId: string; + + /** WriteRequest writes. */ + public writes: google.firestore.v1.IWrite[]; + + /** WriteRequest streamToken. */ + public streamToken: (Uint8Array|Buffer|string); + + /** WriteRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new WriteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteRequest instance + */ + public static create(properties?: google.firestore.v1.IWriteRequest): google.firestore.v1.WriteRequest; + + /** + * Encodes the specified WriteRequest message. Does not implicitly {@link google.firestore.v1.WriteRequest.verify|verify} messages. + * @param message WriteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IWriteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteRequest message, length delimited. Does not implicitly {@link google.firestore.v1.WriteRequest.verify|verify} messages. + * @param message WriteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IWriteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.WriteRequest; + + /** + * Decodes a WriteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.WriteRequest; + + /** + * Verifies a WriteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.WriteRequest; + + /** + * Creates a plain object from a WriteRequest message. Also converts values to other types if specified. + * @param message WriteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.WriteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WriteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WriteResponse. */ + interface IWriteResponse { + + /** WriteResponse streamId */ + streamId?: (string|null); + + /** WriteResponse streamToken */ + streamToken?: (Uint8Array|Buffer|string|null); + + /** WriteResponse writeResults */ + writeResults?: (google.firestore.v1.IWriteResult[]|null); + + /** WriteResponse commitTime */ + commitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a WriteResponse. */ + class WriteResponse implements IWriteResponse { + + /** + * Constructs a new WriteResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IWriteResponse); + + /** WriteResponse streamId. */ + public streamId: string; + + /** WriteResponse streamToken. */ + public streamToken: (Uint8Array|Buffer|string); + + /** WriteResponse writeResults. */ + public writeResults: google.firestore.v1.IWriteResult[]; + + /** WriteResponse commitTime. */ + public commitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new WriteResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteResponse instance + */ + public static create(properties?: google.firestore.v1.IWriteResponse): google.firestore.v1.WriteResponse; + + /** + * Encodes the specified WriteResponse message. Does not implicitly {@link google.firestore.v1.WriteResponse.verify|verify} messages. + * @param message WriteResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IWriteResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteResponse message, length delimited. Does not implicitly {@link google.firestore.v1.WriteResponse.verify|verify} messages. + * @param message WriteResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IWriteResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.WriteResponse; + + /** + * Decodes a WriteResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.WriteResponse; + + /** + * Verifies a WriteResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.WriteResponse; + + /** + * Creates a plain object from a WriteResponse message. Also converts values to other types if specified. + * @param message WriteResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.WriteResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WriteResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListenRequest. */ + interface IListenRequest { + + /** ListenRequest database */ + database?: (string|null); + + /** ListenRequest addTarget */ + addTarget?: (google.firestore.v1.ITarget|null); + + /** ListenRequest removeTarget */ + removeTarget?: (number|null); + + /** ListenRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a ListenRequest. */ + class ListenRequest implements IListenRequest { + + /** + * Constructs a new ListenRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IListenRequest); + + /** ListenRequest database. */ + public database: string; + + /** ListenRequest addTarget. */ + public addTarget?: (google.firestore.v1.ITarget|null); + + /** ListenRequest removeTarget. */ + public removeTarget?: (number|null); + + /** ListenRequest labels. */ + public labels: { [k: string]: string }; + + /** ListenRequest targetChange. */ + public targetChange?: ("addTarget"|"removeTarget"); + + /** + * Creates a new ListenRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListenRequest instance + */ + public static create(properties?: google.firestore.v1.IListenRequest): google.firestore.v1.ListenRequest; + + /** + * Encodes the specified ListenRequest message. Does not implicitly {@link google.firestore.v1.ListenRequest.verify|verify} messages. + * @param message ListenRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IListenRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListenRequest message, length delimited. Does not implicitly {@link google.firestore.v1.ListenRequest.verify|verify} messages. + * @param message ListenRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IListenRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListenRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListenRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ListenRequest; + + /** + * Decodes a ListenRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListenRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ListenRequest; + + /** + * Verifies a ListenRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListenRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListenRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ListenRequest; + + /** + * Creates a plain object from a ListenRequest message. Also converts values to other types if specified. + * @param message ListenRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ListenRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListenRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListenRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListenResponse. */ + interface IListenResponse { + + /** ListenResponse targetChange */ + targetChange?: (google.firestore.v1.ITargetChange|null); + + /** ListenResponse documentChange */ + documentChange?: (google.firestore.v1.IDocumentChange|null); + + /** ListenResponse documentDelete */ + documentDelete?: (google.firestore.v1.IDocumentDelete|null); + + /** ListenResponse documentRemove */ + documentRemove?: (google.firestore.v1.IDocumentRemove|null); + + /** ListenResponse filter */ + filter?: (google.firestore.v1.IExistenceFilter|null); + } + + /** Represents a ListenResponse. */ + class ListenResponse implements IListenResponse { + + /** + * Constructs a new ListenResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IListenResponse); + + /** ListenResponse targetChange. */ + public targetChange?: (google.firestore.v1.ITargetChange|null); + + /** ListenResponse documentChange. */ + public documentChange?: (google.firestore.v1.IDocumentChange|null); + + /** ListenResponse documentDelete. */ + public documentDelete?: (google.firestore.v1.IDocumentDelete|null); + + /** ListenResponse documentRemove. */ + public documentRemove?: (google.firestore.v1.IDocumentRemove|null); + + /** ListenResponse filter. */ + public filter?: (google.firestore.v1.IExistenceFilter|null); + + /** ListenResponse responseType. */ + public responseType?: ("targetChange"|"documentChange"|"documentDelete"|"documentRemove"|"filter"); + + /** + * Creates a new ListenResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListenResponse instance + */ + public static create(properties?: google.firestore.v1.IListenResponse): google.firestore.v1.ListenResponse; + + /** + * Encodes the specified ListenResponse message. Does not implicitly {@link google.firestore.v1.ListenResponse.verify|verify} messages. + * @param message ListenResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IListenResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListenResponse message, length delimited. Does not implicitly {@link google.firestore.v1.ListenResponse.verify|verify} messages. + * @param message ListenResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IListenResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListenResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListenResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ListenResponse; + + /** + * Decodes a ListenResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListenResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ListenResponse; + + /** + * Verifies a ListenResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListenResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListenResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ListenResponse; + + /** + * Creates a plain object from a ListenResponse message. Also converts values to other types if specified. + * @param message ListenResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ListenResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListenResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListenResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Target. */ + interface ITarget { + + /** Target query */ + query?: (google.firestore.v1.Target.IQueryTarget|null); + + /** Target documents */ + documents?: (google.firestore.v1.Target.IDocumentsTarget|null); + + /** Target resumeToken */ + resumeToken?: (Uint8Array|Buffer|string|null); + + /** Target readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** Target targetId */ + targetId?: (number|null); + + /** Target once */ + once?: (boolean|null); + + /** Target expectedCount */ + expectedCount?: (google.protobuf.IInt32Value|null); + } + + /** Represents a Target. */ + class Target implements ITarget { + + /** + * Constructs a new Target. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.ITarget); + + /** Target query. */ + public query?: (google.firestore.v1.Target.IQueryTarget|null); + + /** Target documents. */ + public documents?: (google.firestore.v1.Target.IDocumentsTarget|null); + + /** Target resumeToken. */ + public resumeToken?: (Uint8Array|Buffer|string|null); + + /** Target readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** Target targetId. */ + public targetId: number; + + /** Target once. */ + public once: boolean; + + /** Target expectedCount. */ + public expectedCount?: (google.protobuf.IInt32Value|null); + + /** Target targetType. */ + public targetType?: ("query"|"documents"); + + /** Target resumeType. */ + public resumeType?: ("resumeToken"|"readTime"); + + /** + * Creates a new Target instance using the specified properties. + * @param [properties] Properties to set + * @returns Target instance + */ + public static create(properties?: google.firestore.v1.ITarget): google.firestore.v1.Target; + + /** + * Encodes the specified Target message. Does not implicitly {@link google.firestore.v1.Target.verify|verify} messages. + * @param message Target message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.ITarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Target message, length delimited. Does not implicitly {@link google.firestore.v1.Target.verify|verify} messages. + * @param message Target message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.ITarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Target message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Target + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Target; + + /** + * Decodes a Target message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Target + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Target; + + /** + * Verifies a Target message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Target message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Target + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Target; + + /** + * Creates a plain object from a Target message. Also converts values to other types if specified. + * @param message Target + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Target, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Target to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Target + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Target { + + /** Properties of a DocumentsTarget. */ + interface IDocumentsTarget { + + /** DocumentsTarget documents */ + documents?: (string[]|null); + } + + /** Represents a DocumentsTarget. */ + class DocumentsTarget implements IDocumentsTarget { + + /** + * Constructs a new DocumentsTarget. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.Target.IDocumentsTarget); + + /** DocumentsTarget documents. */ + public documents: string[]; + + /** + * Creates a new DocumentsTarget instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentsTarget instance + */ + public static create(properties?: google.firestore.v1.Target.IDocumentsTarget): google.firestore.v1.Target.DocumentsTarget; + + /** + * Encodes the specified DocumentsTarget message. Does not implicitly {@link google.firestore.v1.Target.DocumentsTarget.verify|verify} messages. + * @param message DocumentsTarget message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.Target.IDocumentsTarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentsTarget message, length delimited. Does not implicitly {@link google.firestore.v1.Target.DocumentsTarget.verify|verify} messages. + * @param message DocumentsTarget message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.Target.IDocumentsTarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentsTarget message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentsTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Target.DocumentsTarget; + + /** + * Decodes a DocumentsTarget message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentsTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Target.DocumentsTarget; + + /** + * Verifies a DocumentsTarget message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentsTarget message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentsTarget + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Target.DocumentsTarget; + + /** + * Creates a plain object from a DocumentsTarget message. Also converts values to other types if specified. + * @param message DocumentsTarget + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Target.DocumentsTarget, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentsTarget to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentsTarget + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryTarget. */ + interface IQueryTarget { + + /** QueryTarget parent */ + parent?: (string|null); + + /** QueryTarget structuredQuery */ + structuredQuery?: (google.firestore.v1.IStructuredQuery|null); + } + + /** Represents a QueryTarget. */ + class QueryTarget implements IQueryTarget { + + /** + * Constructs a new QueryTarget. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.Target.IQueryTarget); + + /** QueryTarget parent. */ + public parent: string; + + /** QueryTarget structuredQuery. */ + public structuredQuery?: (google.firestore.v1.IStructuredQuery|null); + + /** QueryTarget queryType. */ + public queryType?: "structuredQuery"; + + /** + * Creates a new QueryTarget instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryTarget instance + */ + public static create(properties?: google.firestore.v1.Target.IQueryTarget): google.firestore.v1.Target.QueryTarget; + + /** + * Encodes the specified QueryTarget message. Does not implicitly {@link google.firestore.v1.Target.QueryTarget.verify|verify} messages. + * @param message QueryTarget message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.Target.IQueryTarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryTarget message, length delimited. Does not implicitly {@link google.firestore.v1.Target.QueryTarget.verify|verify} messages. + * @param message QueryTarget message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.Target.IQueryTarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryTarget message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Target.QueryTarget; + + /** + * Decodes a QueryTarget message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Target.QueryTarget; + + /** + * Verifies a QueryTarget message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryTarget message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryTarget + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Target.QueryTarget; + + /** + * Creates a plain object from a QueryTarget message. Also converts values to other types if specified. + * @param message QueryTarget + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Target.QueryTarget, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryTarget to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryTarget + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a TargetChange. */ + interface ITargetChange { + + /** TargetChange targetChangeType */ + targetChangeType?: (google.firestore.v1.TargetChange.TargetChangeType|keyof typeof google.firestore.v1.TargetChange.TargetChangeType|null); + + /** TargetChange targetIds */ + targetIds?: (number[]|null); + + /** TargetChange cause */ + cause?: (google.rpc.IStatus|null); + + /** TargetChange resumeToken */ + resumeToken?: (Uint8Array|Buffer|string|null); + + /** TargetChange readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a TargetChange. */ + class TargetChange implements ITargetChange { + + /** + * Constructs a new TargetChange. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.ITargetChange); + + /** TargetChange targetChangeType. */ + public targetChangeType: (google.firestore.v1.TargetChange.TargetChangeType|keyof typeof google.firestore.v1.TargetChange.TargetChangeType); + + /** TargetChange targetIds. */ + public targetIds: number[]; + + /** TargetChange cause. */ + public cause?: (google.rpc.IStatus|null); + + /** TargetChange resumeToken. */ + public resumeToken: (Uint8Array|Buffer|string); + + /** TargetChange readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new TargetChange instance using the specified properties. + * @param [properties] Properties to set + * @returns TargetChange instance + */ + public static create(properties?: google.firestore.v1.ITargetChange): google.firestore.v1.TargetChange; + + /** + * Encodes the specified TargetChange message. Does not implicitly {@link google.firestore.v1.TargetChange.verify|verify} messages. + * @param message TargetChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.ITargetChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TargetChange message, length delimited. Does not implicitly {@link google.firestore.v1.TargetChange.verify|verify} messages. + * @param message TargetChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.ITargetChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TargetChange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TargetChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.TargetChange; + + /** + * Decodes a TargetChange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TargetChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.TargetChange; + + /** + * Verifies a TargetChange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TargetChange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TargetChange + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.TargetChange; + + /** + * Creates a plain object from a TargetChange message. Also converts values to other types if specified. + * @param message TargetChange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.TargetChange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TargetChange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TargetChange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TargetChange { + + /** TargetChangeType enum. */ + enum TargetChangeType { + NO_CHANGE = 0, + ADD = 1, + REMOVE = 2, + CURRENT = 3, + RESET = 4 + } + } + + /** Properties of a ListCollectionIdsRequest. */ + interface IListCollectionIdsRequest { + + /** ListCollectionIdsRequest parent */ + parent?: (string|null); + + /** ListCollectionIdsRequest pageSize */ + pageSize?: (number|null); + + /** ListCollectionIdsRequest pageToken */ + pageToken?: (string|null); + + /** ListCollectionIdsRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a ListCollectionIdsRequest. */ + class ListCollectionIdsRequest implements IListCollectionIdsRequest { + + /** + * Constructs a new ListCollectionIdsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IListCollectionIdsRequest); + + /** ListCollectionIdsRequest parent. */ + public parent: string; + + /** ListCollectionIdsRequest pageSize. */ + public pageSize: number; + + /** ListCollectionIdsRequest pageToken. */ + public pageToken: string; + + /** ListCollectionIdsRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** ListCollectionIdsRequest consistencySelector. */ + public consistencySelector?: "readTime"; + + /** + * Creates a new ListCollectionIdsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCollectionIdsRequest instance + */ + public static create(properties?: google.firestore.v1.IListCollectionIdsRequest): google.firestore.v1.ListCollectionIdsRequest; + + /** + * Encodes the specified ListCollectionIdsRequest message. Does not implicitly {@link google.firestore.v1.ListCollectionIdsRequest.verify|verify} messages. + * @param message ListCollectionIdsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IListCollectionIdsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCollectionIdsRequest message, length delimited. Does not implicitly {@link google.firestore.v1.ListCollectionIdsRequest.verify|verify} messages. + * @param message ListCollectionIdsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IListCollectionIdsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCollectionIdsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCollectionIdsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ListCollectionIdsRequest; + + /** + * Decodes a ListCollectionIdsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCollectionIdsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ListCollectionIdsRequest; + + /** + * Verifies a ListCollectionIdsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCollectionIdsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCollectionIdsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ListCollectionIdsRequest; + + /** + * Creates a plain object from a ListCollectionIdsRequest message. Also converts values to other types if specified. + * @param message ListCollectionIdsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ListCollectionIdsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCollectionIdsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCollectionIdsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListCollectionIdsResponse. */ + interface IListCollectionIdsResponse { + + /** ListCollectionIdsResponse collectionIds */ + collectionIds?: (string[]|null); + + /** ListCollectionIdsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListCollectionIdsResponse. */ + class ListCollectionIdsResponse implements IListCollectionIdsResponse { + + /** + * Constructs a new ListCollectionIdsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IListCollectionIdsResponse); + + /** ListCollectionIdsResponse collectionIds. */ + public collectionIds: string[]; + + /** ListCollectionIdsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListCollectionIdsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCollectionIdsResponse instance + */ + public static create(properties?: google.firestore.v1.IListCollectionIdsResponse): google.firestore.v1.ListCollectionIdsResponse; + + /** + * Encodes the specified ListCollectionIdsResponse message. Does not implicitly {@link google.firestore.v1.ListCollectionIdsResponse.verify|verify} messages. + * @param message ListCollectionIdsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IListCollectionIdsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCollectionIdsResponse message, length delimited. Does not implicitly {@link google.firestore.v1.ListCollectionIdsResponse.verify|verify} messages. + * @param message ListCollectionIdsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IListCollectionIdsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCollectionIdsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCollectionIdsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ListCollectionIdsResponse; + + /** + * Decodes a ListCollectionIdsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCollectionIdsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ListCollectionIdsResponse; + + /** + * Verifies a ListCollectionIdsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCollectionIdsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCollectionIdsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ListCollectionIdsResponse; + + /** + * Creates a plain object from a ListCollectionIdsResponse message. Also converts values to other types if specified. + * @param message ListCollectionIdsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ListCollectionIdsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCollectionIdsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCollectionIdsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchWriteRequest. */ + interface IBatchWriteRequest { + + /** BatchWriteRequest database */ + database?: (string|null); + + /** BatchWriteRequest writes */ + writes?: (google.firestore.v1.IWrite[]|null); + + /** BatchWriteRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a BatchWriteRequest. */ + class BatchWriteRequest implements IBatchWriteRequest { + + /** + * Constructs a new BatchWriteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IBatchWriteRequest); + + /** BatchWriteRequest database. */ + public database: string; + + /** BatchWriteRequest writes. */ + public writes: google.firestore.v1.IWrite[]; + + /** BatchWriteRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new BatchWriteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchWriteRequest instance + */ + public static create(properties?: google.firestore.v1.IBatchWriteRequest): google.firestore.v1.BatchWriteRequest; + + /** + * Encodes the specified BatchWriteRequest message. Does not implicitly {@link google.firestore.v1.BatchWriteRequest.verify|verify} messages. + * @param message BatchWriteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IBatchWriteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchWriteRequest message, length delimited. Does not implicitly {@link google.firestore.v1.BatchWriteRequest.verify|verify} messages. + * @param message BatchWriteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IBatchWriteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchWriteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchWriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.BatchWriteRequest; + + /** + * Decodes a BatchWriteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchWriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.BatchWriteRequest; + + /** + * Verifies a BatchWriteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchWriteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchWriteRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.BatchWriteRequest; + + /** + * Creates a plain object from a BatchWriteRequest message. Also converts values to other types if specified. + * @param message BatchWriteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.BatchWriteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchWriteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchWriteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchWriteResponse. */ + interface IBatchWriteResponse { + + /** BatchWriteResponse writeResults */ + writeResults?: (google.firestore.v1.IWriteResult[]|null); + + /** BatchWriteResponse status */ + status?: (google.rpc.IStatus[]|null); + } + + /** Represents a BatchWriteResponse. */ + class BatchWriteResponse implements IBatchWriteResponse { + + /** + * Constructs a new BatchWriteResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IBatchWriteResponse); + + /** BatchWriteResponse writeResults. */ + public writeResults: google.firestore.v1.IWriteResult[]; + + /** BatchWriteResponse status. */ + public status: google.rpc.IStatus[]; + + /** + * Creates a new BatchWriteResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchWriteResponse instance + */ + public static create(properties?: google.firestore.v1.IBatchWriteResponse): google.firestore.v1.BatchWriteResponse; + + /** + * Encodes the specified BatchWriteResponse message. Does not implicitly {@link google.firestore.v1.BatchWriteResponse.verify|verify} messages. + * @param message BatchWriteResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IBatchWriteResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchWriteResponse message, length delimited. Does not implicitly {@link google.firestore.v1.BatchWriteResponse.verify|verify} messages. + * @param message BatchWriteResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IBatchWriteResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchWriteResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchWriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.BatchWriteResponse; + + /** + * Decodes a BatchWriteResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchWriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.BatchWriteResponse; + + /** + * Verifies a BatchWriteResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchWriteResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchWriteResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.BatchWriteResponse; + + /** + * Creates a plain object from a BatchWriteResponse message. Also converts values to other types if specified. + * @param message BatchWriteResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.BatchWriteResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchWriteResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchWriteResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StructuredPipeline. */ + interface IStructuredPipeline { + + /** StructuredPipeline pipeline */ + pipeline?: (google.firestore.v1.IPipeline|null); + + /** StructuredPipeline options */ + options?: ({ [k: string]: google.firestore.v1.IValue }|null); + } + + /** Represents a StructuredPipeline. */ + class StructuredPipeline implements IStructuredPipeline { + + /** + * Constructs a new StructuredPipeline. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IStructuredPipeline); + + /** StructuredPipeline pipeline. */ + public pipeline?: (google.firestore.v1.IPipeline|null); + + /** StructuredPipeline options. */ + public options: { [k: string]: google.firestore.v1.IValue }; + + /** + * Creates a new StructuredPipeline instance using the specified properties. + * @param [properties] Properties to set + * @returns StructuredPipeline instance + */ + public static create(properties?: google.firestore.v1.IStructuredPipeline): google.firestore.v1.StructuredPipeline; + + /** + * Encodes the specified StructuredPipeline message. Does not implicitly {@link google.firestore.v1.StructuredPipeline.verify|verify} messages. + * @param message StructuredPipeline message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IStructuredPipeline, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StructuredPipeline message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredPipeline.verify|verify} messages. + * @param message StructuredPipeline message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IStructuredPipeline, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StructuredPipeline message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StructuredPipeline + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredPipeline; + + /** + * Decodes a StructuredPipeline message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StructuredPipeline + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredPipeline; + + /** + * Verifies a StructuredPipeline message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StructuredPipeline message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StructuredPipeline + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredPipeline; + + /** + * Creates a plain object from a StructuredPipeline message. Also converts values to other types if specified. + * @param message StructuredPipeline + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredPipeline, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StructuredPipeline to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StructuredPipeline + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StructuredQuery. */ + interface IStructuredQuery { + + /** StructuredQuery select */ + select?: (google.firestore.v1.StructuredQuery.IProjection|null); + + /** StructuredQuery from */ + from?: (google.firestore.v1.StructuredQuery.ICollectionSelector[]|null); + + /** StructuredQuery where */ + where?: (google.firestore.v1.StructuredQuery.IFilter|null); + + /** StructuredQuery orderBy */ + orderBy?: (google.firestore.v1.StructuredQuery.IOrder[]|null); + + /** StructuredQuery startAt */ + startAt?: (google.firestore.v1.ICursor|null); + + /** StructuredQuery endAt */ + endAt?: (google.firestore.v1.ICursor|null); + + /** StructuredQuery offset */ + offset?: (number|null); + + /** StructuredQuery limit */ + limit?: (google.protobuf.IInt32Value|null); + + /** StructuredQuery findNearest */ + findNearest?: (google.firestore.v1.StructuredQuery.IFindNearest|null); + } + + /** Represents a StructuredQuery. */ + class StructuredQuery implements IStructuredQuery { + + /** + * Constructs a new StructuredQuery. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IStructuredQuery); + + /** StructuredQuery select. */ + public select?: (google.firestore.v1.StructuredQuery.IProjection|null); + + /** StructuredQuery from. */ + public from: google.firestore.v1.StructuredQuery.ICollectionSelector[]; + + /** StructuredQuery where. */ + public where?: (google.firestore.v1.StructuredQuery.IFilter|null); + + /** StructuredQuery orderBy. */ + public orderBy: google.firestore.v1.StructuredQuery.IOrder[]; + + /** StructuredQuery startAt. */ + public startAt?: (google.firestore.v1.ICursor|null); + + /** StructuredQuery endAt. */ + public endAt?: (google.firestore.v1.ICursor|null); + + /** StructuredQuery offset. */ + public offset: number; + + /** StructuredQuery limit. */ + public limit?: (google.protobuf.IInt32Value|null); + + /** StructuredQuery findNearest. */ + public findNearest?: (google.firestore.v1.StructuredQuery.IFindNearest|null); + + /** + * Creates a new StructuredQuery instance using the specified properties. + * @param [properties] Properties to set + * @returns StructuredQuery instance + */ + public static create(properties?: google.firestore.v1.IStructuredQuery): google.firestore.v1.StructuredQuery; + + /** + * Encodes the specified StructuredQuery message. Does not implicitly {@link google.firestore.v1.StructuredQuery.verify|verify} messages. + * @param message StructuredQuery message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IStructuredQuery, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StructuredQuery message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.verify|verify} messages. + * @param message StructuredQuery message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IStructuredQuery, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StructuredQuery message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StructuredQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery; + + /** + * Decodes a StructuredQuery message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StructuredQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery; + + /** + * Verifies a StructuredQuery message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StructuredQuery message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StructuredQuery + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery; + + /** + * Creates a plain object from a StructuredQuery message. Also converts values to other types if specified. + * @param message StructuredQuery + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StructuredQuery to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StructuredQuery + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace StructuredQuery { + + /** Properties of a CollectionSelector. */ + interface ICollectionSelector { + + /** CollectionSelector collectionId */ + collectionId?: (string|null); + + /** CollectionSelector allDescendants */ + allDescendants?: (boolean|null); + } + + /** Represents a CollectionSelector. */ + class CollectionSelector implements ICollectionSelector { + + /** + * Constructs a new CollectionSelector. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredQuery.ICollectionSelector); + + /** CollectionSelector collectionId. */ + public collectionId: string; + + /** CollectionSelector allDescendants. */ + public allDescendants: boolean; + + /** + * Creates a new CollectionSelector instance using the specified properties. + * @param [properties] Properties to set + * @returns CollectionSelector instance + */ + public static create(properties?: google.firestore.v1.StructuredQuery.ICollectionSelector): google.firestore.v1.StructuredQuery.CollectionSelector; + + /** + * Encodes the specified CollectionSelector message. Does not implicitly {@link google.firestore.v1.StructuredQuery.CollectionSelector.verify|verify} messages. + * @param message CollectionSelector message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredQuery.ICollectionSelector, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CollectionSelector message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.CollectionSelector.verify|verify} messages. + * @param message CollectionSelector message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredQuery.ICollectionSelector, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CollectionSelector message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CollectionSelector + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery.CollectionSelector; + + /** + * Decodes a CollectionSelector message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CollectionSelector + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery.CollectionSelector; + + /** + * Verifies a CollectionSelector message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CollectionSelector message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CollectionSelector + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery.CollectionSelector; + + /** + * Creates a plain object from a CollectionSelector message. Also converts values to other types if specified. + * @param message CollectionSelector + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery.CollectionSelector, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CollectionSelector to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CollectionSelector + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Filter. */ + interface IFilter { + + /** Filter compositeFilter */ + compositeFilter?: (google.firestore.v1.StructuredQuery.ICompositeFilter|null); + + /** Filter fieldFilter */ + fieldFilter?: (google.firestore.v1.StructuredQuery.IFieldFilter|null); + + /** Filter unaryFilter */ + unaryFilter?: (google.firestore.v1.StructuredQuery.IUnaryFilter|null); + } + + /** Represents a Filter. */ + class Filter implements IFilter { + + /** + * Constructs a new Filter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredQuery.IFilter); + + /** Filter compositeFilter. */ + public compositeFilter?: (google.firestore.v1.StructuredQuery.ICompositeFilter|null); + + /** Filter fieldFilter. */ + public fieldFilter?: (google.firestore.v1.StructuredQuery.IFieldFilter|null); + + /** Filter unaryFilter. */ + public unaryFilter?: (google.firestore.v1.StructuredQuery.IUnaryFilter|null); + + /** Filter filterType. */ + public filterType?: ("compositeFilter"|"fieldFilter"|"unaryFilter"); + + /** + * Creates a new Filter instance using the specified properties. + * @param [properties] Properties to set + * @returns Filter instance + */ + public static create(properties?: google.firestore.v1.StructuredQuery.IFilter): google.firestore.v1.StructuredQuery.Filter; + + /** + * Encodes the specified Filter message. Does not implicitly {@link google.firestore.v1.StructuredQuery.Filter.verify|verify} messages. + * @param message Filter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredQuery.IFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Filter message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.Filter.verify|verify} messages. + * @param message Filter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredQuery.IFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Filter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery.Filter; + + /** + * Decodes a Filter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery.Filter; + + /** + * Verifies a Filter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Filter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Filter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery.Filter; + + /** + * Creates a plain object from a Filter message. Also converts values to other types if specified. + * @param message Filter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery.Filter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Filter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Filter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CompositeFilter. */ + interface ICompositeFilter { + + /** CompositeFilter op */ + op?: (google.firestore.v1.StructuredQuery.CompositeFilter.Operator|keyof typeof google.firestore.v1.StructuredQuery.CompositeFilter.Operator|null); + + /** CompositeFilter filters */ + filters?: (google.firestore.v1.StructuredQuery.IFilter[]|null); + } + + /** Represents a CompositeFilter. */ + class CompositeFilter implements ICompositeFilter { + + /** + * Constructs a new CompositeFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredQuery.ICompositeFilter); + + /** CompositeFilter op. */ + public op: (google.firestore.v1.StructuredQuery.CompositeFilter.Operator|keyof typeof google.firestore.v1.StructuredQuery.CompositeFilter.Operator); + + /** CompositeFilter filters. */ + public filters: google.firestore.v1.StructuredQuery.IFilter[]; + + /** + * Creates a new CompositeFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns CompositeFilter instance + */ + public static create(properties?: google.firestore.v1.StructuredQuery.ICompositeFilter): google.firestore.v1.StructuredQuery.CompositeFilter; + + /** + * Encodes the specified CompositeFilter message. Does not implicitly {@link google.firestore.v1.StructuredQuery.CompositeFilter.verify|verify} messages. + * @param message CompositeFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredQuery.ICompositeFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompositeFilter message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.CompositeFilter.verify|verify} messages. + * @param message CompositeFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredQuery.ICompositeFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompositeFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompositeFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery.CompositeFilter; + + /** + * Decodes a CompositeFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompositeFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery.CompositeFilter; + + /** + * Verifies a CompositeFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompositeFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompositeFilter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery.CompositeFilter; + + /** + * Creates a plain object from a CompositeFilter message. Also converts values to other types if specified. + * @param message CompositeFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery.CompositeFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompositeFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompositeFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CompositeFilter { + + /** Operator enum. */ + enum Operator { + OPERATOR_UNSPECIFIED = 0, + AND = 1, + OR = 2 + } + } + + /** Properties of a FieldFilter. */ + interface IFieldFilter { + + /** FieldFilter field */ + field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + + /** FieldFilter op */ + op?: (google.firestore.v1.StructuredQuery.FieldFilter.Operator|keyof typeof google.firestore.v1.StructuredQuery.FieldFilter.Operator|null); + + /** FieldFilter value */ + value?: (google.firestore.v1.IValue|null); + } + + /** Represents a FieldFilter. */ + class FieldFilter implements IFieldFilter { + + /** + * Constructs a new FieldFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredQuery.IFieldFilter); + + /** FieldFilter field. */ + public field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + + /** FieldFilter op. */ + public op: (google.firestore.v1.StructuredQuery.FieldFilter.Operator|keyof typeof google.firestore.v1.StructuredQuery.FieldFilter.Operator); + + /** FieldFilter value. */ + public value?: (google.firestore.v1.IValue|null); + + /** + * Creates a new FieldFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldFilter instance + */ + public static create(properties?: google.firestore.v1.StructuredQuery.IFieldFilter): google.firestore.v1.StructuredQuery.FieldFilter; + + /** + * Encodes the specified FieldFilter message. Does not implicitly {@link google.firestore.v1.StructuredQuery.FieldFilter.verify|verify} messages. + * @param message FieldFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredQuery.IFieldFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldFilter message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.FieldFilter.verify|verify} messages. + * @param message FieldFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredQuery.IFieldFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery.FieldFilter; + + /** + * Decodes a FieldFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery.FieldFilter; + + /** + * Verifies a FieldFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldFilter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery.FieldFilter; + + /** + * Creates a plain object from a FieldFilter message. Also converts values to other types if specified. + * @param message FieldFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery.FieldFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldFilter { + + /** Operator enum. */ + enum Operator { + OPERATOR_UNSPECIFIED = 0, + LESS_THAN = 1, + LESS_THAN_OR_EQUAL = 2, + GREATER_THAN = 3, + GREATER_THAN_OR_EQUAL = 4, + EQUAL = 5, + NOT_EQUAL = 6, + ARRAY_CONTAINS = 7, + IN = 8, + ARRAY_CONTAINS_ANY = 9, + NOT_IN = 10 + } + } + + /** Properties of an UnaryFilter. */ + interface IUnaryFilter { + + /** UnaryFilter op */ + op?: (google.firestore.v1.StructuredQuery.UnaryFilter.Operator|keyof typeof google.firestore.v1.StructuredQuery.UnaryFilter.Operator|null); + + /** UnaryFilter field */ + field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + } + + /** Represents an UnaryFilter. */ + class UnaryFilter implements IUnaryFilter { + + /** + * Constructs a new UnaryFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredQuery.IUnaryFilter); + + /** UnaryFilter op. */ + public op: (google.firestore.v1.StructuredQuery.UnaryFilter.Operator|keyof typeof google.firestore.v1.StructuredQuery.UnaryFilter.Operator); + + /** UnaryFilter field. */ + public field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + + /** UnaryFilter operandType. */ + public operandType?: "field"; + + /** + * Creates a new UnaryFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns UnaryFilter instance + */ + public static create(properties?: google.firestore.v1.StructuredQuery.IUnaryFilter): google.firestore.v1.StructuredQuery.UnaryFilter; + + /** + * Encodes the specified UnaryFilter message. Does not implicitly {@link google.firestore.v1.StructuredQuery.UnaryFilter.verify|verify} messages. + * @param message UnaryFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredQuery.IUnaryFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UnaryFilter message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.UnaryFilter.verify|verify} messages. + * @param message UnaryFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredQuery.IUnaryFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UnaryFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UnaryFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery.UnaryFilter; + + /** + * Decodes an UnaryFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UnaryFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery.UnaryFilter; + + /** + * Verifies an UnaryFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UnaryFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UnaryFilter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery.UnaryFilter; + + /** + * Creates a plain object from an UnaryFilter message. Also converts values to other types if specified. + * @param message UnaryFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery.UnaryFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UnaryFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UnaryFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UnaryFilter { + + /** Operator enum. */ + enum Operator { + OPERATOR_UNSPECIFIED = 0, + IS_NAN = 2, + IS_NULL = 3, + IS_NOT_NAN = 4, + IS_NOT_NULL = 5 + } + } + + /** Properties of an Order. */ + interface IOrder { + + /** Order field */ + field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + + /** Order direction */ + direction?: (google.firestore.v1.StructuredQuery.Direction|keyof typeof google.firestore.v1.StructuredQuery.Direction|null); + } + + /** Represents an Order. */ + class Order implements IOrder { + + /** + * Constructs a new Order. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredQuery.IOrder); + + /** Order field. */ + public field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + + /** Order direction. */ + public direction: (google.firestore.v1.StructuredQuery.Direction|keyof typeof google.firestore.v1.StructuredQuery.Direction); + + /** + * Creates a new Order instance using the specified properties. + * @param [properties] Properties to set + * @returns Order instance + */ + public static create(properties?: google.firestore.v1.StructuredQuery.IOrder): google.firestore.v1.StructuredQuery.Order; + + /** + * Encodes the specified Order message. Does not implicitly {@link google.firestore.v1.StructuredQuery.Order.verify|verify} messages. + * @param message Order message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredQuery.IOrder, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Order message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.Order.verify|verify} messages. + * @param message Order message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredQuery.IOrder, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Order message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Order + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery.Order; + + /** + * Decodes an Order message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Order + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery.Order; + + /** + * Verifies an Order message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Order message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Order + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery.Order; + + /** + * Creates a plain object from an Order message. Also converts values to other types if specified. + * @param message Order + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery.Order, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Order to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Order + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Direction enum. */ + enum Direction { + DIRECTION_UNSPECIFIED = 0, + ASCENDING = 1, + DESCENDING = 2 + } + + /** Properties of a FieldReference. */ + interface IFieldReference { + + /** FieldReference fieldPath */ + fieldPath?: (string|null); + } + + /** Represents a FieldReference. */ + class FieldReference implements IFieldReference { + + /** + * Constructs a new FieldReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredQuery.IFieldReference); + + /** FieldReference fieldPath. */ + public fieldPath: string; + + /** + * Creates a new FieldReference instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldReference instance + */ + public static create(properties?: google.firestore.v1.StructuredQuery.IFieldReference): google.firestore.v1.StructuredQuery.FieldReference; + + /** + * Encodes the specified FieldReference message. Does not implicitly {@link google.firestore.v1.StructuredQuery.FieldReference.verify|verify} messages. + * @param message FieldReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredQuery.IFieldReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldReference message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.FieldReference.verify|verify} messages. + * @param message FieldReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredQuery.IFieldReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery.FieldReference; + + /** + * Decodes a FieldReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery.FieldReference; + + /** + * Verifies a FieldReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldReference + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery.FieldReference; + + /** + * Creates a plain object from a FieldReference message. Also converts values to other types if specified. + * @param message FieldReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery.FieldReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Projection. */ + interface IProjection { + + /** Projection fields */ + fields?: (google.firestore.v1.StructuredQuery.IFieldReference[]|null); + } + + /** Represents a Projection. */ + class Projection implements IProjection { + + /** + * Constructs a new Projection. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredQuery.IProjection); + + /** Projection fields. */ + public fields: google.firestore.v1.StructuredQuery.IFieldReference[]; + + /** + * Creates a new Projection instance using the specified properties. + * @param [properties] Properties to set + * @returns Projection instance + */ + public static create(properties?: google.firestore.v1.StructuredQuery.IProjection): google.firestore.v1.StructuredQuery.Projection; + + /** + * Encodes the specified Projection message. Does not implicitly {@link google.firestore.v1.StructuredQuery.Projection.verify|verify} messages. + * @param message Projection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredQuery.IProjection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Projection message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.Projection.verify|verify} messages. + * @param message Projection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredQuery.IProjection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Projection message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Projection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery.Projection; + + /** + * Decodes a Projection message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Projection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery.Projection; + + /** + * Verifies a Projection message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Projection message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Projection + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery.Projection; + + /** + * Creates a plain object from a Projection message. Also converts values to other types if specified. + * @param message Projection + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery.Projection, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Projection to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Projection + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FindNearest. */ + interface IFindNearest { + + /** FindNearest vectorField */ + vectorField?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + + /** FindNearest queryVector */ + queryVector?: (google.firestore.v1.IValue|null); + + /** FindNearest distanceMeasure */ + distanceMeasure?: (google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure|keyof typeof google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure|null); + + /** FindNearest limit */ + limit?: (google.protobuf.IInt32Value|null); + + /** FindNearest distanceResultField */ + distanceResultField?: (string|null); + + /** FindNearest distanceThreshold */ + distanceThreshold?: (google.protobuf.IDoubleValue|null); + } + + /** Represents a FindNearest. */ + class FindNearest implements IFindNearest { + + /** + * Constructs a new FindNearest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredQuery.IFindNearest); + + /** FindNearest vectorField. */ + public vectorField?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + + /** FindNearest queryVector. */ + public queryVector?: (google.firestore.v1.IValue|null); + + /** FindNearest distanceMeasure. */ + public distanceMeasure: (google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure|keyof typeof google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure); + + /** FindNearest limit. */ + public limit?: (google.protobuf.IInt32Value|null); + + /** FindNearest distanceResultField. */ + public distanceResultField: string; + + /** FindNearest distanceThreshold. */ + public distanceThreshold?: (google.protobuf.IDoubleValue|null); + + /** + * Creates a new FindNearest instance using the specified properties. + * @param [properties] Properties to set + * @returns FindNearest instance + */ + public static create(properties?: google.firestore.v1.StructuredQuery.IFindNearest): google.firestore.v1.StructuredQuery.FindNearest; + + /** + * Encodes the specified FindNearest message. Does not implicitly {@link google.firestore.v1.StructuredQuery.FindNearest.verify|verify} messages. + * @param message FindNearest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredQuery.IFindNearest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FindNearest message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.FindNearest.verify|verify} messages. + * @param message FindNearest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredQuery.IFindNearest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FindNearest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FindNearest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredQuery.FindNearest; + + /** + * Decodes a FindNearest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FindNearest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredQuery.FindNearest; + + /** + * Verifies a FindNearest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FindNearest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FindNearest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredQuery.FindNearest; + + /** + * Creates a plain object from a FindNearest message. Also converts values to other types if specified. + * @param message FindNearest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredQuery.FindNearest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FindNearest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FindNearest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FindNearest { + + /** DistanceMeasure enum. */ + enum DistanceMeasure { + DISTANCE_MEASURE_UNSPECIFIED = 0, + EUCLIDEAN = 1, + COSINE = 2, + DOT_PRODUCT = 3 + } + } + } + + /** Properties of a StructuredAggregationQuery. */ + interface IStructuredAggregationQuery { + + /** StructuredAggregationQuery structuredQuery */ + structuredQuery?: (google.firestore.v1.IStructuredQuery|null); + + /** StructuredAggregationQuery aggregations */ + aggregations?: (google.firestore.v1.StructuredAggregationQuery.IAggregation[]|null); + } + + /** Represents a StructuredAggregationQuery. */ + class StructuredAggregationQuery implements IStructuredAggregationQuery { + + /** + * Constructs a new StructuredAggregationQuery. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IStructuredAggregationQuery); + + /** StructuredAggregationQuery structuredQuery. */ + public structuredQuery?: (google.firestore.v1.IStructuredQuery|null); + + /** StructuredAggregationQuery aggregations. */ + public aggregations: google.firestore.v1.StructuredAggregationQuery.IAggregation[]; + + /** StructuredAggregationQuery queryType. */ + public queryType?: "structuredQuery"; + + /** + * Creates a new StructuredAggregationQuery instance using the specified properties. + * @param [properties] Properties to set + * @returns StructuredAggregationQuery instance + */ + public static create(properties?: google.firestore.v1.IStructuredAggregationQuery): google.firestore.v1.StructuredAggregationQuery; + + /** + * Encodes the specified StructuredAggregationQuery message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.verify|verify} messages. + * @param message StructuredAggregationQuery message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IStructuredAggregationQuery, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StructuredAggregationQuery message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.verify|verify} messages. + * @param message StructuredAggregationQuery message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IStructuredAggregationQuery, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StructuredAggregationQuery message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StructuredAggregationQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredAggregationQuery; + + /** + * Decodes a StructuredAggregationQuery message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StructuredAggregationQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredAggregationQuery; + + /** + * Verifies a StructuredAggregationQuery message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StructuredAggregationQuery message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StructuredAggregationQuery + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredAggregationQuery; + + /** + * Creates a plain object from a StructuredAggregationQuery message. Also converts values to other types if specified. + * @param message StructuredAggregationQuery + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredAggregationQuery, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StructuredAggregationQuery to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StructuredAggregationQuery + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace StructuredAggregationQuery { + + /** Properties of an Aggregation. */ + interface IAggregation { + + /** Aggregation count */ + count?: (google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount|null); + + /** Aggregation sum */ + sum?: (google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum|null); + + /** Aggregation avg */ + avg?: (google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg|null); + + /** Aggregation alias */ + alias?: (string|null); + } + + /** Represents an Aggregation. */ + class Aggregation implements IAggregation { + + /** + * Constructs a new Aggregation. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredAggregationQuery.IAggregation); + + /** Aggregation count. */ + public count?: (google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount|null); + + /** Aggregation sum. */ + public sum?: (google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum|null); + + /** Aggregation avg. */ + public avg?: (google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg|null); + + /** Aggregation alias. */ + public alias: string; + + /** Aggregation operator. */ + public operator?: ("count"|"sum"|"avg"); + + /** + * Creates a new Aggregation instance using the specified properties. + * @param [properties] Properties to set + * @returns Aggregation instance + */ + public static create(properties?: google.firestore.v1.StructuredAggregationQuery.IAggregation): google.firestore.v1.StructuredAggregationQuery.Aggregation; + + /** + * Encodes the specified Aggregation message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.verify|verify} messages. + * @param message Aggregation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredAggregationQuery.IAggregation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Aggregation message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.verify|verify} messages. + * @param message Aggregation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredAggregationQuery.IAggregation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Aggregation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Aggregation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredAggregationQuery.Aggregation; + + /** + * Decodes an Aggregation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Aggregation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredAggregationQuery.Aggregation; + + /** + * Verifies an Aggregation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Aggregation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Aggregation + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredAggregationQuery.Aggregation; + + /** + * Creates a plain object from an Aggregation message. Also converts values to other types if specified. + * @param message Aggregation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredAggregationQuery.Aggregation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Aggregation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Aggregation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Aggregation { + + /** Properties of a Count. */ + interface ICount { + + /** Count upTo */ + upTo?: (google.protobuf.IInt64Value|null); + } + + /** Represents a Count. */ + class Count implements ICount { + + /** + * Constructs a new Count. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount); + + /** Count upTo. */ + public upTo?: (google.protobuf.IInt64Value|null); + + /** + * Creates a new Count instance using the specified properties. + * @param [properties] Properties to set + * @returns Count instance + */ + public static create(properties?: google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount): google.firestore.v1.StructuredAggregationQuery.Aggregation.Count; + + /** + * Encodes the specified Count message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.verify|verify} messages. + * @param message Count message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Count message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.verify|verify} messages. + * @param message Count message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Count message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Count + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredAggregationQuery.Aggregation.Count; + + /** + * Decodes a Count message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Count + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredAggregationQuery.Aggregation.Count; + + /** + * Verifies a Count message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Count message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Count + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredAggregationQuery.Aggregation.Count; + + /** + * Creates a plain object from a Count message. Also converts values to other types if specified. + * @param message Count + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredAggregationQuery.Aggregation.Count, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Count to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Count + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Sum. */ + interface ISum { + + /** Sum field */ + field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + } + + /** Represents a Sum. */ + class Sum implements ISum { + + /** + * Constructs a new Sum. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum); + + /** Sum field. */ + public field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + + /** + * Creates a new Sum instance using the specified properties. + * @param [properties] Properties to set + * @returns Sum instance + */ + public static create(properties?: google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum): google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum; + + /** + * Encodes the specified Sum message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.verify|verify} messages. + * @param message Sum message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Sum message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.verify|verify} messages. + * @param message Sum message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Sum message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Sum + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum; + + /** + * Decodes a Sum message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Sum + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum; + + /** + * Verifies a Sum message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Sum message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Sum + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum; + + /** + * Creates a plain object from a Sum message. Also converts values to other types if specified. + * @param message Sum + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Sum to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Sum + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Avg. */ + interface IAvg { + + /** Avg field */ + field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + } + + /** Represents an Avg. */ + class Avg implements IAvg { + + /** + * Constructs a new Avg. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg); + + /** Avg field. */ + public field?: (google.firestore.v1.StructuredQuery.IFieldReference|null); + + /** + * Creates a new Avg instance using the specified properties. + * @param [properties] Properties to set + * @returns Avg instance + */ + public static create(properties?: google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg): google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg; + + /** + * Encodes the specified Avg message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.verify|verify} messages. + * @param message Avg message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Avg message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.verify|verify} messages. + * @param message Avg message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Avg message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Avg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg; + + /** + * Decodes an Avg message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Avg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg; + + /** + * Verifies an Avg message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Avg message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Avg + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg; + + /** + * Creates a plain object from an Avg message. Also converts values to other types if specified. + * @param message Avg + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Avg to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Avg + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + + /** Properties of a Cursor. */ + interface ICursor { + + /** Cursor values */ + values?: (google.firestore.v1.IValue[]|null); + + /** Cursor before */ + before?: (boolean|null); + } + + /** Represents a Cursor. */ + class Cursor implements ICursor { + + /** + * Constructs a new Cursor. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.ICursor); + + /** Cursor values. */ + public values: google.firestore.v1.IValue[]; + + /** Cursor before. */ + public before: boolean; + + /** + * Creates a new Cursor instance using the specified properties. + * @param [properties] Properties to set + * @returns Cursor instance + */ + public static create(properties?: google.firestore.v1.ICursor): google.firestore.v1.Cursor; + + /** + * Encodes the specified Cursor message. Does not implicitly {@link google.firestore.v1.Cursor.verify|verify} messages. + * @param message Cursor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.ICursor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Cursor message, length delimited. Does not implicitly {@link google.firestore.v1.Cursor.verify|verify} messages. + * @param message Cursor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.ICursor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Cursor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Cursor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Cursor; + + /** + * Decodes a Cursor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Cursor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Cursor; + + /** + * Verifies a Cursor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Cursor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Cursor + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Cursor; + + /** + * Creates a plain object from a Cursor message. Also converts values to other types if specified. + * @param message Cursor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Cursor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Cursor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Cursor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExplainOptions. */ + interface IExplainOptions { + + /** ExplainOptions analyze */ + analyze?: (boolean|null); + } + + /** Represents an ExplainOptions. */ + class ExplainOptions implements IExplainOptions { + + /** + * Constructs a new ExplainOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IExplainOptions); + + /** ExplainOptions analyze. */ + public analyze: boolean; + + /** + * Creates a new ExplainOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ExplainOptions instance + */ + public static create(properties?: google.firestore.v1.IExplainOptions): google.firestore.v1.ExplainOptions; + + /** + * Encodes the specified ExplainOptions message. Does not implicitly {@link google.firestore.v1.ExplainOptions.verify|verify} messages. + * @param message ExplainOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IExplainOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExplainOptions message, length delimited. Does not implicitly {@link google.firestore.v1.ExplainOptions.verify|verify} messages. + * @param message ExplainOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IExplainOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExplainOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExplainOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ExplainOptions; + + /** + * Decodes an ExplainOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExplainOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ExplainOptions; + + /** + * Verifies an ExplainOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExplainOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExplainOptions + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ExplainOptions; + + /** + * Creates a plain object from an ExplainOptions message. Also converts values to other types if specified. + * @param message ExplainOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ExplainOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExplainOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExplainOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExplainMetrics. */ + interface IExplainMetrics { + + /** ExplainMetrics planSummary */ + planSummary?: (google.firestore.v1.IPlanSummary|null); + + /** ExplainMetrics executionStats */ + executionStats?: (google.firestore.v1.IExecutionStats|null); + } + + /** Represents an ExplainMetrics. */ + class ExplainMetrics implements IExplainMetrics { + + /** + * Constructs a new ExplainMetrics. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IExplainMetrics); + + /** ExplainMetrics planSummary. */ + public planSummary?: (google.firestore.v1.IPlanSummary|null); + + /** ExplainMetrics executionStats. */ + public executionStats?: (google.firestore.v1.IExecutionStats|null); + + /** + * Creates a new ExplainMetrics instance using the specified properties. + * @param [properties] Properties to set + * @returns ExplainMetrics instance + */ + public static create(properties?: google.firestore.v1.IExplainMetrics): google.firestore.v1.ExplainMetrics; + + /** + * Encodes the specified ExplainMetrics message. Does not implicitly {@link google.firestore.v1.ExplainMetrics.verify|verify} messages. + * @param message ExplainMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IExplainMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExplainMetrics message, length delimited. Does not implicitly {@link google.firestore.v1.ExplainMetrics.verify|verify} messages. + * @param message ExplainMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IExplainMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExplainMetrics message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExplainMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ExplainMetrics; + + /** + * Decodes an ExplainMetrics message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExplainMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ExplainMetrics; + + /** + * Verifies an ExplainMetrics message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExplainMetrics message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExplainMetrics + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ExplainMetrics; + + /** + * Creates a plain object from an ExplainMetrics message. Also converts values to other types if specified. + * @param message ExplainMetrics + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ExplainMetrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExplainMetrics to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExplainMetrics + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PlanSummary. */ + interface IPlanSummary { + + /** PlanSummary indexesUsed */ + indexesUsed?: (google.protobuf.IStruct[]|null); + } + + /** Represents a PlanSummary. */ + class PlanSummary implements IPlanSummary { + + /** + * Constructs a new PlanSummary. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IPlanSummary); + + /** PlanSummary indexesUsed. */ + public indexesUsed: google.protobuf.IStruct[]; + + /** + * Creates a new PlanSummary instance using the specified properties. + * @param [properties] Properties to set + * @returns PlanSummary instance + */ + public static create(properties?: google.firestore.v1.IPlanSummary): google.firestore.v1.PlanSummary; + + /** + * Encodes the specified PlanSummary message. Does not implicitly {@link google.firestore.v1.PlanSummary.verify|verify} messages. + * @param message PlanSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IPlanSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PlanSummary message, length delimited. Does not implicitly {@link google.firestore.v1.PlanSummary.verify|verify} messages. + * @param message PlanSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IPlanSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PlanSummary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PlanSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.PlanSummary; + + /** + * Decodes a PlanSummary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PlanSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.PlanSummary; + + /** + * Verifies a PlanSummary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PlanSummary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PlanSummary + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.PlanSummary; + + /** + * Creates a plain object from a PlanSummary message. Also converts values to other types if specified. + * @param message PlanSummary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.PlanSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PlanSummary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PlanSummary + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExecutionStats. */ + interface IExecutionStats { + + /** ExecutionStats resultsReturned */ + resultsReturned?: (number|Long|string|null); + + /** ExecutionStats executionDuration */ + executionDuration?: (google.protobuf.IDuration|null); + + /** ExecutionStats readOperations */ + readOperations?: (number|Long|string|null); + + /** ExecutionStats debugStats */ + debugStats?: (google.protobuf.IStruct|null); + } + + /** Represents an ExecutionStats. */ + class ExecutionStats implements IExecutionStats { + + /** + * Constructs a new ExecutionStats. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IExecutionStats); + + /** ExecutionStats resultsReturned. */ + public resultsReturned: (number|Long|string); + + /** ExecutionStats executionDuration. */ + public executionDuration?: (google.protobuf.IDuration|null); + + /** ExecutionStats readOperations. */ + public readOperations: (number|Long|string); + + /** ExecutionStats debugStats. */ + public debugStats?: (google.protobuf.IStruct|null); + + /** + * Creates a new ExecutionStats instance using the specified properties. + * @param [properties] Properties to set + * @returns ExecutionStats instance + */ + public static create(properties?: google.firestore.v1.IExecutionStats): google.firestore.v1.ExecutionStats; + + /** + * Encodes the specified ExecutionStats message. Does not implicitly {@link google.firestore.v1.ExecutionStats.verify|verify} messages. + * @param message ExecutionStats message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IExecutionStats, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExecutionStats message, length delimited. Does not implicitly {@link google.firestore.v1.ExecutionStats.verify|verify} messages. + * @param message ExecutionStats message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IExecutionStats, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExecutionStats message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExecutionStats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ExecutionStats; + + /** + * Decodes an ExecutionStats message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExecutionStats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ExecutionStats; + + /** + * Verifies an ExecutionStats message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExecutionStats message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExecutionStats + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ExecutionStats; + + /** + * Creates a plain object from an ExecutionStats message. Also converts values to other types if specified. + * @param message ExecutionStats + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ExecutionStats, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExecutionStats to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExecutionStats + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Write. */ + interface IWrite { + + /** Write update */ + update?: (google.firestore.v1.IDocument|null); + + /** Write delete */ + "delete"?: (string|null); + + /** Write transform */ + transform?: (google.firestore.v1.IDocumentTransform|null); + + /** Write updateMask */ + updateMask?: (google.firestore.v1.IDocumentMask|null); + + /** Write updateTransforms */ + updateTransforms?: (google.firestore.v1.DocumentTransform.IFieldTransform[]|null); + + /** Write currentDocument */ + currentDocument?: (google.firestore.v1.IPrecondition|null); + } + + /** Represents a Write. */ + class Write implements IWrite { + + /** + * Constructs a new Write. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IWrite); + + /** Write update. */ + public update?: (google.firestore.v1.IDocument|null); + + /** Write delete. */ + public delete?: (string|null); + + /** Write transform. */ + public transform?: (google.firestore.v1.IDocumentTransform|null); + + /** Write updateMask. */ + public updateMask?: (google.firestore.v1.IDocumentMask|null); + + /** Write updateTransforms. */ + public updateTransforms: google.firestore.v1.DocumentTransform.IFieldTransform[]; + + /** Write currentDocument. */ + public currentDocument?: (google.firestore.v1.IPrecondition|null); + + /** Write operation. */ + public operation?: ("update"|"delete"|"transform"); + + /** + * Creates a new Write instance using the specified properties. + * @param [properties] Properties to set + * @returns Write instance + */ + public static create(properties?: google.firestore.v1.IWrite): google.firestore.v1.Write; + + /** + * Encodes the specified Write message. Does not implicitly {@link google.firestore.v1.Write.verify|verify} messages. + * @param message Write message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IWrite, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Write message, length delimited. Does not implicitly {@link google.firestore.v1.Write.verify|verify} messages. + * @param message Write message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IWrite, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Write message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Write + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.Write; + + /** + * Decodes a Write message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Write + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.Write; + + /** + * Verifies a Write message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Write message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Write + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.Write; + + /** + * Creates a plain object from a Write message. Also converts values to other types if specified. + * @param message Write + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.Write, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Write to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Write + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentTransform. */ + interface IDocumentTransform { + + /** DocumentTransform document */ + document?: (string|null); + + /** DocumentTransform fieldTransforms */ + fieldTransforms?: (google.firestore.v1.DocumentTransform.IFieldTransform[]|null); + } + + /** Represents a DocumentTransform. */ + class DocumentTransform implements IDocumentTransform { + + /** + * Constructs a new DocumentTransform. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IDocumentTransform); + + /** DocumentTransform document. */ + public document: string; + + /** DocumentTransform fieldTransforms. */ + public fieldTransforms: google.firestore.v1.DocumentTransform.IFieldTransform[]; + + /** + * Creates a new DocumentTransform instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentTransform instance + */ + public static create(properties?: google.firestore.v1.IDocumentTransform): google.firestore.v1.DocumentTransform; + + /** + * Encodes the specified DocumentTransform message. Does not implicitly {@link google.firestore.v1.DocumentTransform.verify|verify} messages. + * @param message DocumentTransform message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IDocumentTransform, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentTransform message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentTransform.verify|verify} messages. + * @param message DocumentTransform message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IDocumentTransform, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentTransform message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.DocumentTransform; + + /** + * Decodes a DocumentTransform message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.DocumentTransform; + + /** + * Verifies a DocumentTransform message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentTransform message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentTransform + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.DocumentTransform; + + /** + * Creates a plain object from a DocumentTransform message. Also converts values to other types if specified. + * @param message DocumentTransform + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.DocumentTransform, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentTransform to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentTransform + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DocumentTransform { + + /** Properties of a FieldTransform. */ + interface IFieldTransform { + + /** FieldTransform fieldPath */ + fieldPath?: (string|null); + + /** FieldTransform setToServerValue */ + setToServerValue?: (google.firestore.v1.DocumentTransform.FieldTransform.ServerValue|keyof typeof google.firestore.v1.DocumentTransform.FieldTransform.ServerValue|null); + + /** FieldTransform increment */ + increment?: (google.firestore.v1.IValue|null); + + /** FieldTransform maximum */ + maximum?: (google.firestore.v1.IValue|null); + + /** FieldTransform minimum */ + minimum?: (google.firestore.v1.IValue|null); + + /** FieldTransform appendMissingElements */ + appendMissingElements?: (google.firestore.v1.IArrayValue|null); + + /** FieldTransform removeAllFromArray */ + removeAllFromArray?: (google.firestore.v1.IArrayValue|null); + } + + /** Represents a FieldTransform. */ + class FieldTransform implements IFieldTransform { + + /** + * Constructs a new FieldTransform. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.DocumentTransform.IFieldTransform); + + /** FieldTransform fieldPath. */ + public fieldPath: string; + + /** FieldTransform setToServerValue. */ + public setToServerValue?: (google.firestore.v1.DocumentTransform.FieldTransform.ServerValue|keyof typeof google.firestore.v1.DocumentTransform.FieldTransform.ServerValue|null); + + /** FieldTransform increment. */ + public increment?: (google.firestore.v1.IValue|null); + + /** FieldTransform maximum. */ + public maximum?: (google.firestore.v1.IValue|null); + + /** FieldTransform minimum. */ + public minimum?: (google.firestore.v1.IValue|null); + + /** FieldTransform appendMissingElements. */ + public appendMissingElements?: (google.firestore.v1.IArrayValue|null); + + /** FieldTransform removeAllFromArray. */ + public removeAllFromArray?: (google.firestore.v1.IArrayValue|null); + + /** FieldTransform transformType. */ + public transformType?: ("setToServerValue"|"increment"|"maximum"|"minimum"|"appendMissingElements"|"removeAllFromArray"); + + /** + * Creates a new FieldTransform instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldTransform instance + */ + public static create(properties?: google.firestore.v1.DocumentTransform.IFieldTransform): google.firestore.v1.DocumentTransform.FieldTransform; + + /** + * Encodes the specified FieldTransform message. Does not implicitly {@link google.firestore.v1.DocumentTransform.FieldTransform.verify|verify} messages. + * @param message FieldTransform message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.DocumentTransform.IFieldTransform, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldTransform message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentTransform.FieldTransform.verify|verify} messages. + * @param message FieldTransform message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.DocumentTransform.IFieldTransform, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldTransform message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.DocumentTransform.FieldTransform; + + /** + * Decodes a FieldTransform message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.DocumentTransform.FieldTransform; + + /** + * Verifies a FieldTransform message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldTransform message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldTransform + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.DocumentTransform.FieldTransform; + + /** + * Creates a plain object from a FieldTransform message. Also converts values to other types if specified. + * @param message FieldTransform + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.DocumentTransform.FieldTransform, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldTransform to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldTransform + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldTransform { + + /** ServerValue enum. */ + enum ServerValue { + SERVER_VALUE_UNSPECIFIED = 0, + REQUEST_TIME = 1 + } + } + } + + /** Properties of a WriteResult. */ + interface IWriteResult { + + /** WriteResult updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** WriteResult transformResults */ + transformResults?: (google.firestore.v1.IValue[]|null); + } + + /** Represents a WriteResult. */ + class WriteResult implements IWriteResult { + + /** + * Constructs a new WriteResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IWriteResult); + + /** WriteResult updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** WriteResult transformResults. */ + public transformResults: google.firestore.v1.IValue[]; + + /** + * Creates a new WriteResult instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteResult instance + */ + public static create(properties?: google.firestore.v1.IWriteResult): google.firestore.v1.WriteResult; + + /** + * Encodes the specified WriteResult message. Does not implicitly {@link google.firestore.v1.WriteResult.verify|verify} messages. + * @param message WriteResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IWriteResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteResult message, length delimited. Does not implicitly {@link google.firestore.v1.WriteResult.verify|verify} messages. + * @param message WriteResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IWriteResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.WriteResult; + + /** + * Decodes a WriteResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.WriteResult; + + /** + * Verifies a WriteResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteResult + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.WriteResult; + + /** + * Creates a plain object from a WriteResult message. Also converts values to other types if specified. + * @param message WriteResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.WriteResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WriteResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentChange. */ + interface IDocumentChange { + + /** DocumentChange document */ + document?: (google.firestore.v1.IDocument|null); + + /** DocumentChange targetIds */ + targetIds?: (number[]|null); + + /** DocumentChange removedTargetIds */ + removedTargetIds?: (number[]|null); + } + + /** Represents a DocumentChange. */ + class DocumentChange implements IDocumentChange { + + /** + * Constructs a new DocumentChange. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IDocumentChange); + + /** DocumentChange document. */ + public document?: (google.firestore.v1.IDocument|null); + + /** DocumentChange targetIds. */ + public targetIds: number[]; + + /** DocumentChange removedTargetIds. */ + public removedTargetIds: number[]; + + /** + * Creates a new DocumentChange instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentChange instance + */ + public static create(properties?: google.firestore.v1.IDocumentChange): google.firestore.v1.DocumentChange; + + /** + * Encodes the specified DocumentChange message. Does not implicitly {@link google.firestore.v1.DocumentChange.verify|verify} messages. + * @param message DocumentChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IDocumentChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentChange message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentChange.verify|verify} messages. + * @param message DocumentChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IDocumentChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentChange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.DocumentChange; + + /** + * Decodes a DocumentChange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.DocumentChange; + + /** + * Verifies a DocumentChange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentChange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentChange + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.DocumentChange; + + /** + * Creates a plain object from a DocumentChange message. Also converts values to other types if specified. + * @param message DocumentChange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.DocumentChange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentChange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentChange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentDelete. */ + interface IDocumentDelete { + + /** DocumentDelete document */ + document?: (string|null); + + /** DocumentDelete removedTargetIds */ + removedTargetIds?: (number[]|null); + + /** DocumentDelete readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DocumentDelete. */ + class DocumentDelete implements IDocumentDelete { + + /** + * Constructs a new DocumentDelete. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IDocumentDelete); + + /** DocumentDelete document. */ + public document: string; + + /** DocumentDelete removedTargetIds. */ + public removedTargetIds: number[]; + + /** DocumentDelete readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DocumentDelete instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentDelete instance + */ + public static create(properties?: google.firestore.v1.IDocumentDelete): google.firestore.v1.DocumentDelete; + + /** + * Encodes the specified DocumentDelete message. Does not implicitly {@link google.firestore.v1.DocumentDelete.verify|verify} messages. + * @param message DocumentDelete message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IDocumentDelete, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentDelete message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentDelete.verify|verify} messages. + * @param message DocumentDelete message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IDocumentDelete, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentDelete message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentDelete + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.DocumentDelete; + + /** + * Decodes a DocumentDelete message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentDelete + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.DocumentDelete; + + /** + * Verifies a DocumentDelete message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentDelete message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentDelete + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.DocumentDelete; + + /** + * Creates a plain object from a DocumentDelete message. Also converts values to other types if specified. + * @param message DocumentDelete + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.DocumentDelete, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentDelete to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentDelete + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentRemove. */ + interface IDocumentRemove { + + /** DocumentRemove document */ + document?: (string|null); + + /** DocumentRemove removedTargetIds */ + removedTargetIds?: (number[]|null); + + /** DocumentRemove readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DocumentRemove. */ + class DocumentRemove implements IDocumentRemove { + + /** + * Constructs a new DocumentRemove. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IDocumentRemove); + + /** DocumentRemove document. */ + public document: string; + + /** DocumentRemove removedTargetIds. */ + public removedTargetIds: number[]; + + /** DocumentRemove readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DocumentRemove instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentRemove instance + */ + public static create(properties?: google.firestore.v1.IDocumentRemove): google.firestore.v1.DocumentRemove; + + /** + * Encodes the specified DocumentRemove message. Does not implicitly {@link google.firestore.v1.DocumentRemove.verify|verify} messages. + * @param message DocumentRemove message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IDocumentRemove, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentRemove message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentRemove.verify|verify} messages. + * @param message DocumentRemove message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IDocumentRemove, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentRemove message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentRemove + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.DocumentRemove; + + /** + * Decodes a DocumentRemove message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentRemove + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.DocumentRemove; + + /** + * Verifies a DocumentRemove message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentRemove message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentRemove + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.DocumentRemove; + + /** + * Creates a plain object from a DocumentRemove message. Also converts values to other types if specified. + * @param message DocumentRemove + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.DocumentRemove, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentRemove to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentRemove + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExistenceFilter. */ + interface IExistenceFilter { + + /** ExistenceFilter targetId */ + targetId?: (number|null); + + /** ExistenceFilter count */ + count?: (number|null); + + /** ExistenceFilter unchangedNames */ + unchangedNames?: (google.firestore.v1.IBloomFilter|null); + } + + /** Represents an ExistenceFilter. */ + class ExistenceFilter implements IExistenceFilter { + + /** + * Constructs a new ExistenceFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1.IExistenceFilter); + + /** ExistenceFilter targetId. */ + public targetId: number; + + /** ExistenceFilter count. */ + public count: number; + + /** ExistenceFilter unchangedNames. */ + public unchangedNames?: (google.firestore.v1.IBloomFilter|null); + + /** + * Creates a new ExistenceFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns ExistenceFilter instance + */ + public static create(properties?: google.firestore.v1.IExistenceFilter): google.firestore.v1.ExistenceFilter; + + /** + * Encodes the specified ExistenceFilter message. Does not implicitly {@link google.firestore.v1.ExistenceFilter.verify|verify} messages. + * @param message ExistenceFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1.IExistenceFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExistenceFilter message, length delimited. Does not implicitly {@link google.firestore.v1.ExistenceFilter.verify|verify} messages. + * @param message ExistenceFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1.IExistenceFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExistenceFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExistenceFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1.ExistenceFilter; + + /** + * Decodes an ExistenceFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExistenceFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1.ExistenceFilter; + + /** + * Verifies an ExistenceFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExistenceFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExistenceFilter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1.ExistenceFilter; + + /** + * Creates a plain object from an ExistenceFilter message. Also converts values to other types if specified. + * @param message ExistenceFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1.ExistenceFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExistenceFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExistenceFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace v1beta1. */ + namespace v1beta1 { + + /** Properties of a DocumentMask. */ + interface IDocumentMask { + + /** DocumentMask fieldPaths */ + fieldPaths?: (string[]|null); + } + + /** Represents a DocumentMask. */ + class DocumentMask implements IDocumentMask { + + /** + * Constructs a new DocumentMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IDocumentMask); + + /** DocumentMask fieldPaths. */ + public fieldPaths: string[]; + + /** + * Creates a new DocumentMask instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentMask instance + */ + public static create(properties?: google.firestore.v1beta1.IDocumentMask): google.firestore.v1beta1.DocumentMask; + + /** + * Encodes the specified DocumentMask message. Does not implicitly {@link google.firestore.v1beta1.DocumentMask.verify|verify} messages. + * @param message DocumentMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IDocumentMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentMask message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentMask.verify|verify} messages. + * @param message DocumentMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IDocumentMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.DocumentMask; + + /** + * Decodes a DocumentMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.DocumentMask; + + /** + * Verifies a DocumentMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentMask + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.DocumentMask; + + /** + * Creates a plain object from a DocumentMask message. Also converts values to other types if specified. + * @param message DocumentMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.DocumentMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Precondition. */ + interface IPrecondition { + + /** Precondition exists */ + exists?: (boolean|null); + + /** Precondition updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Precondition. */ + class Precondition implements IPrecondition { + + /** + * Constructs a new Precondition. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IPrecondition); + + /** Precondition exists. */ + public exists?: (boolean|null); + + /** Precondition updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Precondition conditionType. */ + public conditionType?: ("exists"|"updateTime"); + + /** + * Creates a new Precondition instance using the specified properties. + * @param [properties] Properties to set + * @returns Precondition instance + */ + public static create(properties?: google.firestore.v1beta1.IPrecondition): google.firestore.v1beta1.Precondition; + + /** + * Encodes the specified Precondition message. Does not implicitly {@link google.firestore.v1beta1.Precondition.verify|verify} messages. + * @param message Precondition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IPrecondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Precondition message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Precondition.verify|verify} messages. + * @param message Precondition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IPrecondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Precondition message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Precondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.Precondition; + + /** + * Decodes a Precondition message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Precondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.Precondition; + + /** + * Verifies a Precondition message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Precondition message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Precondition + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.Precondition; + + /** + * Creates a plain object from a Precondition message. Also converts values to other types if specified. + * @param message Precondition + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.Precondition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Precondition to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Precondition + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TransactionOptions. */ + interface ITransactionOptions { + + /** TransactionOptions readOnly */ + readOnly?: (google.firestore.v1beta1.TransactionOptions.IReadOnly|null); + + /** TransactionOptions readWrite */ + readWrite?: (google.firestore.v1beta1.TransactionOptions.IReadWrite|null); + } + + /** Represents a TransactionOptions. */ + class TransactionOptions implements ITransactionOptions { + + /** + * Constructs a new TransactionOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.ITransactionOptions); + + /** TransactionOptions readOnly. */ + public readOnly?: (google.firestore.v1beta1.TransactionOptions.IReadOnly|null); + + /** TransactionOptions readWrite. */ + public readWrite?: (google.firestore.v1beta1.TransactionOptions.IReadWrite|null); + + /** TransactionOptions mode. */ + public mode?: ("readOnly"|"readWrite"); + + /** + * Creates a new TransactionOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns TransactionOptions instance + */ + public static create(properties?: google.firestore.v1beta1.ITransactionOptions): google.firestore.v1beta1.TransactionOptions; + + /** + * Encodes the specified TransactionOptions message. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.verify|verify} messages. + * @param message TransactionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.ITransactionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TransactionOptions message, length delimited. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.verify|verify} messages. + * @param message TransactionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.ITransactionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TransactionOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TransactionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.TransactionOptions; + + /** + * Decodes a TransactionOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TransactionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.TransactionOptions; + + /** + * Verifies a TransactionOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TransactionOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TransactionOptions + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.TransactionOptions; + + /** + * Creates a plain object from a TransactionOptions message. Also converts values to other types if specified. + * @param message TransactionOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.TransactionOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TransactionOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TransactionOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TransactionOptions { + + /** Properties of a ReadWrite. */ + interface IReadWrite { + + /** ReadWrite retryTransaction */ + retryTransaction?: (Uint8Array|Buffer|string|null); + } + + /** Represents a ReadWrite. */ + class ReadWrite implements IReadWrite { + + /** + * Constructs a new ReadWrite. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.TransactionOptions.IReadWrite); + + /** ReadWrite retryTransaction. */ + public retryTransaction: (Uint8Array|Buffer|string); + + /** + * Creates a new ReadWrite instance using the specified properties. + * @param [properties] Properties to set + * @returns ReadWrite instance + */ + public static create(properties?: google.firestore.v1beta1.TransactionOptions.IReadWrite): google.firestore.v1beta1.TransactionOptions.ReadWrite; + + /** + * Encodes the specified ReadWrite message. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.ReadWrite.verify|verify} messages. + * @param message ReadWrite message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.TransactionOptions.IReadWrite, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReadWrite message, length delimited. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.ReadWrite.verify|verify} messages. + * @param message ReadWrite message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.TransactionOptions.IReadWrite, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReadWrite message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReadWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.TransactionOptions.ReadWrite; + + /** + * Decodes a ReadWrite message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReadWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.TransactionOptions.ReadWrite; + + /** + * Verifies a ReadWrite message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReadWrite message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReadWrite + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.TransactionOptions.ReadWrite; + + /** + * Creates a plain object from a ReadWrite message. Also converts values to other types if specified. + * @param message ReadWrite + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.TransactionOptions.ReadWrite, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReadWrite to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReadWrite + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReadOnly. */ + interface IReadOnly { + + /** ReadOnly readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a ReadOnly. */ + class ReadOnly implements IReadOnly { + + /** + * Constructs a new ReadOnly. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.TransactionOptions.IReadOnly); + + /** ReadOnly readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** ReadOnly consistencySelector. */ + public consistencySelector?: "readTime"; + + /** + * Creates a new ReadOnly instance using the specified properties. + * @param [properties] Properties to set + * @returns ReadOnly instance + */ + public static create(properties?: google.firestore.v1beta1.TransactionOptions.IReadOnly): google.firestore.v1beta1.TransactionOptions.ReadOnly; + + /** + * Encodes the specified ReadOnly message. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.ReadOnly.verify|verify} messages. + * @param message ReadOnly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.TransactionOptions.IReadOnly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReadOnly message, length delimited. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.ReadOnly.verify|verify} messages. + * @param message ReadOnly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.TransactionOptions.IReadOnly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReadOnly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReadOnly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.TransactionOptions.ReadOnly; + + /** + * Decodes a ReadOnly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReadOnly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.TransactionOptions.ReadOnly; + + /** + * Verifies a ReadOnly message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReadOnly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReadOnly + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.TransactionOptions.ReadOnly; + + /** + * Creates a plain object from a ReadOnly message. Also converts values to other types if specified. + * @param message ReadOnly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.TransactionOptions.ReadOnly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReadOnly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReadOnly + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a Document. */ + interface IDocument { + + /** Document name */ + name?: (string|null); + + /** Document fields */ + fields?: ({ [k: string]: google.firestore.v1beta1.IValue }|null); + + /** Document createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Document updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Document. */ + class Document implements IDocument { + + /** + * Constructs a new Document. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IDocument); + + /** Document name. */ + public name: string; + + /** Document fields. */ + public fields: { [k: string]: google.firestore.v1beta1.IValue }; + + /** Document createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Document updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Document instance using the specified properties. + * @param [properties] Properties to set + * @returns Document instance + */ + public static create(properties?: google.firestore.v1beta1.IDocument): google.firestore.v1beta1.Document; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.firestore.v1beta1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Document message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.Document; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.Document; + + /** + * Verifies a Document message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Document + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.Document; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @param message Document + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.Document, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Document to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Document + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Value. */ + interface IValue { + + /** Value nullValue */ + nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value booleanValue */ + booleanValue?: (boolean|null); + + /** Value integerValue */ + integerValue?: (number|Long|string|null); + + /** Value doubleValue */ + doubleValue?: (number|null); + + /** Value timestampValue */ + timestampValue?: (google.protobuf.ITimestamp|null); + + /** Value stringValue */ + stringValue?: (string|null); + + /** Value bytesValue */ + bytesValue?: (Uint8Array|Buffer|string|null); + + /** Value referenceValue */ + referenceValue?: (string|null); + + /** Value geoPointValue */ + geoPointValue?: (google.type.ILatLng|null); + + /** Value arrayValue */ + arrayValue?: (google.firestore.v1beta1.IArrayValue|null); + + /** Value mapValue */ + mapValue?: (google.firestore.v1beta1.IMapValue|null); + } + + /** Represents a Value. */ + class Value implements IValue { + + /** + * Constructs a new Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IValue); + + /** Value nullValue. */ + public nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value booleanValue. */ + public booleanValue?: (boolean|null); + + /** Value integerValue. */ + public integerValue?: (number|Long|string|null); + + /** Value doubleValue. */ + public doubleValue?: (number|null); + + /** Value timestampValue. */ + public timestampValue?: (google.protobuf.ITimestamp|null); + + /** Value stringValue. */ + public stringValue?: (string|null); + + /** Value bytesValue. */ + public bytesValue?: (Uint8Array|Buffer|string|null); + + /** Value referenceValue. */ + public referenceValue?: (string|null); + + /** Value geoPointValue. */ + public geoPointValue?: (google.type.ILatLng|null); + + /** Value arrayValue. */ + public arrayValue?: (google.firestore.v1beta1.IArrayValue|null); + + /** Value mapValue. */ + public mapValue?: (google.firestore.v1beta1.IMapValue|null); + + /** Value valueType. */ + public valueType?: ("nullValue"|"booleanValue"|"integerValue"|"doubleValue"|"timestampValue"|"stringValue"|"bytesValue"|"referenceValue"|"geoPointValue"|"arrayValue"|"mapValue"); + + /** + * Creates a new Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Value instance + */ + public static create(properties?: google.firestore.v1beta1.IValue): google.firestore.v1beta1.Value; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.firestore.v1beta1.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.Value; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.Value; + + /** + * Verifies a Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Value + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.Value; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @param message Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ArrayValue. */ + interface IArrayValue { + + /** ArrayValue values */ + values?: (google.firestore.v1beta1.IValue[]|null); + } + + /** Represents an ArrayValue. */ + class ArrayValue implements IArrayValue { + + /** + * Constructs a new ArrayValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IArrayValue); + + /** ArrayValue values. */ + public values: google.firestore.v1beta1.IValue[]; + + /** + * Creates a new ArrayValue instance using the specified properties. + * @param [properties] Properties to set + * @returns ArrayValue instance + */ + public static create(properties?: google.firestore.v1beta1.IArrayValue): google.firestore.v1beta1.ArrayValue; + + /** + * Encodes the specified ArrayValue message. Does not implicitly {@link google.firestore.v1beta1.ArrayValue.verify|verify} messages. + * @param message ArrayValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IArrayValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ArrayValue.verify|verify} messages. + * @param message ArrayValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IArrayValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ArrayValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.ArrayValue; + + /** + * Decodes an ArrayValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.ArrayValue; + + /** + * Verifies an ArrayValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ArrayValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ArrayValue + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.ArrayValue; + + /** + * Creates a plain object from an ArrayValue message. Also converts values to other types if specified. + * @param message ArrayValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.ArrayValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ArrayValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ArrayValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MapValue. */ + interface IMapValue { + + /** MapValue fields */ + fields?: ({ [k: string]: google.firestore.v1beta1.IValue }|null); + } + + /** Represents a MapValue. */ + class MapValue implements IMapValue { + + /** + * Constructs a new MapValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IMapValue); + + /** MapValue fields. */ + public fields: { [k: string]: google.firestore.v1beta1.IValue }; + + /** + * Creates a new MapValue instance using the specified properties. + * @param [properties] Properties to set + * @returns MapValue instance + */ + public static create(properties?: google.firestore.v1beta1.IMapValue): google.firestore.v1beta1.MapValue; + + /** + * Encodes the specified MapValue message. Does not implicitly {@link google.firestore.v1beta1.MapValue.verify|verify} messages. + * @param message MapValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IMapValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MapValue message, length delimited. Does not implicitly {@link google.firestore.v1beta1.MapValue.verify|verify} messages. + * @param message MapValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IMapValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MapValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MapValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.MapValue; + + /** + * Decodes a MapValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MapValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.MapValue; + + /** + * Verifies a MapValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MapValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MapValue + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.MapValue; + + /** + * Creates a plain object from a MapValue message. Also converts values to other types if specified. + * @param message MapValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.MapValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MapValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MapValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Firestore */ + class Firestore extends $protobuf.rpc.Service { + + /** + * Constructs a new Firestore service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Firestore service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Firestore; + + /** + * Calls GetDocument. + * @param request GetDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Document + */ + public getDocument(request: google.firestore.v1beta1.IGetDocumentRequest, callback: google.firestore.v1beta1.Firestore.GetDocumentCallback): void; + + /** + * Calls GetDocument. + * @param request GetDocumentRequest message or plain object + * @returns Promise + */ + public getDocument(request: google.firestore.v1beta1.IGetDocumentRequest): Promise; + + /** + * Calls ListDocuments. + * @param request ListDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListDocumentsResponse + */ + public listDocuments(request: google.firestore.v1beta1.IListDocumentsRequest, callback: google.firestore.v1beta1.Firestore.ListDocumentsCallback): void; + + /** + * Calls ListDocuments. + * @param request ListDocumentsRequest message or plain object + * @returns Promise + */ + public listDocuments(request: google.firestore.v1beta1.IListDocumentsRequest): Promise; + + /** + * Calls UpdateDocument. + * @param request UpdateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Document + */ + public updateDocument(request: google.firestore.v1beta1.IUpdateDocumentRequest, callback: google.firestore.v1beta1.Firestore.UpdateDocumentCallback): void; + + /** + * Calls UpdateDocument. + * @param request UpdateDocumentRequest message or plain object + * @returns Promise + */ + public updateDocument(request: google.firestore.v1beta1.IUpdateDocumentRequest): Promise; + + /** + * Calls DeleteDocument. + * @param request DeleteDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteDocument(request: google.firestore.v1beta1.IDeleteDocumentRequest, callback: google.firestore.v1beta1.Firestore.DeleteDocumentCallback): void; + + /** + * Calls DeleteDocument. + * @param request DeleteDocumentRequest message or plain object + * @returns Promise + */ + public deleteDocument(request: google.firestore.v1beta1.IDeleteDocumentRequest): Promise; + + /** + * Calls BatchGetDocuments. + * @param request BatchGetDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BatchGetDocumentsResponse + */ + public batchGetDocuments(request: google.firestore.v1beta1.IBatchGetDocumentsRequest, callback: google.firestore.v1beta1.Firestore.BatchGetDocumentsCallback): void; + + /** + * Calls BatchGetDocuments. + * @param request BatchGetDocumentsRequest message or plain object + * @returns Promise + */ + public batchGetDocuments(request: google.firestore.v1beta1.IBatchGetDocumentsRequest): Promise; + + /** + * Calls BeginTransaction. + * @param request BeginTransactionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BeginTransactionResponse + */ + public beginTransaction(request: google.firestore.v1beta1.IBeginTransactionRequest, callback: google.firestore.v1beta1.Firestore.BeginTransactionCallback): void; + + /** + * Calls BeginTransaction. + * @param request BeginTransactionRequest message or plain object + * @returns Promise + */ + public beginTransaction(request: google.firestore.v1beta1.IBeginTransactionRequest): Promise; + + /** + * Calls Commit. + * @param request CommitRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CommitResponse + */ + public commit(request: google.firestore.v1beta1.ICommitRequest, callback: google.firestore.v1beta1.Firestore.CommitCallback): void; + + /** + * Calls Commit. + * @param request CommitRequest message or plain object + * @returns Promise + */ + public commit(request: google.firestore.v1beta1.ICommitRequest): Promise; + + /** + * Calls Rollback. + * @param request RollbackRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public rollback(request: google.firestore.v1beta1.IRollbackRequest, callback: google.firestore.v1beta1.Firestore.RollbackCallback): void; + + /** + * Calls Rollback. + * @param request RollbackRequest message or plain object + * @returns Promise + */ + public rollback(request: google.firestore.v1beta1.IRollbackRequest): Promise; + + /** + * Calls RunQuery. + * @param request RunQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and RunQueryResponse + */ + public runQuery(request: google.firestore.v1beta1.IRunQueryRequest, callback: google.firestore.v1beta1.Firestore.RunQueryCallback): void; + + /** + * Calls RunQuery. + * @param request RunQueryRequest message or plain object + * @returns Promise + */ + public runQuery(request: google.firestore.v1beta1.IRunQueryRequest): Promise; + + /** + * Calls PartitionQuery. + * @param request PartitionQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PartitionQueryResponse + */ + public partitionQuery(request: google.firestore.v1beta1.IPartitionQueryRequest, callback: google.firestore.v1beta1.Firestore.PartitionQueryCallback): void; + + /** + * Calls PartitionQuery. + * @param request PartitionQueryRequest message or plain object + * @returns Promise + */ + public partitionQuery(request: google.firestore.v1beta1.IPartitionQueryRequest): Promise; + + /** + * Calls Write. + * @param request WriteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and WriteResponse + */ + public write(request: google.firestore.v1beta1.IWriteRequest, callback: google.firestore.v1beta1.Firestore.WriteCallback): void; + + /** + * Calls Write. + * @param request WriteRequest message or plain object + * @returns Promise + */ + public write(request: google.firestore.v1beta1.IWriteRequest): Promise; + + /** + * Calls Listen. + * @param request ListenRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListenResponse + */ + public listen(request: google.firestore.v1beta1.IListenRequest, callback: google.firestore.v1beta1.Firestore.ListenCallback): void; + + /** + * Calls Listen. + * @param request ListenRequest message or plain object + * @returns Promise + */ + public listen(request: google.firestore.v1beta1.IListenRequest): Promise; + + /** + * Calls ListCollectionIds. + * @param request ListCollectionIdsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCollectionIdsResponse + */ + public listCollectionIds(request: google.firestore.v1beta1.IListCollectionIdsRequest, callback: google.firestore.v1beta1.Firestore.ListCollectionIdsCallback): void; + + /** + * Calls ListCollectionIds. + * @param request ListCollectionIdsRequest message or plain object + * @returns Promise + */ + public listCollectionIds(request: google.firestore.v1beta1.IListCollectionIdsRequest): Promise; + + /** + * Calls BatchWrite. + * @param request BatchWriteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BatchWriteResponse + */ + public batchWrite(request: google.firestore.v1beta1.IBatchWriteRequest, callback: google.firestore.v1beta1.Firestore.BatchWriteCallback): void; + + /** + * Calls BatchWrite. + * @param request BatchWriteRequest message or plain object + * @returns Promise + */ + public batchWrite(request: google.firestore.v1beta1.IBatchWriteRequest): Promise; + + /** + * Calls CreateDocument. + * @param request CreateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Document + */ + public createDocument(request: google.firestore.v1beta1.ICreateDocumentRequest, callback: google.firestore.v1beta1.Firestore.CreateDocumentCallback): void; + + /** + * Calls CreateDocument. + * @param request CreateDocumentRequest message or plain object + * @returns Promise + */ + public createDocument(request: google.firestore.v1beta1.ICreateDocumentRequest): Promise; + } + + namespace Firestore { + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|getDocument}. + * @param error Error, if any + * @param [response] Document + */ + type GetDocumentCallback = (error: (Error|null), response?: google.firestore.v1beta1.Document) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|listDocuments}. + * @param error Error, if any + * @param [response] ListDocumentsResponse + */ + type ListDocumentsCallback = (error: (Error|null), response?: google.firestore.v1beta1.ListDocumentsResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|updateDocument}. + * @param error Error, if any + * @param [response] Document + */ + type UpdateDocumentCallback = (error: (Error|null), response?: google.firestore.v1beta1.Document) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|deleteDocument}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteDocumentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|batchGetDocuments}. + * @param error Error, if any + * @param [response] BatchGetDocumentsResponse + */ + type BatchGetDocumentsCallback = (error: (Error|null), response?: google.firestore.v1beta1.BatchGetDocumentsResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|beginTransaction}. + * @param error Error, if any + * @param [response] BeginTransactionResponse + */ + type BeginTransactionCallback = (error: (Error|null), response?: google.firestore.v1beta1.BeginTransactionResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|commit}. + * @param error Error, if any + * @param [response] CommitResponse + */ + type CommitCallback = (error: (Error|null), response?: google.firestore.v1beta1.CommitResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|rollback}. + * @param error Error, if any + * @param [response] Empty + */ + type RollbackCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|runQuery}. + * @param error Error, if any + * @param [response] RunQueryResponse + */ + type RunQueryCallback = (error: (Error|null), response?: google.firestore.v1beta1.RunQueryResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|partitionQuery}. + * @param error Error, if any + * @param [response] PartitionQueryResponse + */ + type PartitionQueryCallback = (error: (Error|null), response?: google.firestore.v1beta1.PartitionQueryResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|write}. + * @param error Error, if any + * @param [response] WriteResponse + */ + type WriteCallback = (error: (Error|null), response?: google.firestore.v1beta1.WriteResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|listen}. + * @param error Error, if any + * @param [response] ListenResponse + */ + type ListenCallback = (error: (Error|null), response?: google.firestore.v1beta1.ListenResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|listCollectionIds}. + * @param error Error, if any + * @param [response] ListCollectionIdsResponse + */ + type ListCollectionIdsCallback = (error: (Error|null), response?: google.firestore.v1beta1.ListCollectionIdsResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|batchWrite}. + * @param error Error, if any + * @param [response] BatchWriteResponse + */ + type BatchWriteCallback = (error: (Error|null), response?: google.firestore.v1beta1.BatchWriteResponse) => void; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|createDocument}. + * @param error Error, if any + * @param [response] Document + */ + type CreateDocumentCallback = (error: (Error|null), response?: google.firestore.v1beta1.Document) => void; + } + + /** Properties of a GetDocumentRequest. */ + interface IGetDocumentRequest { + + /** GetDocumentRequest name */ + name?: (string|null); + + /** GetDocumentRequest mask */ + mask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** GetDocumentRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** GetDocumentRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a GetDocumentRequest. */ + class GetDocumentRequest implements IGetDocumentRequest { + + /** + * Constructs a new GetDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IGetDocumentRequest); + + /** GetDocumentRequest name. */ + public name: string; + + /** GetDocumentRequest mask. */ + public mask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** GetDocumentRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** GetDocumentRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** GetDocumentRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"readTime"); + + /** + * Creates a new GetDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetDocumentRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IGetDocumentRequest): google.firestore.v1beta1.GetDocumentRequest; + + /** + * Encodes the specified GetDocumentRequest message. Does not implicitly {@link google.firestore.v1beta1.GetDocumentRequest.verify|verify} messages. + * @param message GetDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IGetDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.GetDocumentRequest.verify|verify} messages. + * @param message GetDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IGetDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.GetDocumentRequest; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.GetDocumentRequest; + + /** + * Verifies a GetDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.GetDocumentRequest; + + /** + * Creates a plain object from a GetDocumentRequest message. Also converts values to other types if specified. + * @param message GetDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.GetDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListDocumentsRequest. */ + interface IListDocumentsRequest { + + /** ListDocumentsRequest parent */ + parent?: (string|null); + + /** ListDocumentsRequest collectionId */ + collectionId?: (string|null); + + /** ListDocumentsRequest pageSize */ + pageSize?: (number|null); + + /** ListDocumentsRequest pageToken */ + pageToken?: (string|null); + + /** ListDocumentsRequest orderBy */ + orderBy?: (string|null); + + /** ListDocumentsRequest mask */ + mask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** ListDocumentsRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** ListDocumentsRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** ListDocumentsRequest showMissing */ + showMissing?: (boolean|null); + } + + /** Represents a ListDocumentsRequest. */ + class ListDocumentsRequest implements IListDocumentsRequest { + + /** + * Constructs a new ListDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IListDocumentsRequest); + + /** ListDocumentsRequest parent. */ + public parent: string; + + /** ListDocumentsRequest collectionId. */ + public collectionId: string; + + /** ListDocumentsRequest pageSize. */ + public pageSize: number; + + /** ListDocumentsRequest pageToken. */ + public pageToken: string; + + /** ListDocumentsRequest orderBy. */ + public orderBy: string; + + /** ListDocumentsRequest mask. */ + public mask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** ListDocumentsRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** ListDocumentsRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** ListDocumentsRequest showMissing. */ + public showMissing: boolean; + + /** ListDocumentsRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"readTime"); + + /** + * Creates a new ListDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDocumentsRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IListDocumentsRequest): google.firestore.v1beta1.ListDocumentsRequest; + + /** + * Encodes the specified ListDocumentsRequest message. Does not implicitly {@link google.firestore.v1beta1.ListDocumentsRequest.verify|verify} messages. + * @param message ListDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IListDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListDocumentsRequest.verify|verify} messages. + * @param message ListDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IListDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.ListDocumentsRequest; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.ListDocumentsRequest; + + /** + * Verifies a ListDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.ListDocumentsRequest; + + /** + * Creates a plain object from a ListDocumentsRequest message. Also converts values to other types if specified. + * @param message ListDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.ListDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListDocumentsResponse. */ + interface IListDocumentsResponse { + + /** ListDocumentsResponse documents */ + documents?: (google.firestore.v1beta1.IDocument[]|null); + + /** ListDocumentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListDocumentsResponse. */ + class ListDocumentsResponse implements IListDocumentsResponse { + + /** + * Constructs a new ListDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IListDocumentsResponse); + + /** ListDocumentsResponse documents. */ + public documents: google.firestore.v1beta1.IDocument[]; + + /** ListDocumentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDocumentsResponse instance + */ + public static create(properties?: google.firestore.v1beta1.IListDocumentsResponse): google.firestore.v1beta1.ListDocumentsResponse; + + /** + * Encodes the specified ListDocumentsResponse message. Does not implicitly {@link google.firestore.v1beta1.ListDocumentsResponse.verify|verify} messages. + * @param message ListDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IListDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListDocumentsResponse.verify|verify} messages. + * @param message ListDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IListDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.ListDocumentsResponse; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.ListDocumentsResponse; + + /** + * Verifies a ListDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.ListDocumentsResponse; + + /** + * Creates a plain object from a ListDocumentsResponse message. Also converts values to other types if specified. + * @param message ListDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.ListDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateDocumentRequest. */ + interface ICreateDocumentRequest { + + /** CreateDocumentRequest parent */ + parent?: (string|null); + + /** CreateDocumentRequest collectionId */ + collectionId?: (string|null); + + /** CreateDocumentRequest documentId */ + documentId?: (string|null); + + /** CreateDocumentRequest document */ + document?: (google.firestore.v1beta1.IDocument|null); + + /** CreateDocumentRequest mask */ + mask?: (google.firestore.v1beta1.IDocumentMask|null); + } + + /** Represents a CreateDocumentRequest. */ + class CreateDocumentRequest implements ICreateDocumentRequest { + + /** + * Constructs a new CreateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.ICreateDocumentRequest); + + /** CreateDocumentRequest parent. */ + public parent: string; + + /** CreateDocumentRequest collectionId. */ + public collectionId: string; + + /** CreateDocumentRequest documentId. */ + public documentId: string; + + /** CreateDocumentRequest document. */ + public document?: (google.firestore.v1beta1.IDocument|null); + + /** CreateDocumentRequest mask. */ + public mask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** + * Creates a new CreateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateDocumentRequest instance + */ + public static create(properties?: google.firestore.v1beta1.ICreateDocumentRequest): google.firestore.v1beta1.CreateDocumentRequest; + + /** + * Encodes the specified CreateDocumentRequest message. Does not implicitly {@link google.firestore.v1beta1.CreateDocumentRequest.verify|verify} messages. + * @param message CreateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.ICreateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.CreateDocumentRequest.verify|verify} messages. + * @param message CreateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.ICreateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.CreateDocumentRequest; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.CreateDocumentRequest; + + /** + * Verifies a CreateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.CreateDocumentRequest; + + /** + * Creates a plain object from a CreateDocumentRequest message. Also converts values to other types if specified. + * @param message CreateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.CreateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateDocumentRequest. */ + interface IUpdateDocumentRequest { + + /** UpdateDocumentRequest document */ + document?: (google.firestore.v1beta1.IDocument|null); + + /** UpdateDocumentRequest updateMask */ + updateMask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** UpdateDocumentRequest mask */ + mask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** UpdateDocumentRequest currentDocument */ + currentDocument?: (google.firestore.v1beta1.IPrecondition|null); + } + + /** Represents an UpdateDocumentRequest. */ + class UpdateDocumentRequest implements IUpdateDocumentRequest { + + /** + * Constructs a new UpdateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IUpdateDocumentRequest); + + /** UpdateDocumentRequest document. */ + public document?: (google.firestore.v1beta1.IDocument|null); + + /** UpdateDocumentRequest updateMask. */ + public updateMask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** UpdateDocumentRequest mask. */ + public mask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** UpdateDocumentRequest currentDocument. */ + public currentDocument?: (google.firestore.v1beta1.IPrecondition|null); + + /** + * Creates a new UpdateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateDocumentRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IUpdateDocumentRequest): google.firestore.v1beta1.UpdateDocumentRequest; + + /** + * Encodes the specified UpdateDocumentRequest message. Does not implicitly {@link google.firestore.v1beta1.UpdateDocumentRequest.verify|verify} messages. + * @param message UpdateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IUpdateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.UpdateDocumentRequest.verify|verify} messages. + * @param message UpdateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IUpdateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.UpdateDocumentRequest; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.UpdateDocumentRequest; + + /** + * Verifies an UpdateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.UpdateDocumentRequest; + + /** + * Creates a plain object from an UpdateDocumentRequest message. Also converts values to other types if specified. + * @param message UpdateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.UpdateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteDocumentRequest. */ + interface IDeleteDocumentRequest { + + /** DeleteDocumentRequest name */ + name?: (string|null); + + /** DeleteDocumentRequest currentDocument */ + currentDocument?: (google.firestore.v1beta1.IPrecondition|null); + } + + /** Represents a DeleteDocumentRequest. */ + class DeleteDocumentRequest implements IDeleteDocumentRequest { + + /** + * Constructs a new DeleteDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IDeleteDocumentRequest); + + /** DeleteDocumentRequest name. */ + public name: string; + + /** DeleteDocumentRequest currentDocument. */ + public currentDocument?: (google.firestore.v1beta1.IPrecondition|null); + + /** + * Creates a new DeleteDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteDocumentRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IDeleteDocumentRequest): google.firestore.v1beta1.DeleteDocumentRequest; + + /** + * Encodes the specified DeleteDocumentRequest message. Does not implicitly {@link google.firestore.v1beta1.DeleteDocumentRequest.verify|verify} messages. + * @param message DeleteDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IDeleteDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DeleteDocumentRequest.verify|verify} messages. + * @param message DeleteDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IDeleteDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.DeleteDocumentRequest; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.DeleteDocumentRequest; + + /** + * Verifies a DeleteDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.DeleteDocumentRequest; + + /** + * Creates a plain object from a DeleteDocumentRequest message. Also converts values to other types if specified. + * @param message DeleteDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.DeleteDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchGetDocumentsRequest. */ + interface IBatchGetDocumentsRequest { + + /** BatchGetDocumentsRequest database */ + database?: (string|null); + + /** BatchGetDocumentsRequest documents */ + documents?: (string[]|null); + + /** BatchGetDocumentsRequest mask */ + mask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** BatchGetDocumentsRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** BatchGetDocumentsRequest newTransaction */ + newTransaction?: (google.firestore.v1beta1.ITransactionOptions|null); + + /** BatchGetDocumentsRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchGetDocumentsRequest. */ + class BatchGetDocumentsRequest implements IBatchGetDocumentsRequest { + + /** + * Constructs a new BatchGetDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IBatchGetDocumentsRequest); + + /** BatchGetDocumentsRequest database. */ + public database: string; + + /** BatchGetDocumentsRequest documents. */ + public documents: string[]; + + /** BatchGetDocumentsRequest mask. */ + public mask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** BatchGetDocumentsRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** BatchGetDocumentsRequest newTransaction. */ + public newTransaction?: (google.firestore.v1beta1.ITransactionOptions|null); + + /** BatchGetDocumentsRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** BatchGetDocumentsRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"newTransaction"|"readTime"); + + /** + * Creates a new BatchGetDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchGetDocumentsRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IBatchGetDocumentsRequest): google.firestore.v1beta1.BatchGetDocumentsRequest; + + /** + * Encodes the specified BatchGetDocumentsRequest message. Does not implicitly {@link google.firestore.v1beta1.BatchGetDocumentsRequest.verify|verify} messages. + * @param message BatchGetDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IBatchGetDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchGetDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BatchGetDocumentsRequest.verify|verify} messages. + * @param message BatchGetDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IBatchGetDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchGetDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchGetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.BatchGetDocumentsRequest; + + /** + * Decodes a BatchGetDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchGetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.BatchGetDocumentsRequest; + + /** + * Verifies a BatchGetDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchGetDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchGetDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.BatchGetDocumentsRequest; + + /** + * Creates a plain object from a BatchGetDocumentsRequest message. Also converts values to other types if specified. + * @param message BatchGetDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.BatchGetDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchGetDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchGetDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchGetDocumentsResponse. */ + interface IBatchGetDocumentsResponse { + + /** BatchGetDocumentsResponse found */ + found?: (google.firestore.v1beta1.IDocument|null); + + /** BatchGetDocumentsResponse missing */ + missing?: (string|null); + + /** BatchGetDocumentsResponse transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** BatchGetDocumentsResponse readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchGetDocumentsResponse. */ + class BatchGetDocumentsResponse implements IBatchGetDocumentsResponse { + + /** + * Constructs a new BatchGetDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IBatchGetDocumentsResponse); + + /** BatchGetDocumentsResponse found. */ + public found?: (google.firestore.v1beta1.IDocument|null); + + /** BatchGetDocumentsResponse missing. */ + public missing?: (string|null); + + /** BatchGetDocumentsResponse transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** BatchGetDocumentsResponse readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** BatchGetDocumentsResponse result. */ + public result?: ("found"|"missing"); + + /** + * Creates a new BatchGetDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchGetDocumentsResponse instance + */ + public static create(properties?: google.firestore.v1beta1.IBatchGetDocumentsResponse): google.firestore.v1beta1.BatchGetDocumentsResponse; + + /** + * Encodes the specified BatchGetDocumentsResponse message. Does not implicitly {@link google.firestore.v1beta1.BatchGetDocumentsResponse.verify|verify} messages. + * @param message BatchGetDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IBatchGetDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchGetDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BatchGetDocumentsResponse.verify|verify} messages. + * @param message BatchGetDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IBatchGetDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchGetDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchGetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.BatchGetDocumentsResponse; + + /** + * Decodes a BatchGetDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchGetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.BatchGetDocumentsResponse; + + /** + * Verifies a BatchGetDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchGetDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchGetDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.BatchGetDocumentsResponse; + + /** + * Creates a plain object from a BatchGetDocumentsResponse message. Also converts values to other types if specified. + * @param message BatchGetDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.BatchGetDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchGetDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchGetDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BeginTransactionRequest. */ + interface IBeginTransactionRequest { + + /** BeginTransactionRequest database */ + database?: (string|null); + + /** BeginTransactionRequest options */ + options?: (google.firestore.v1beta1.ITransactionOptions|null); + } + + /** Represents a BeginTransactionRequest. */ + class BeginTransactionRequest implements IBeginTransactionRequest { + + /** + * Constructs a new BeginTransactionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IBeginTransactionRequest); + + /** BeginTransactionRequest database. */ + public database: string; + + /** BeginTransactionRequest options. */ + public options?: (google.firestore.v1beta1.ITransactionOptions|null); + + /** + * Creates a new BeginTransactionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BeginTransactionRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IBeginTransactionRequest): google.firestore.v1beta1.BeginTransactionRequest; + + /** + * Encodes the specified BeginTransactionRequest message. Does not implicitly {@link google.firestore.v1beta1.BeginTransactionRequest.verify|verify} messages. + * @param message BeginTransactionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IBeginTransactionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BeginTransactionRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BeginTransactionRequest.verify|verify} messages. + * @param message BeginTransactionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IBeginTransactionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BeginTransactionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BeginTransactionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.BeginTransactionRequest; + + /** + * Decodes a BeginTransactionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BeginTransactionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.BeginTransactionRequest; + + /** + * Verifies a BeginTransactionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BeginTransactionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BeginTransactionRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.BeginTransactionRequest; + + /** + * Creates a plain object from a BeginTransactionRequest message. Also converts values to other types if specified. + * @param message BeginTransactionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.BeginTransactionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BeginTransactionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BeginTransactionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BeginTransactionResponse. */ + interface IBeginTransactionResponse { + + /** BeginTransactionResponse transaction */ + transaction?: (Uint8Array|Buffer|string|null); + } + + /** Represents a BeginTransactionResponse. */ + class BeginTransactionResponse implements IBeginTransactionResponse { + + /** + * Constructs a new BeginTransactionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IBeginTransactionResponse); + + /** BeginTransactionResponse transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** + * Creates a new BeginTransactionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BeginTransactionResponse instance + */ + public static create(properties?: google.firestore.v1beta1.IBeginTransactionResponse): google.firestore.v1beta1.BeginTransactionResponse; + + /** + * Encodes the specified BeginTransactionResponse message. Does not implicitly {@link google.firestore.v1beta1.BeginTransactionResponse.verify|verify} messages. + * @param message BeginTransactionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IBeginTransactionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BeginTransactionResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BeginTransactionResponse.verify|verify} messages. + * @param message BeginTransactionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IBeginTransactionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BeginTransactionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BeginTransactionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.BeginTransactionResponse; + + /** + * Decodes a BeginTransactionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BeginTransactionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.BeginTransactionResponse; + + /** + * Verifies a BeginTransactionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BeginTransactionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BeginTransactionResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.BeginTransactionResponse; + + /** + * Creates a plain object from a BeginTransactionResponse message. Also converts values to other types if specified. + * @param message BeginTransactionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.BeginTransactionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BeginTransactionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BeginTransactionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CommitRequest. */ + interface ICommitRequest { + + /** CommitRequest database */ + database?: (string|null); + + /** CommitRequest writes */ + writes?: (google.firestore.v1beta1.IWrite[]|null); + + /** CommitRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + } + + /** Represents a CommitRequest. */ + class CommitRequest implements ICommitRequest { + + /** + * Constructs a new CommitRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.ICommitRequest); + + /** CommitRequest database. */ + public database: string; + + /** CommitRequest writes. */ + public writes: google.firestore.v1beta1.IWrite[]; + + /** CommitRequest transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** + * Creates a new CommitRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CommitRequest instance + */ + public static create(properties?: google.firestore.v1beta1.ICommitRequest): google.firestore.v1beta1.CommitRequest; + + /** + * Encodes the specified CommitRequest message. Does not implicitly {@link google.firestore.v1beta1.CommitRequest.verify|verify} messages. + * @param message CommitRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.ICommitRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CommitRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.CommitRequest.verify|verify} messages. + * @param message CommitRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.ICommitRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommitRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CommitRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.CommitRequest; + + /** + * Decodes a CommitRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CommitRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.CommitRequest; + + /** + * Verifies a CommitRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CommitRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CommitRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.CommitRequest; + + /** + * Creates a plain object from a CommitRequest message. Also converts values to other types if specified. + * @param message CommitRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.CommitRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CommitRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CommitRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CommitResponse. */ + interface ICommitResponse { + + /** CommitResponse writeResults */ + writeResults?: (google.firestore.v1beta1.IWriteResult[]|null); + + /** CommitResponse commitTime */ + commitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CommitResponse. */ + class CommitResponse implements ICommitResponse { + + /** + * Constructs a new CommitResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.ICommitResponse); + + /** CommitResponse writeResults. */ + public writeResults: google.firestore.v1beta1.IWriteResult[]; + + /** CommitResponse commitTime. */ + public commitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new CommitResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns CommitResponse instance + */ + public static create(properties?: google.firestore.v1beta1.ICommitResponse): google.firestore.v1beta1.CommitResponse; + + /** + * Encodes the specified CommitResponse message. Does not implicitly {@link google.firestore.v1beta1.CommitResponse.verify|verify} messages. + * @param message CommitResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.ICommitResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CommitResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.CommitResponse.verify|verify} messages. + * @param message CommitResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.ICommitResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommitResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CommitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.CommitResponse; + + /** + * Decodes a CommitResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CommitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.CommitResponse; + + /** + * Verifies a CommitResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CommitResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CommitResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.CommitResponse; + + /** + * Creates a plain object from a CommitResponse message. Also converts values to other types if specified. + * @param message CommitResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.CommitResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CommitResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CommitResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RollbackRequest. */ + interface IRollbackRequest { + + /** RollbackRequest database */ + database?: (string|null); + + /** RollbackRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + } + + /** Represents a RollbackRequest. */ + class RollbackRequest implements IRollbackRequest { + + /** + * Constructs a new RollbackRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IRollbackRequest); + + /** RollbackRequest database. */ + public database: string; + + /** RollbackRequest transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** + * Creates a new RollbackRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RollbackRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IRollbackRequest): google.firestore.v1beta1.RollbackRequest; + + /** + * Encodes the specified RollbackRequest message. Does not implicitly {@link google.firestore.v1beta1.RollbackRequest.verify|verify} messages. + * @param message RollbackRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IRollbackRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RollbackRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.RollbackRequest.verify|verify} messages. + * @param message RollbackRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IRollbackRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RollbackRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RollbackRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.RollbackRequest; + + /** + * Decodes a RollbackRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RollbackRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.RollbackRequest; + + /** + * Verifies a RollbackRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RollbackRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RollbackRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.RollbackRequest; + + /** + * Creates a plain object from a RollbackRequest message. Also converts values to other types if specified. + * @param message RollbackRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.RollbackRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RollbackRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RollbackRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RunQueryRequest. */ + interface IRunQueryRequest { + + /** RunQueryRequest parent */ + parent?: (string|null); + + /** RunQueryRequest structuredQuery */ + structuredQuery?: (google.firestore.v1beta1.IStructuredQuery|null); + + /** RunQueryRequest transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** RunQueryRequest newTransaction */ + newTransaction?: (google.firestore.v1beta1.ITransactionOptions|null); + + /** RunQueryRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a RunQueryRequest. */ + class RunQueryRequest implements IRunQueryRequest { + + /** + * Constructs a new RunQueryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IRunQueryRequest); + + /** RunQueryRequest parent. */ + public parent: string; + + /** RunQueryRequest structuredQuery. */ + public structuredQuery?: (google.firestore.v1beta1.IStructuredQuery|null); + + /** RunQueryRequest transaction. */ + public transaction?: (Uint8Array|Buffer|string|null); + + /** RunQueryRequest newTransaction. */ + public newTransaction?: (google.firestore.v1beta1.ITransactionOptions|null); + + /** RunQueryRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** RunQueryRequest queryType. */ + public queryType?: "structuredQuery"; + + /** RunQueryRequest consistencySelector. */ + public consistencySelector?: ("transaction"|"newTransaction"|"readTime"); + + /** + * Creates a new RunQueryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RunQueryRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IRunQueryRequest): google.firestore.v1beta1.RunQueryRequest; + + /** + * Encodes the specified RunQueryRequest message. Does not implicitly {@link google.firestore.v1beta1.RunQueryRequest.verify|verify} messages. + * @param message RunQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IRunQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RunQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.RunQueryRequest.verify|verify} messages. + * @param message RunQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IRunQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RunQueryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RunQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.RunQueryRequest; + + /** + * Decodes a RunQueryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RunQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.RunQueryRequest; + + /** + * Verifies a RunQueryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RunQueryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RunQueryRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.RunQueryRequest; + + /** + * Creates a plain object from a RunQueryRequest message. Also converts values to other types if specified. + * @param message RunQueryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.RunQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RunQueryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RunQueryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RunQueryResponse. */ + interface IRunQueryResponse { + + /** RunQueryResponse transaction */ + transaction?: (Uint8Array|Buffer|string|null); + + /** RunQueryResponse document */ + document?: (google.firestore.v1beta1.IDocument|null); + + /** RunQueryResponse readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** RunQueryResponse skippedResults */ + skippedResults?: (number|null); + } + + /** Represents a RunQueryResponse. */ + class RunQueryResponse implements IRunQueryResponse { + + /** + * Constructs a new RunQueryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IRunQueryResponse); + + /** RunQueryResponse transaction. */ + public transaction: (Uint8Array|Buffer|string); + + /** RunQueryResponse document. */ + public document?: (google.firestore.v1beta1.IDocument|null); + + /** RunQueryResponse readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** RunQueryResponse skippedResults. */ + public skippedResults: number; + + /** + * Creates a new RunQueryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RunQueryResponse instance + */ + public static create(properties?: google.firestore.v1beta1.IRunQueryResponse): google.firestore.v1beta1.RunQueryResponse; + + /** + * Encodes the specified RunQueryResponse message. Does not implicitly {@link google.firestore.v1beta1.RunQueryResponse.verify|verify} messages. + * @param message RunQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IRunQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RunQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.RunQueryResponse.verify|verify} messages. + * @param message RunQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IRunQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RunQueryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RunQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.RunQueryResponse; + + /** + * Decodes a RunQueryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RunQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.RunQueryResponse; + + /** + * Verifies a RunQueryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RunQueryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RunQueryResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.RunQueryResponse; + + /** + * Creates a plain object from a RunQueryResponse message. Also converts values to other types if specified. + * @param message RunQueryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.RunQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RunQueryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RunQueryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PartitionQueryRequest. */ + interface IPartitionQueryRequest { + + /** PartitionQueryRequest parent */ + parent?: (string|null); + + /** PartitionQueryRequest structuredQuery */ + structuredQuery?: (google.firestore.v1beta1.IStructuredQuery|null); + + /** PartitionQueryRequest partitionCount */ + partitionCount?: (number|Long|string|null); + + /** PartitionQueryRequest pageToken */ + pageToken?: (string|null); + + /** PartitionQueryRequest pageSize */ + pageSize?: (number|null); + } + + /** Represents a PartitionQueryRequest. */ + class PartitionQueryRequest implements IPartitionQueryRequest { + + /** + * Constructs a new PartitionQueryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IPartitionQueryRequest); + + /** PartitionQueryRequest parent. */ + public parent: string; + + /** PartitionQueryRequest structuredQuery. */ + public structuredQuery?: (google.firestore.v1beta1.IStructuredQuery|null); + + /** PartitionQueryRequest partitionCount. */ + public partitionCount: (number|Long|string); + + /** PartitionQueryRequest pageToken. */ + public pageToken: string; + + /** PartitionQueryRequest pageSize. */ + public pageSize: number; + + /** PartitionQueryRequest queryType. */ + public queryType?: "structuredQuery"; + + /** + * Creates a new PartitionQueryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PartitionQueryRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IPartitionQueryRequest): google.firestore.v1beta1.PartitionQueryRequest; + + /** + * Encodes the specified PartitionQueryRequest message. Does not implicitly {@link google.firestore.v1beta1.PartitionQueryRequest.verify|verify} messages. + * @param message PartitionQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IPartitionQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PartitionQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.PartitionQueryRequest.verify|verify} messages. + * @param message PartitionQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IPartitionQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PartitionQueryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PartitionQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.PartitionQueryRequest; + + /** + * Decodes a PartitionQueryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PartitionQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.PartitionQueryRequest; + + /** + * Verifies a PartitionQueryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PartitionQueryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PartitionQueryRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.PartitionQueryRequest; + + /** + * Creates a plain object from a PartitionQueryRequest message. Also converts values to other types if specified. + * @param message PartitionQueryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.PartitionQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PartitionQueryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PartitionQueryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PartitionQueryResponse. */ + interface IPartitionQueryResponse { + + /** PartitionQueryResponse partitions */ + partitions?: (google.firestore.v1beta1.ICursor[]|null); + + /** PartitionQueryResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a PartitionQueryResponse. */ + class PartitionQueryResponse implements IPartitionQueryResponse { + + /** + * Constructs a new PartitionQueryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IPartitionQueryResponse); + + /** PartitionQueryResponse partitions. */ + public partitions: google.firestore.v1beta1.ICursor[]; + + /** PartitionQueryResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new PartitionQueryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PartitionQueryResponse instance + */ + public static create(properties?: google.firestore.v1beta1.IPartitionQueryResponse): google.firestore.v1beta1.PartitionQueryResponse; + + /** + * Encodes the specified PartitionQueryResponse message. Does not implicitly {@link google.firestore.v1beta1.PartitionQueryResponse.verify|verify} messages. + * @param message PartitionQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IPartitionQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PartitionQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.PartitionQueryResponse.verify|verify} messages. + * @param message PartitionQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IPartitionQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PartitionQueryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PartitionQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.PartitionQueryResponse; + + /** + * Decodes a PartitionQueryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PartitionQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.PartitionQueryResponse; + + /** + * Verifies a PartitionQueryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PartitionQueryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PartitionQueryResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.PartitionQueryResponse; + + /** + * Creates a plain object from a PartitionQueryResponse message. Also converts values to other types if specified. + * @param message PartitionQueryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.PartitionQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PartitionQueryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PartitionQueryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WriteRequest. */ + interface IWriteRequest { + + /** WriteRequest database */ + database?: (string|null); + + /** WriteRequest streamId */ + streamId?: (string|null); + + /** WriteRequest writes */ + writes?: (google.firestore.v1beta1.IWrite[]|null); + + /** WriteRequest streamToken */ + streamToken?: (Uint8Array|Buffer|string|null); + + /** WriteRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a WriteRequest. */ + class WriteRequest implements IWriteRequest { + + /** + * Constructs a new WriteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IWriteRequest); + + /** WriteRequest database. */ + public database: string; + + /** WriteRequest streamId. */ + public streamId: string; + + /** WriteRequest writes. */ + public writes: google.firestore.v1beta1.IWrite[]; + + /** WriteRequest streamToken. */ + public streamToken: (Uint8Array|Buffer|string); + + /** WriteRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new WriteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IWriteRequest): google.firestore.v1beta1.WriteRequest; + + /** + * Encodes the specified WriteRequest message. Does not implicitly {@link google.firestore.v1beta1.WriteRequest.verify|verify} messages. + * @param message WriteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IWriteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.WriteRequest.verify|verify} messages. + * @param message WriteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IWriteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.WriteRequest; + + /** + * Decodes a WriteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.WriteRequest; + + /** + * Verifies a WriteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.WriteRequest; + + /** + * Creates a plain object from a WriteRequest message. Also converts values to other types if specified. + * @param message WriteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.WriteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WriteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WriteResponse. */ + interface IWriteResponse { + + /** WriteResponse streamId */ + streamId?: (string|null); + + /** WriteResponse streamToken */ + streamToken?: (Uint8Array|Buffer|string|null); + + /** WriteResponse writeResults */ + writeResults?: (google.firestore.v1beta1.IWriteResult[]|null); + + /** WriteResponse commitTime */ + commitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a WriteResponse. */ + class WriteResponse implements IWriteResponse { + + /** + * Constructs a new WriteResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IWriteResponse); + + /** WriteResponse streamId. */ + public streamId: string; + + /** WriteResponse streamToken. */ + public streamToken: (Uint8Array|Buffer|string); + + /** WriteResponse writeResults. */ + public writeResults: google.firestore.v1beta1.IWriteResult[]; + + /** WriteResponse commitTime. */ + public commitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new WriteResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteResponse instance + */ + public static create(properties?: google.firestore.v1beta1.IWriteResponse): google.firestore.v1beta1.WriteResponse; + + /** + * Encodes the specified WriteResponse message. Does not implicitly {@link google.firestore.v1beta1.WriteResponse.verify|verify} messages. + * @param message WriteResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IWriteResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.WriteResponse.verify|verify} messages. + * @param message WriteResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IWriteResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.WriteResponse; + + /** + * Decodes a WriteResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.WriteResponse; + + /** + * Verifies a WriteResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.WriteResponse; + + /** + * Creates a plain object from a WriteResponse message. Also converts values to other types if specified. + * @param message WriteResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.WriteResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WriteResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListenRequest. */ + interface IListenRequest { + + /** ListenRequest database */ + database?: (string|null); + + /** ListenRequest addTarget */ + addTarget?: (google.firestore.v1beta1.ITarget|null); + + /** ListenRequest removeTarget */ + removeTarget?: (number|null); + + /** ListenRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a ListenRequest. */ + class ListenRequest implements IListenRequest { + + /** + * Constructs a new ListenRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IListenRequest); + + /** ListenRequest database. */ + public database: string; + + /** ListenRequest addTarget. */ + public addTarget?: (google.firestore.v1beta1.ITarget|null); + + /** ListenRequest removeTarget. */ + public removeTarget?: (number|null); + + /** ListenRequest labels. */ + public labels: { [k: string]: string }; + + /** ListenRequest targetChange. */ + public targetChange?: ("addTarget"|"removeTarget"); + + /** + * Creates a new ListenRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListenRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IListenRequest): google.firestore.v1beta1.ListenRequest; + + /** + * Encodes the specified ListenRequest message. Does not implicitly {@link google.firestore.v1beta1.ListenRequest.verify|verify} messages. + * @param message ListenRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IListenRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListenRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListenRequest.verify|verify} messages. + * @param message ListenRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IListenRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListenRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListenRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.ListenRequest; + + /** + * Decodes a ListenRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListenRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.ListenRequest; + + /** + * Verifies a ListenRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListenRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListenRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.ListenRequest; + + /** + * Creates a plain object from a ListenRequest message. Also converts values to other types if specified. + * @param message ListenRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.ListenRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListenRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListenRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListenResponse. */ + interface IListenResponse { + + /** ListenResponse targetChange */ + targetChange?: (google.firestore.v1beta1.ITargetChange|null); + + /** ListenResponse documentChange */ + documentChange?: (google.firestore.v1beta1.IDocumentChange|null); + + /** ListenResponse documentDelete */ + documentDelete?: (google.firestore.v1beta1.IDocumentDelete|null); + + /** ListenResponse documentRemove */ + documentRemove?: (google.firestore.v1beta1.IDocumentRemove|null); + + /** ListenResponse filter */ + filter?: (google.firestore.v1beta1.IExistenceFilter|null); + } + + /** Represents a ListenResponse. */ + class ListenResponse implements IListenResponse { + + /** + * Constructs a new ListenResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IListenResponse); + + /** ListenResponse targetChange. */ + public targetChange?: (google.firestore.v1beta1.ITargetChange|null); + + /** ListenResponse documentChange. */ + public documentChange?: (google.firestore.v1beta1.IDocumentChange|null); + + /** ListenResponse documentDelete. */ + public documentDelete?: (google.firestore.v1beta1.IDocumentDelete|null); + + /** ListenResponse documentRemove. */ + public documentRemove?: (google.firestore.v1beta1.IDocumentRemove|null); + + /** ListenResponse filter. */ + public filter?: (google.firestore.v1beta1.IExistenceFilter|null); + + /** ListenResponse responseType. */ + public responseType?: ("targetChange"|"documentChange"|"documentDelete"|"documentRemove"|"filter"); + + /** + * Creates a new ListenResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListenResponse instance + */ + public static create(properties?: google.firestore.v1beta1.IListenResponse): google.firestore.v1beta1.ListenResponse; + + /** + * Encodes the specified ListenResponse message. Does not implicitly {@link google.firestore.v1beta1.ListenResponse.verify|verify} messages. + * @param message ListenResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IListenResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListenResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListenResponse.verify|verify} messages. + * @param message ListenResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IListenResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListenResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListenResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.ListenResponse; + + /** + * Decodes a ListenResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListenResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.ListenResponse; + + /** + * Verifies a ListenResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListenResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListenResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.ListenResponse; + + /** + * Creates a plain object from a ListenResponse message. Also converts values to other types if specified. + * @param message ListenResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.ListenResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListenResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListenResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Target. */ + interface ITarget { + + /** Target query */ + query?: (google.firestore.v1beta1.Target.IQueryTarget|null); + + /** Target documents */ + documents?: (google.firestore.v1beta1.Target.IDocumentsTarget|null); + + /** Target resumeToken */ + resumeToken?: (Uint8Array|Buffer|string|null); + + /** Target readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** Target targetId */ + targetId?: (number|null); + + /** Target once */ + once?: (boolean|null); + } + + /** Represents a Target. */ + class Target implements ITarget { + + /** + * Constructs a new Target. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.ITarget); + + /** Target query. */ + public query?: (google.firestore.v1beta1.Target.IQueryTarget|null); + + /** Target documents. */ + public documents?: (google.firestore.v1beta1.Target.IDocumentsTarget|null); + + /** Target resumeToken. */ + public resumeToken?: (Uint8Array|Buffer|string|null); + + /** Target readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** Target targetId. */ + public targetId: number; + + /** Target once. */ + public once: boolean; + + /** Target targetType. */ + public targetType?: ("query"|"documents"); + + /** Target resumeType. */ + public resumeType?: ("resumeToken"|"readTime"); + + /** + * Creates a new Target instance using the specified properties. + * @param [properties] Properties to set + * @returns Target instance + */ + public static create(properties?: google.firestore.v1beta1.ITarget): google.firestore.v1beta1.Target; + + /** + * Encodes the specified Target message. Does not implicitly {@link google.firestore.v1beta1.Target.verify|verify} messages. + * @param message Target message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.ITarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Target message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Target.verify|verify} messages. + * @param message Target message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.ITarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Target message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Target + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.Target; + + /** + * Decodes a Target message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Target + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.Target; + + /** + * Verifies a Target message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Target message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Target + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.Target; + + /** + * Creates a plain object from a Target message. Also converts values to other types if specified. + * @param message Target + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.Target, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Target to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Target + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Target { + + /** Properties of a DocumentsTarget. */ + interface IDocumentsTarget { + + /** DocumentsTarget documents */ + documents?: (string[]|null); + } + + /** Represents a DocumentsTarget. */ + class DocumentsTarget implements IDocumentsTarget { + + /** + * Constructs a new DocumentsTarget. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.Target.IDocumentsTarget); + + /** DocumentsTarget documents. */ + public documents: string[]; + + /** + * Creates a new DocumentsTarget instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentsTarget instance + */ + public static create(properties?: google.firestore.v1beta1.Target.IDocumentsTarget): google.firestore.v1beta1.Target.DocumentsTarget; + + /** + * Encodes the specified DocumentsTarget message. Does not implicitly {@link google.firestore.v1beta1.Target.DocumentsTarget.verify|verify} messages. + * @param message DocumentsTarget message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.Target.IDocumentsTarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentsTarget message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Target.DocumentsTarget.verify|verify} messages. + * @param message DocumentsTarget message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.Target.IDocumentsTarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentsTarget message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentsTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.Target.DocumentsTarget; + + /** + * Decodes a DocumentsTarget message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentsTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.Target.DocumentsTarget; + + /** + * Verifies a DocumentsTarget message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentsTarget message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentsTarget + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.Target.DocumentsTarget; + + /** + * Creates a plain object from a DocumentsTarget message. Also converts values to other types if specified. + * @param message DocumentsTarget + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.Target.DocumentsTarget, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentsTarget to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentsTarget + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryTarget. */ + interface IQueryTarget { + + /** QueryTarget parent */ + parent?: (string|null); + + /** QueryTarget structuredQuery */ + structuredQuery?: (google.firestore.v1beta1.IStructuredQuery|null); + } + + /** Represents a QueryTarget. */ + class QueryTarget implements IQueryTarget { + + /** + * Constructs a new QueryTarget. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.Target.IQueryTarget); + + /** QueryTarget parent. */ + public parent: string; + + /** QueryTarget structuredQuery. */ + public structuredQuery?: (google.firestore.v1beta1.IStructuredQuery|null); + + /** QueryTarget queryType. */ + public queryType?: "structuredQuery"; + + /** + * Creates a new QueryTarget instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryTarget instance + */ + public static create(properties?: google.firestore.v1beta1.Target.IQueryTarget): google.firestore.v1beta1.Target.QueryTarget; + + /** + * Encodes the specified QueryTarget message. Does not implicitly {@link google.firestore.v1beta1.Target.QueryTarget.verify|verify} messages. + * @param message QueryTarget message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.Target.IQueryTarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryTarget message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Target.QueryTarget.verify|verify} messages. + * @param message QueryTarget message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.Target.IQueryTarget, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryTarget message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.Target.QueryTarget; + + /** + * Decodes a QueryTarget message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.Target.QueryTarget; + + /** + * Verifies a QueryTarget message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryTarget message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryTarget + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.Target.QueryTarget; + + /** + * Creates a plain object from a QueryTarget message. Also converts values to other types if specified. + * @param message QueryTarget + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.Target.QueryTarget, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryTarget to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryTarget + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a TargetChange. */ + interface ITargetChange { + + /** TargetChange targetChangeType */ + targetChangeType?: (google.firestore.v1beta1.TargetChange.TargetChangeType|keyof typeof google.firestore.v1beta1.TargetChange.TargetChangeType|null); + + /** TargetChange targetIds */ + targetIds?: (number[]|null); + + /** TargetChange cause */ + cause?: (google.rpc.IStatus|null); + + /** TargetChange resumeToken */ + resumeToken?: (Uint8Array|Buffer|string|null); + + /** TargetChange readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a TargetChange. */ + class TargetChange implements ITargetChange { + + /** + * Constructs a new TargetChange. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.ITargetChange); + + /** TargetChange targetChangeType. */ + public targetChangeType: (google.firestore.v1beta1.TargetChange.TargetChangeType|keyof typeof google.firestore.v1beta1.TargetChange.TargetChangeType); + + /** TargetChange targetIds. */ + public targetIds: number[]; + + /** TargetChange cause. */ + public cause?: (google.rpc.IStatus|null); + + /** TargetChange resumeToken. */ + public resumeToken: (Uint8Array|Buffer|string); + + /** TargetChange readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new TargetChange instance using the specified properties. + * @param [properties] Properties to set + * @returns TargetChange instance + */ + public static create(properties?: google.firestore.v1beta1.ITargetChange): google.firestore.v1beta1.TargetChange; + + /** + * Encodes the specified TargetChange message. Does not implicitly {@link google.firestore.v1beta1.TargetChange.verify|verify} messages. + * @param message TargetChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.ITargetChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TargetChange message, length delimited. Does not implicitly {@link google.firestore.v1beta1.TargetChange.verify|verify} messages. + * @param message TargetChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.ITargetChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TargetChange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TargetChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.TargetChange; + + /** + * Decodes a TargetChange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TargetChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.TargetChange; + + /** + * Verifies a TargetChange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TargetChange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TargetChange + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.TargetChange; + + /** + * Creates a plain object from a TargetChange message. Also converts values to other types if specified. + * @param message TargetChange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.TargetChange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TargetChange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TargetChange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TargetChange { + + /** TargetChangeType enum. */ + enum TargetChangeType { + NO_CHANGE = 0, + ADD = 1, + REMOVE = 2, + CURRENT = 3, + RESET = 4 + } + } + + /** Properties of a ListCollectionIdsRequest. */ + interface IListCollectionIdsRequest { + + /** ListCollectionIdsRequest parent */ + parent?: (string|null); + + /** ListCollectionIdsRequest pageSize */ + pageSize?: (number|null); + + /** ListCollectionIdsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListCollectionIdsRequest. */ + class ListCollectionIdsRequest implements IListCollectionIdsRequest { + + /** + * Constructs a new ListCollectionIdsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IListCollectionIdsRequest); + + /** ListCollectionIdsRequest parent. */ + public parent: string; + + /** ListCollectionIdsRequest pageSize. */ + public pageSize: number; + + /** ListCollectionIdsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListCollectionIdsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCollectionIdsRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IListCollectionIdsRequest): google.firestore.v1beta1.ListCollectionIdsRequest; + + /** + * Encodes the specified ListCollectionIdsRequest message. Does not implicitly {@link google.firestore.v1beta1.ListCollectionIdsRequest.verify|verify} messages. + * @param message ListCollectionIdsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IListCollectionIdsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCollectionIdsRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListCollectionIdsRequest.verify|verify} messages. + * @param message ListCollectionIdsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IListCollectionIdsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCollectionIdsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCollectionIdsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.ListCollectionIdsRequest; + + /** + * Decodes a ListCollectionIdsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCollectionIdsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.ListCollectionIdsRequest; + + /** + * Verifies a ListCollectionIdsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCollectionIdsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCollectionIdsRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.ListCollectionIdsRequest; + + /** + * Creates a plain object from a ListCollectionIdsRequest message. Also converts values to other types if specified. + * @param message ListCollectionIdsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.ListCollectionIdsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCollectionIdsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCollectionIdsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListCollectionIdsResponse. */ + interface IListCollectionIdsResponse { + + /** ListCollectionIdsResponse collectionIds */ + collectionIds?: (string[]|null); + + /** ListCollectionIdsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListCollectionIdsResponse. */ + class ListCollectionIdsResponse implements IListCollectionIdsResponse { + + /** + * Constructs a new ListCollectionIdsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IListCollectionIdsResponse); + + /** ListCollectionIdsResponse collectionIds. */ + public collectionIds: string[]; + + /** ListCollectionIdsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListCollectionIdsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCollectionIdsResponse instance + */ + public static create(properties?: google.firestore.v1beta1.IListCollectionIdsResponse): google.firestore.v1beta1.ListCollectionIdsResponse; + + /** + * Encodes the specified ListCollectionIdsResponse message. Does not implicitly {@link google.firestore.v1beta1.ListCollectionIdsResponse.verify|verify} messages. + * @param message ListCollectionIdsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IListCollectionIdsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCollectionIdsResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListCollectionIdsResponse.verify|verify} messages. + * @param message ListCollectionIdsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IListCollectionIdsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCollectionIdsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCollectionIdsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.ListCollectionIdsResponse; + + /** + * Decodes a ListCollectionIdsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCollectionIdsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.ListCollectionIdsResponse; + + /** + * Verifies a ListCollectionIdsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCollectionIdsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCollectionIdsResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.ListCollectionIdsResponse; + + /** + * Creates a plain object from a ListCollectionIdsResponse message. Also converts values to other types if specified. + * @param message ListCollectionIdsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.ListCollectionIdsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCollectionIdsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCollectionIdsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchWriteRequest. */ + interface IBatchWriteRequest { + + /** BatchWriteRequest database */ + database?: (string|null); + + /** BatchWriteRequest writes */ + writes?: (google.firestore.v1beta1.IWrite[]|null); + + /** BatchWriteRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a BatchWriteRequest. */ + class BatchWriteRequest implements IBatchWriteRequest { + + /** + * Constructs a new BatchWriteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IBatchWriteRequest); + + /** BatchWriteRequest database. */ + public database: string; + + /** BatchWriteRequest writes. */ + public writes: google.firestore.v1beta1.IWrite[]; + + /** BatchWriteRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new BatchWriteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchWriteRequest instance + */ + public static create(properties?: google.firestore.v1beta1.IBatchWriteRequest): google.firestore.v1beta1.BatchWriteRequest; + + /** + * Encodes the specified BatchWriteRequest message. Does not implicitly {@link google.firestore.v1beta1.BatchWriteRequest.verify|verify} messages. + * @param message BatchWriteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IBatchWriteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchWriteRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BatchWriteRequest.verify|verify} messages. + * @param message BatchWriteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IBatchWriteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchWriteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchWriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.BatchWriteRequest; + + /** + * Decodes a BatchWriteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchWriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.BatchWriteRequest; + + /** + * Verifies a BatchWriteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchWriteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchWriteRequest + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.BatchWriteRequest; + + /** + * Creates a plain object from a BatchWriteRequest message. Also converts values to other types if specified. + * @param message BatchWriteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.BatchWriteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchWriteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchWriteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchWriteResponse. */ + interface IBatchWriteResponse { + + /** BatchWriteResponse writeResults */ + writeResults?: (google.firestore.v1beta1.IWriteResult[]|null); + + /** BatchWriteResponse status */ + status?: (google.rpc.IStatus[]|null); + } + + /** Represents a BatchWriteResponse. */ + class BatchWriteResponse implements IBatchWriteResponse { + + /** + * Constructs a new BatchWriteResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IBatchWriteResponse); + + /** BatchWriteResponse writeResults. */ + public writeResults: google.firestore.v1beta1.IWriteResult[]; + + /** BatchWriteResponse status. */ + public status: google.rpc.IStatus[]; + + /** + * Creates a new BatchWriteResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchWriteResponse instance + */ + public static create(properties?: google.firestore.v1beta1.IBatchWriteResponse): google.firestore.v1beta1.BatchWriteResponse; + + /** + * Encodes the specified BatchWriteResponse message. Does not implicitly {@link google.firestore.v1beta1.BatchWriteResponse.verify|verify} messages. + * @param message BatchWriteResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IBatchWriteResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchWriteResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BatchWriteResponse.verify|verify} messages. + * @param message BatchWriteResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IBatchWriteResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchWriteResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchWriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.BatchWriteResponse; + + /** + * Decodes a BatchWriteResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchWriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.BatchWriteResponse; + + /** + * Verifies a BatchWriteResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchWriteResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchWriteResponse + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.BatchWriteResponse; + + /** + * Creates a plain object from a BatchWriteResponse message. Also converts values to other types if specified. + * @param message BatchWriteResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.BatchWriteResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchWriteResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchWriteResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StructuredQuery. */ + interface IStructuredQuery { + + /** StructuredQuery select */ + select?: (google.firestore.v1beta1.StructuredQuery.IProjection|null); + + /** StructuredQuery from */ + from?: (google.firestore.v1beta1.StructuredQuery.ICollectionSelector[]|null); + + /** StructuredQuery where */ + where?: (google.firestore.v1beta1.StructuredQuery.IFilter|null); + + /** StructuredQuery orderBy */ + orderBy?: (google.firestore.v1beta1.StructuredQuery.IOrder[]|null); + + /** StructuredQuery startAt */ + startAt?: (google.firestore.v1beta1.ICursor|null); + + /** StructuredQuery endAt */ + endAt?: (google.firestore.v1beta1.ICursor|null); + + /** StructuredQuery offset */ + offset?: (number|null); + + /** StructuredQuery limit */ + limit?: (google.protobuf.IInt32Value|null); + } + + /** Represents a StructuredQuery. */ + class StructuredQuery implements IStructuredQuery { + + /** + * Constructs a new StructuredQuery. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IStructuredQuery); + + /** StructuredQuery select. */ + public select?: (google.firestore.v1beta1.StructuredQuery.IProjection|null); + + /** StructuredQuery from. */ + public from: google.firestore.v1beta1.StructuredQuery.ICollectionSelector[]; + + /** StructuredQuery where. */ + public where?: (google.firestore.v1beta1.StructuredQuery.IFilter|null); + + /** StructuredQuery orderBy. */ + public orderBy: google.firestore.v1beta1.StructuredQuery.IOrder[]; + + /** StructuredQuery startAt. */ + public startAt?: (google.firestore.v1beta1.ICursor|null); + + /** StructuredQuery endAt. */ + public endAt?: (google.firestore.v1beta1.ICursor|null); + + /** StructuredQuery offset. */ + public offset: number; + + /** StructuredQuery limit. */ + public limit?: (google.protobuf.IInt32Value|null); + + /** + * Creates a new StructuredQuery instance using the specified properties. + * @param [properties] Properties to set + * @returns StructuredQuery instance + */ + public static create(properties?: google.firestore.v1beta1.IStructuredQuery): google.firestore.v1beta1.StructuredQuery; + + /** + * Encodes the specified StructuredQuery message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.verify|verify} messages. + * @param message StructuredQuery message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IStructuredQuery, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StructuredQuery message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.verify|verify} messages. + * @param message StructuredQuery message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IStructuredQuery, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StructuredQuery message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StructuredQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.StructuredQuery; + + /** + * Decodes a StructuredQuery message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StructuredQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.StructuredQuery; + + /** + * Verifies a StructuredQuery message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StructuredQuery message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StructuredQuery + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.StructuredQuery; + + /** + * Creates a plain object from a StructuredQuery message. Also converts values to other types if specified. + * @param message StructuredQuery + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.StructuredQuery, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StructuredQuery to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StructuredQuery + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace StructuredQuery { + + /** Properties of a CollectionSelector. */ + interface ICollectionSelector { + + /** CollectionSelector collectionId */ + collectionId?: (string|null); + + /** CollectionSelector allDescendants */ + allDescendants?: (boolean|null); + } + + /** Represents a CollectionSelector. */ + class CollectionSelector implements ICollectionSelector { + + /** + * Constructs a new CollectionSelector. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.StructuredQuery.ICollectionSelector); + + /** CollectionSelector collectionId. */ + public collectionId: string; + + /** CollectionSelector allDescendants. */ + public allDescendants: boolean; + + /** + * Creates a new CollectionSelector instance using the specified properties. + * @param [properties] Properties to set + * @returns CollectionSelector instance + */ + public static create(properties?: google.firestore.v1beta1.StructuredQuery.ICollectionSelector): google.firestore.v1beta1.StructuredQuery.CollectionSelector; + + /** + * Encodes the specified CollectionSelector message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.CollectionSelector.verify|verify} messages. + * @param message CollectionSelector message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.StructuredQuery.ICollectionSelector, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CollectionSelector message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.CollectionSelector.verify|verify} messages. + * @param message CollectionSelector message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.StructuredQuery.ICollectionSelector, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CollectionSelector message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CollectionSelector + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.StructuredQuery.CollectionSelector; + + /** + * Decodes a CollectionSelector message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CollectionSelector + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.StructuredQuery.CollectionSelector; + + /** + * Verifies a CollectionSelector message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CollectionSelector message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CollectionSelector + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.StructuredQuery.CollectionSelector; + + /** + * Creates a plain object from a CollectionSelector message. Also converts values to other types if specified. + * @param message CollectionSelector + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.StructuredQuery.CollectionSelector, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CollectionSelector to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CollectionSelector + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Filter. */ + interface IFilter { + + /** Filter compositeFilter */ + compositeFilter?: (google.firestore.v1beta1.StructuredQuery.ICompositeFilter|null); + + /** Filter fieldFilter */ + fieldFilter?: (google.firestore.v1beta1.StructuredQuery.IFieldFilter|null); + + /** Filter unaryFilter */ + unaryFilter?: (google.firestore.v1beta1.StructuredQuery.IUnaryFilter|null); + } + + /** Represents a Filter. */ + class Filter implements IFilter { + + /** + * Constructs a new Filter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.StructuredQuery.IFilter); + + /** Filter compositeFilter. */ + public compositeFilter?: (google.firestore.v1beta1.StructuredQuery.ICompositeFilter|null); + + /** Filter fieldFilter. */ + public fieldFilter?: (google.firestore.v1beta1.StructuredQuery.IFieldFilter|null); + + /** Filter unaryFilter. */ + public unaryFilter?: (google.firestore.v1beta1.StructuredQuery.IUnaryFilter|null); + + /** Filter filterType. */ + public filterType?: ("compositeFilter"|"fieldFilter"|"unaryFilter"); + + /** + * Creates a new Filter instance using the specified properties. + * @param [properties] Properties to set + * @returns Filter instance + */ + public static create(properties?: google.firestore.v1beta1.StructuredQuery.IFilter): google.firestore.v1beta1.StructuredQuery.Filter; + + /** + * Encodes the specified Filter message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Filter.verify|verify} messages. + * @param message Filter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.StructuredQuery.IFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Filter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Filter.verify|verify} messages. + * @param message Filter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.StructuredQuery.IFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Filter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.StructuredQuery.Filter; + + /** + * Decodes a Filter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.StructuredQuery.Filter; + + /** + * Verifies a Filter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Filter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Filter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.StructuredQuery.Filter; + + /** + * Creates a plain object from a Filter message. Also converts values to other types if specified. + * @param message Filter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.StructuredQuery.Filter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Filter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Filter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CompositeFilter. */ + interface ICompositeFilter { + + /** CompositeFilter op */ + op?: (google.firestore.v1beta1.StructuredQuery.CompositeFilter.Operator|keyof typeof google.firestore.v1beta1.StructuredQuery.CompositeFilter.Operator|null); + + /** CompositeFilter filters */ + filters?: (google.firestore.v1beta1.StructuredQuery.IFilter[]|null); + } + + /** Represents a CompositeFilter. */ + class CompositeFilter implements ICompositeFilter { + + /** + * Constructs a new CompositeFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.StructuredQuery.ICompositeFilter); + + /** CompositeFilter op. */ + public op: (google.firestore.v1beta1.StructuredQuery.CompositeFilter.Operator|keyof typeof google.firestore.v1beta1.StructuredQuery.CompositeFilter.Operator); + + /** CompositeFilter filters. */ + public filters: google.firestore.v1beta1.StructuredQuery.IFilter[]; + + /** + * Creates a new CompositeFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns CompositeFilter instance + */ + public static create(properties?: google.firestore.v1beta1.StructuredQuery.ICompositeFilter): google.firestore.v1beta1.StructuredQuery.CompositeFilter; + + /** + * Encodes the specified CompositeFilter message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.CompositeFilter.verify|verify} messages. + * @param message CompositeFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.StructuredQuery.ICompositeFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompositeFilter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.CompositeFilter.verify|verify} messages. + * @param message CompositeFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.StructuredQuery.ICompositeFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompositeFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompositeFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.StructuredQuery.CompositeFilter; + + /** + * Decodes a CompositeFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompositeFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.StructuredQuery.CompositeFilter; + + /** + * Verifies a CompositeFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompositeFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompositeFilter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.StructuredQuery.CompositeFilter; + + /** + * Creates a plain object from a CompositeFilter message. Also converts values to other types if specified. + * @param message CompositeFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.StructuredQuery.CompositeFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompositeFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompositeFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CompositeFilter { + + /** Operator enum. */ + enum Operator { + OPERATOR_UNSPECIFIED = 0, + AND = 1 + } + } + + /** Properties of a FieldFilter. */ + interface IFieldFilter { + + /** FieldFilter field */ + field?: (google.firestore.v1beta1.StructuredQuery.IFieldReference|null); + + /** FieldFilter op */ + op?: (google.firestore.v1beta1.StructuredQuery.FieldFilter.Operator|keyof typeof google.firestore.v1beta1.StructuredQuery.FieldFilter.Operator|null); + + /** FieldFilter value */ + value?: (google.firestore.v1beta1.IValue|null); + } + + /** Represents a FieldFilter. */ + class FieldFilter implements IFieldFilter { + + /** + * Constructs a new FieldFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.StructuredQuery.IFieldFilter); + + /** FieldFilter field. */ + public field?: (google.firestore.v1beta1.StructuredQuery.IFieldReference|null); + + /** FieldFilter op. */ + public op: (google.firestore.v1beta1.StructuredQuery.FieldFilter.Operator|keyof typeof google.firestore.v1beta1.StructuredQuery.FieldFilter.Operator); + + /** FieldFilter value. */ + public value?: (google.firestore.v1beta1.IValue|null); + + /** + * Creates a new FieldFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldFilter instance + */ + public static create(properties?: google.firestore.v1beta1.StructuredQuery.IFieldFilter): google.firestore.v1beta1.StructuredQuery.FieldFilter; + + /** + * Encodes the specified FieldFilter message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.FieldFilter.verify|verify} messages. + * @param message FieldFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.StructuredQuery.IFieldFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldFilter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.FieldFilter.verify|verify} messages. + * @param message FieldFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.StructuredQuery.IFieldFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.StructuredQuery.FieldFilter; + + /** + * Decodes a FieldFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.StructuredQuery.FieldFilter; + + /** + * Verifies a FieldFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldFilter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.StructuredQuery.FieldFilter; + + /** + * Creates a plain object from a FieldFilter message. Also converts values to other types if specified. + * @param message FieldFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.StructuredQuery.FieldFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldFilter { + + /** Operator enum. */ + enum Operator { + OPERATOR_UNSPECIFIED = 0, + LESS_THAN = 1, + LESS_THAN_OR_EQUAL = 2, + GREATER_THAN = 3, + GREATER_THAN_OR_EQUAL = 4, + EQUAL = 5, + NOT_EQUAL = 6, + ARRAY_CONTAINS = 7, + IN = 8, + ARRAY_CONTAINS_ANY = 9, + NOT_IN = 10 + } + } + + /** Properties of an UnaryFilter. */ + interface IUnaryFilter { + + /** UnaryFilter op */ + op?: (google.firestore.v1beta1.StructuredQuery.UnaryFilter.Operator|keyof typeof google.firestore.v1beta1.StructuredQuery.UnaryFilter.Operator|null); + + /** UnaryFilter field */ + field?: (google.firestore.v1beta1.StructuredQuery.IFieldReference|null); + } + + /** Represents an UnaryFilter. */ + class UnaryFilter implements IUnaryFilter { + + /** + * Constructs a new UnaryFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.StructuredQuery.IUnaryFilter); + + /** UnaryFilter op. */ + public op: (google.firestore.v1beta1.StructuredQuery.UnaryFilter.Operator|keyof typeof google.firestore.v1beta1.StructuredQuery.UnaryFilter.Operator); + + /** UnaryFilter field. */ + public field?: (google.firestore.v1beta1.StructuredQuery.IFieldReference|null); + + /** UnaryFilter operandType. */ + public operandType?: "field"; + + /** + * Creates a new UnaryFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns UnaryFilter instance + */ + public static create(properties?: google.firestore.v1beta1.StructuredQuery.IUnaryFilter): google.firestore.v1beta1.StructuredQuery.UnaryFilter; + + /** + * Encodes the specified UnaryFilter message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.UnaryFilter.verify|verify} messages. + * @param message UnaryFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.StructuredQuery.IUnaryFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UnaryFilter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.UnaryFilter.verify|verify} messages. + * @param message UnaryFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.StructuredQuery.IUnaryFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UnaryFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UnaryFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.StructuredQuery.UnaryFilter; + + /** + * Decodes an UnaryFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UnaryFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.StructuredQuery.UnaryFilter; + + /** + * Verifies an UnaryFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UnaryFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UnaryFilter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.StructuredQuery.UnaryFilter; + + /** + * Creates a plain object from an UnaryFilter message. Also converts values to other types if specified. + * @param message UnaryFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.StructuredQuery.UnaryFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UnaryFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UnaryFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UnaryFilter { + + /** Operator enum. */ + enum Operator { + OPERATOR_UNSPECIFIED = 0, + IS_NAN = 2, + IS_NULL = 3, + IS_NOT_NAN = 4, + IS_NOT_NULL = 5 + } + } + + /** Properties of a FieldReference. */ + interface IFieldReference { + + /** FieldReference fieldPath */ + fieldPath?: (string|null); + } + + /** Represents a FieldReference. */ + class FieldReference implements IFieldReference { + + /** + * Constructs a new FieldReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.StructuredQuery.IFieldReference); + + /** FieldReference fieldPath. */ + public fieldPath: string; + + /** + * Creates a new FieldReference instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldReference instance + */ + public static create(properties?: google.firestore.v1beta1.StructuredQuery.IFieldReference): google.firestore.v1beta1.StructuredQuery.FieldReference; + + /** + * Encodes the specified FieldReference message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.FieldReference.verify|verify} messages. + * @param message FieldReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.StructuredQuery.IFieldReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldReference message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.FieldReference.verify|verify} messages. + * @param message FieldReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.StructuredQuery.IFieldReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.StructuredQuery.FieldReference; + + /** + * Decodes a FieldReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.StructuredQuery.FieldReference; + + /** + * Verifies a FieldReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldReference + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.StructuredQuery.FieldReference; + + /** + * Creates a plain object from a FieldReference message. Also converts values to other types if specified. + * @param message FieldReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.StructuredQuery.FieldReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Order. */ + interface IOrder { + + /** Order field */ + field?: (google.firestore.v1beta1.StructuredQuery.IFieldReference|null); + + /** Order direction */ + direction?: (google.firestore.v1beta1.StructuredQuery.Direction|keyof typeof google.firestore.v1beta1.StructuredQuery.Direction|null); + } + + /** Represents an Order. */ + class Order implements IOrder { + + /** + * Constructs a new Order. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.StructuredQuery.IOrder); + + /** Order field. */ + public field?: (google.firestore.v1beta1.StructuredQuery.IFieldReference|null); + + /** Order direction. */ + public direction: (google.firestore.v1beta1.StructuredQuery.Direction|keyof typeof google.firestore.v1beta1.StructuredQuery.Direction); + + /** + * Creates a new Order instance using the specified properties. + * @param [properties] Properties to set + * @returns Order instance + */ + public static create(properties?: google.firestore.v1beta1.StructuredQuery.IOrder): google.firestore.v1beta1.StructuredQuery.Order; + + /** + * Encodes the specified Order message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Order.verify|verify} messages. + * @param message Order message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.StructuredQuery.IOrder, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Order message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Order.verify|verify} messages. + * @param message Order message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.StructuredQuery.IOrder, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Order message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Order + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.StructuredQuery.Order; + + /** + * Decodes an Order message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Order + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.StructuredQuery.Order; + + /** + * Verifies an Order message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Order message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Order + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.StructuredQuery.Order; + + /** + * Creates a plain object from an Order message. Also converts values to other types if specified. + * @param message Order + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.StructuredQuery.Order, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Order to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Order + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Projection. */ + interface IProjection { + + /** Projection fields */ + fields?: (google.firestore.v1beta1.StructuredQuery.IFieldReference[]|null); + } + + /** Represents a Projection. */ + class Projection implements IProjection { + + /** + * Constructs a new Projection. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.StructuredQuery.IProjection); + + /** Projection fields. */ + public fields: google.firestore.v1beta1.StructuredQuery.IFieldReference[]; + + /** + * Creates a new Projection instance using the specified properties. + * @param [properties] Properties to set + * @returns Projection instance + */ + public static create(properties?: google.firestore.v1beta1.StructuredQuery.IProjection): google.firestore.v1beta1.StructuredQuery.Projection; + + /** + * Encodes the specified Projection message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Projection.verify|verify} messages. + * @param message Projection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.StructuredQuery.IProjection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Projection message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Projection.verify|verify} messages. + * @param message Projection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.StructuredQuery.IProjection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Projection message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Projection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.StructuredQuery.Projection; + + /** + * Decodes a Projection message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Projection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.StructuredQuery.Projection; + + /** + * Verifies a Projection message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Projection message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Projection + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.StructuredQuery.Projection; + + /** + * Creates a plain object from a Projection message. Also converts values to other types if specified. + * @param message Projection + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.StructuredQuery.Projection, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Projection to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Projection + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Direction enum. */ + enum Direction { + DIRECTION_UNSPECIFIED = 0, + ASCENDING = 1, + DESCENDING = 2 + } + } + + /** Properties of a Cursor. */ + interface ICursor { + + /** Cursor values */ + values?: (google.firestore.v1beta1.IValue[]|null); + + /** Cursor before */ + before?: (boolean|null); + } + + /** Represents a Cursor. */ + class Cursor implements ICursor { + + /** + * Constructs a new Cursor. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.ICursor); + + /** Cursor values. */ + public values: google.firestore.v1beta1.IValue[]; + + /** Cursor before. */ + public before: boolean; + + /** + * Creates a new Cursor instance using the specified properties. + * @param [properties] Properties to set + * @returns Cursor instance + */ + public static create(properties?: google.firestore.v1beta1.ICursor): google.firestore.v1beta1.Cursor; + + /** + * Encodes the specified Cursor message. Does not implicitly {@link google.firestore.v1beta1.Cursor.verify|verify} messages. + * @param message Cursor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.ICursor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Cursor message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Cursor.verify|verify} messages. + * @param message Cursor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.ICursor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Cursor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Cursor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.Cursor; + + /** + * Decodes a Cursor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Cursor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.Cursor; + + /** + * Verifies a Cursor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Cursor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Cursor + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.Cursor; + + /** + * Creates a plain object from a Cursor message. Also converts values to other types if specified. + * @param message Cursor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.Cursor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Cursor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Cursor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Write. */ + interface IWrite { + + /** Write update */ + update?: (google.firestore.v1beta1.IDocument|null); + + /** Write delete */ + "delete"?: (string|null); + + /** Write transform */ + transform?: (google.firestore.v1beta1.IDocumentTransform|null); + + /** Write updateMask */ + updateMask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** Write updateTransforms */ + updateTransforms?: (google.firestore.v1beta1.DocumentTransform.IFieldTransform[]|null); + + /** Write currentDocument */ + currentDocument?: (google.firestore.v1beta1.IPrecondition|null); + } + + /** Represents a Write. */ + class Write implements IWrite { + + /** + * Constructs a new Write. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IWrite); + + /** Write update. */ + public update?: (google.firestore.v1beta1.IDocument|null); + + /** Write delete. */ + public delete?: (string|null); + + /** Write transform. */ + public transform?: (google.firestore.v1beta1.IDocumentTransform|null); + + /** Write updateMask. */ + public updateMask?: (google.firestore.v1beta1.IDocumentMask|null); + + /** Write updateTransforms. */ + public updateTransforms: google.firestore.v1beta1.DocumentTransform.IFieldTransform[]; + + /** Write currentDocument. */ + public currentDocument?: (google.firestore.v1beta1.IPrecondition|null); + + /** Write operation. */ + public operation?: ("update"|"delete"|"transform"); + + /** + * Creates a new Write instance using the specified properties. + * @param [properties] Properties to set + * @returns Write instance + */ + public static create(properties?: google.firestore.v1beta1.IWrite): google.firestore.v1beta1.Write; + + /** + * Encodes the specified Write message. Does not implicitly {@link google.firestore.v1beta1.Write.verify|verify} messages. + * @param message Write message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IWrite, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Write message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Write.verify|verify} messages. + * @param message Write message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IWrite, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Write message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Write + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.Write; + + /** + * Decodes a Write message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Write + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.Write; + + /** + * Verifies a Write message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Write message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Write + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.Write; + + /** + * Creates a plain object from a Write message. Also converts values to other types if specified. + * @param message Write + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.Write, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Write to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Write + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentTransform. */ + interface IDocumentTransform { + + /** DocumentTransform document */ + document?: (string|null); + + /** DocumentTransform fieldTransforms */ + fieldTransforms?: (google.firestore.v1beta1.DocumentTransform.IFieldTransform[]|null); + } + + /** Represents a DocumentTransform. */ + class DocumentTransform implements IDocumentTransform { + + /** + * Constructs a new DocumentTransform. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IDocumentTransform); + + /** DocumentTransform document. */ + public document: string; + + /** DocumentTransform fieldTransforms. */ + public fieldTransforms: google.firestore.v1beta1.DocumentTransform.IFieldTransform[]; + + /** + * Creates a new DocumentTransform instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentTransform instance + */ + public static create(properties?: google.firestore.v1beta1.IDocumentTransform): google.firestore.v1beta1.DocumentTransform; + + /** + * Encodes the specified DocumentTransform message. Does not implicitly {@link google.firestore.v1beta1.DocumentTransform.verify|verify} messages. + * @param message DocumentTransform message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IDocumentTransform, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentTransform message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentTransform.verify|verify} messages. + * @param message DocumentTransform message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IDocumentTransform, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentTransform message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.DocumentTransform; + + /** + * Decodes a DocumentTransform message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.DocumentTransform; + + /** + * Verifies a DocumentTransform message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentTransform message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentTransform + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.DocumentTransform; + + /** + * Creates a plain object from a DocumentTransform message. Also converts values to other types if specified. + * @param message DocumentTransform + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.DocumentTransform, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentTransform to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentTransform + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DocumentTransform { + + /** Properties of a FieldTransform. */ + interface IFieldTransform { + + /** FieldTransform fieldPath */ + fieldPath?: (string|null); + + /** FieldTransform setToServerValue */ + setToServerValue?: (google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue|keyof typeof google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue|null); + + /** FieldTransform increment */ + increment?: (google.firestore.v1beta1.IValue|null); + + /** FieldTransform maximum */ + maximum?: (google.firestore.v1beta1.IValue|null); + + /** FieldTransform minimum */ + minimum?: (google.firestore.v1beta1.IValue|null); + + /** FieldTransform appendMissingElements */ + appendMissingElements?: (google.firestore.v1beta1.IArrayValue|null); + + /** FieldTransform removeAllFromArray */ + removeAllFromArray?: (google.firestore.v1beta1.IArrayValue|null); + } + + /** Represents a FieldTransform. */ + class FieldTransform implements IFieldTransform { + + /** + * Constructs a new FieldTransform. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.DocumentTransform.IFieldTransform); + + /** FieldTransform fieldPath. */ + public fieldPath: string; + + /** FieldTransform setToServerValue. */ + public setToServerValue?: (google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue|keyof typeof google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue|null); + + /** FieldTransform increment. */ + public increment?: (google.firestore.v1beta1.IValue|null); + + /** FieldTransform maximum. */ + public maximum?: (google.firestore.v1beta1.IValue|null); + + /** FieldTransform minimum. */ + public minimum?: (google.firestore.v1beta1.IValue|null); + + /** FieldTransform appendMissingElements. */ + public appendMissingElements?: (google.firestore.v1beta1.IArrayValue|null); + + /** FieldTransform removeAllFromArray. */ + public removeAllFromArray?: (google.firestore.v1beta1.IArrayValue|null); + + /** FieldTransform transformType. */ + public transformType?: ("setToServerValue"|"increment"|"maximum"|"minimum"|"appendMissingElements"|"removeAllFromArray"); + + /** + * Creates a new FieldTransform instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldTransform instance + */ + public static create(properties?: google.firestore.v1beta1.DocumentTransform.IFieldTransform): google.firestore.v1beta1.DocumentTransform.FieldTransform; + + /** + * Encodes the specified FieldTransform message. Does not implicitly {@link google.firestore.v1beta1.DocumentTransform.FieldTransform.verify|verify} messages. + * @param message FieldTransform message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.DocumentTransform.IFieldTransform, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldTransform message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentTransform.FieldTransform.verify|verify} messages. + * @param message FieldTransform message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.DocumentTransform.IFieldTransform, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldTransform message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.DocumentTransform.FieldTransform; + + /** + * Decodes a FieldTransform message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.DocumentTransform.FieldTransform; + + /** + * Verifies a FieldTransform message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldTransform message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldTransform + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.DocumentTransform.FieldTransform; + + /** + * Creates a plain object from a FieldTransform message. Also converts values to other types if specified. + * @param message FieldTransform + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.DocumentTransform.FieldTransform, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldTransform to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldTransform + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldTransform { + + /** ServerValue enum. */ + enum ServerValue { + SERVER_VALUE_UNSPECIFIED = 0, + REQUEST_TIME = 1 + } + } + } + + /** Properties of a WriteResult. */ + interface IWriteResult { + + /** WriteResult updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** WriteResult transformResults */ + transformResults?: (google.firestore.v1beta1.IValue[]|null); + } + + /** Represents a WriteResult. */ + class WriteResult implements IWriteResult { + + /** + * Constructs a new WriteResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IWriteResult); + + /** WriteResult updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** WriteResult transformResults. */ + public transformResults: google.firestore.v1beta1.IValue[]; + + /** + * Creates a new WriteResult instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteResult instance + */ + public static create(properties?: google.firestore.v1beta1.IWriteResult): google.firestore.v1beta1.WriteResult; + + /** + * Encodes the specified WriteResult message. Does not implicitly {@link google.firestore.v1beta1.WriteResult.verify|verify} messages. + * @param message WriteResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IWriteResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteResult message, length delimited. Does not implicitly {@link google.firestore.v1beta1.WriteResult.verify|verify} messages. + * @param message WriteResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IWriteResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.WriteResult; + + /** + * Decodes a WriteResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.WriteResult; + + /** + * Verifies a WriteResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteResult + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.WriteResult; + + /** + * Creates a plain object from a WriteResult message. Also converts values to other types if specified. + * @param message WriteResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.WriteResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WriteResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentChange. */ + interface IDocumentChange { + + /** DocumentChange document */ + document?: (google.firestore.v1beta1.IDocument|null); + + /** DocumentChange targetIds */ + targetIds?: (number[]|null); + + /** DocumentChange removedTargetIds */ + removedTargetIds?: (number[]|null); + } + + /** Represents a DocumentChange. */ + class DocumentChange implements IDocumentChange { + + /** + * Constructs a new DocumentChange. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IDocumentChange); + + /** DocumentChange document. */ + public document?: (google.firestore.v1beta1.IDocument|null); + + /** DocumentChange targetIds. */ + public targetIds: number[]; + + /** DocumentChange removedTargetIds. */ + public removedTargetIds: number[]; + + /** + * Creates a new DocumentChange instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentChange instance + */ + public static create(properties?: google.firestore.v1beta1.IDocumentChange): google.firestore.v1beta1.DocumentChange; + + /** + * Encodes the specified DocumentChange message. Does not implicitly {@link google.firestore.v1beta1.DocumentChange.verify|verify} messages. + * @param message DocumentChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IDocumentChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentChange message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentChange.verify|verify} messages. + * @param message DocumentChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IDocumentChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentChange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.DocumentChange; + + /** + * Decodes a DocumentChange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.DocumentChange; + + /** + * Verifies a DocumentChange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentChange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentChange + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.DocumentChange; + + /** + * Creates a plain object from a DocumentChange message. Also converts values to other types if specified. + * @param message DocumentChange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.DocumentChange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentChange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentChange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentDelete. */ + interface IDocumentDelete { + + /** DocumentDelete document */ + document?: (string|null); + + /** DocumentDelete removedTargetIds */ + removedTargetIds?: (number[]|null); + + /** DocumentDelete readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DocumentDelete. */ + class DocumentDelete implements IDocumentDelete { + + /** + * Constructs a new DocumentDelete. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IDocumentDelete); + + /** DocumentDelete document. */ + public document: string; + + /** DocumentDelete removedTargetIds. */ + public removedTargetIds: number[]; + + /** DocumentDelete readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DocumentDelete instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentDelete instance + */ + public static create(properties?: google.firestore.v1beta1.IDocumentDelete): google.firestore.v1beta1.DocumentDelete; + + /** + * Encodes the specified DocumentDelete message. Does not implicitly {@link google.firestore.v1beta1.DocumentDelete.verify|verify} messages. + * @param message DocumentDelete message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IDocumentDelete, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentDelete message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentDelete.verify|verify} messages. + * @param message DocumentDelete message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IDocumentDelete, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentDelete message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentDelete + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.DocumentDelete; + + /** + * Decodes a DocumentDelete message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentDelete + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.DocumentDelete; + + /** + * Verifies a DocumentDelete message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentDelete message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentDelete + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.DocumentDelete; + + /** + * Creates a plain object from a DocumentDelete message. Also converts values to other types if specified. + * @param message DocumentDelete + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.DocumentDelete, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentDelete to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentDelete + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentRemove. */ + interface IDocumentRemove { + + /** DocumentRemove document */ + document?: (string|null); + + /** DocumentRemove removedTargetIds */ + removedTargetIds?: (number[]|null); + + /** DocumentRemove readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DocumentRemove. */ + class DocumentRemove implements IDocumentRemove { + + /** + * Constructs a new DocumentRemove. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IDocumentRemove); + + /** DocumentRemove document. */ + public document: string; + + /** DocumentRemove removedTargetIds. */ + public removedTargetIds: number[]; + + /** DocumentRemove readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DocumentRemove instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentRemove instance + */ + public static create(properties?: google.firestore.v1beta1.IDocumentRemove): google.firestore.v1beta1.DocumentRemove; + + /** + * Encodes the specified DocumentRemove message. Does not implicitly {@link google.firestore.v1beta1.DocumentRemove.verify|verify} messages. + * @param message DocumentRemove message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IDocumentRemove, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentRemove message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentRemove.verify|verify} messages. + * @param message DocumentRemove message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IDocumentRemove, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentRemove message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentRemove + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.DocumentRemove; + + /** + * Decodes a DocumentRemove message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentRemove + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.DocumentRemove; + + /** + * Verifies a DocumentRemove message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentRemove message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentRemove + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.DocumentRemove; + + /** + * Creates a plain object from a DocumentRemove message. Also converts values to other types if specified. + * @param message DocumentRemove + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.DocumentRemove, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentRemove to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentRemove + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExistenceFilter. */ + interface IExistenceFilter { + + /** ExistenceFilter targetId */ + targetId?: (number|null); + + /** ExistenceFilter count */ + count?: (number|null); + } + + /** Represents an ExistenceFilter. */ + class ExistenceFilter implements IExistenceFilter { + + /** + * Constructs a new ExistenceFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IExistenceFilter); + + /** ExistenceFilter targetId. */ + public targetId: number; + + /** ExistenceFilter count. */ + public count: number; + + /** + * Creates a new ExistenceFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns ExistenceFilter instance + */ + public static create(properties?: google.firestore.v1beta1.IExistenceFilter): google.firestore.v1beta1.ExistenceFilter; + + /** + * Encodes the specified ExistenceFilter message. Does not implicitly {@link google.firestore.v1beta1.ExistenceFilter.verify|verify} messages. + * @param message ExistenceFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IExistenceFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExistenceFilter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ExistenceFilter.verify|verify} messages. + * @param message ExistenceFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IExistenceFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExistenceFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExistenceFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.ExistenceFilter; + + /** + * Decodes an ExistenceFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExistenceFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.ExistenceFilter; + + /** + * Verifies an ExistenceFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExistenceFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExistenceFilter + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.ExistenceFilter; + + /** + * Creates a plain object from an ExistenceFilter message. Also converts values to other types if specified. + * @param message ExistenceFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.ExistenceFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExistenceFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExistenceFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UndeliverableFirstGenEvent. */ + interface IUndeliverableFirstGenEvent { + + /** UndeliverableFirstGenEvent message */ + message?: (string|null); + + /** UndeliverableFirstGenEvent reason */ + reason?: (google.firestore.v1beta1.UndeliverableFirstGenEvent.Reason|keyof typeof google.firestore.v1beta1.UndeliverableFirstGenEvent.Reason|null); + + /** UndeliverableFirstGenEvent documentName */ + documentName?: (string|null); + + /** UndeliverableFirstGenEvent documentChangeType */ + documentChangeType?: (google.firestore.v1beta1.UndeliverableFirstGenEvent.DocumentChangeType|keyof typeof google.firestore.v1beta1.UndeliverableFirstGenEvent.DocumentChangeType|null); + + /** UndeliverableFirstGenEvent functionName */ + functionName?: (string[]|null); + + /** UndeliverableFirstGenEvent triggeredTime */ + triggeredTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an UndeliverableFirstGenEvent. */ + class UndeliverableFirstGenEvent implements IUndeliverableFirstGenEvent { + + /** + * Constructs a new UndeliverableFirstGenEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.firestore.v1beta1.IUndeliverableFirstGenEvent); + + /** UndeliverableFirstGenEvent message. */ + public message: string; + + /** UndeliverableFirstGenEvent reason. */ + public reason: (google.firestore.v1beta1.UndeliverableFirstGenEvent.Reason|keyof typeof google.firestore.v1beta1.UndeliverableFirstGenEvent.Reason); + + /** UndeliverableFirstGenEvent documentName. */ + public documentName: string; + + /** UndeliverableFirstGenEvent documentChangeType. */ + public documentChangeType: (google.firestore.v1beta1.UndeliverableFirstGenEvent.DocumentChangeType|keyof typeof google.firestore.v1beta1.UndeliverableFirstGenEvent.DocumentChangeType); + + /** UndeliverableFirstGenEvent functionName. */ + public functionName: string[]; + + /** UndeliverableFirstGenEvent triggeredTime. */ + public triggeredTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new UndeliverableFirstGenEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeliverableFirstGenEvent instance + */ + public static create(properties?: google.firestore.v1beta1.IUndeliverableFirstGenEvent): google.firestore.v1beta1.UndeliverableFirstGenEvent; + + /** + * Encodes the specified UndeliverableFirstGenEvent message. Does not implicitly {@link google.firestore.v1beta1.UndeliverableFirstGenEvent.verify|verify} messages. + * @param message UndeliverableFirstGenEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.firestore.v1beta1.IUndeliverableFirstGenEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeliverableFirstGenEvent message, length delimited. Does not implicitly {@link google.firestore.v1beta1.UndeliverableFirstGenEvent.verify|verify} messages. + * @param message UndeliverableFirstGenEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.firestore.v1beta1.IUndeliverableFirstGenEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeliverableFirstGenEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeliverableFirstGenEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.firestore.v1beta1.UndeliverableFirstGenEvent; + + /** + * Decodes an UndeliverableFirstGenEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeliverableFirstGenEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.firestore.v1beta1.UndeliverableFirstGenEvent; + + /** + * Verifies an UndeliverableFirstGenEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UndeliverableFirstGenEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeliverableFirstGenEvent + */ + public static fromObject(object: { [k: string]: any }): google.firestore.v1beta1.UndeliverableFirstGenEvent; + + /** + * Creates a plain object from an UndeliverableFirstGenEvent message. Also converts values to other types if specified. + * @param message UndeliverableFirstGenEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.firestore.v1beta1.UndeliverableFirstGenEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeliverableFirstGenEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UndeliverableFirstGenEvent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UndeliverableFirstGenEvent { + + /** Reason enum. */ + enum Reason { + REASON_UNSPECIFIED = 0, + EXCEEDING_SIZE_LIMIT = 1 + } + + /** DocumentChangeType enum. */ + enum DocumentChangeType { + DOCUMENT_CHANGE_TYPE_UNSPECIFIED = 0, + CREATE = 1, + DELETE = 2, + UPDATE = 3 + } + } + } + } + + /** Namespace api. */ + namespace api { + + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5, + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7, + IDENTIFIER = 8 + } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Http. */ + interface IHttp { + + /** Http rules */ + rules?: (google.api.IHttpRule[]|null); + + /** Http fullyDecodeReservedExpansion */ + fullyDecodeReservedExpansion?: (boolean|null); + } + + /** Represents a Http. */ + class Http implements IHttp { + + /** + * Constructs a new Http. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttp); + + /** Http rules. */ + public rules: google.api.IHttpRule[]; + + /** Http fullyDecodeReservedExpansion. */ + public fullyDecodeReservedExpansion: boolean; + + /** + * Creates a new Http instance using the specified properties. + * @param [properties] Properties to set + * @returns Http instance + */ + public static create(properties?: google.api.IHttp): google.api.Http; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Http message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; + + /** + * Verifies a Http message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Http + */ + public static fromObject(object: { [k: string]: any }): google.api.Http; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @param message Http + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Http to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Http + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a HttpRule. */ + interface IHttpRule { + + /** HttpRule selector */ + selector?: (string|null); + + /** HttpRule get */ + get?: (string|null); + + /** HttpRule put */ + put?: (string|null); + + /** HttpRule post */ + post?: (string|null); + + /** HttpRule delete */ + "delete"?: (string|null); + + /** HttpRule patch */ + patch?: (string|null); + + /** HttpRule custom */ + custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body */ + body?: (string|null); + + /** HttpRule responseBody */ + responseBody?: (string|null); + + /** HttpRule additionalBindings */ + additionalBindings?: (google.api.IHttpRule[]|null); + } + + /** Represents a HttpRule. */ + class HttpRule implements IHttpRule { + + /** + * Constructs a new HttpRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttpRule); + + /** HttpRule selector. */ + public selector: string; + + /** HttpRule get. */ + public get?: (string|null); + + /** HttpRule put. */ + public put?: (string|null); + + /** HttpRule post. */ + public post?: (string|null); + + /** HttpRule delete. */ + public delete?: (string|null); + + /** HttpRule patch. */ + public patch?: (string|null); + + /** HttpRule custom. */ + public custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body. */ + public body: string; + + /** HttpRule responseBody. */ + public responseBody: string; + + /** HttpRule additionalBindings. */ + public additionalBindings: google.api.IHttpRule[]; + + /** HttpRule pattern. */ + public pattern?: ("get"|"put"|"post"|"delete"|"patch"|"custom"); + + /** + * Creates a new HttpRule instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpRule instance + */ + public static create(properties?: google.api.IHttpRule): google.api.HttpRule; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpRule; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpRule; + + /** + * Verifies a HttpRule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpRule + */ + public static fromObject(object: { [k: string]: any }): google.api.HttpRule; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @param message HttpRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpRule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CustomHttpPattern. */ + interface ICustomHttpPattern { + + /** CustomHttpPattern kind */ + kind?: (string|null); + + /** CustomHttpPattern path */ + path?: (string|null); + } + + /** Represents a CustomHttpPattern. */ + class CustomHttpPattern implements ICustomHttpPattern { + + /** + * Constructs a new CustomHttpPattern. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICustomHttpPattern); + + /** CustomHttpPattern kind. */ + public kind: string; + + /** CustomHttpPattern path. */ + public path: string; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomHttpPattern instance + */ + public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CustomHttpPattern; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CustomHttpPattern; + + /** + * Verifies a CustomHttpPattern message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomHttpPattern + */ + public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @param message CustomHttpPattern + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomHttpPattern to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomHttpPattern + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CommonLanguageSettings. */ + interface ICommonLanguageSettings { + + /** CommonLanguageSettings referenceDocsUri */ + referenceDocsUri?: (string|null); + + /** CommonLanguageSettings destinations */ + destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + } + + /** Represents a CommonLanguageSettings. */ + class CommonLanguageSettings implements ICommonLanguageSettings { + + /** + * Constructs a new CommonLanguageSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICommonLanguageSettings); + + /** CommonLanguageSettings referenceDocsUri. */ + public referenceDocsUri: string; + + /** CommonLanguageSettings destinations. */ + public destinations: google.api.ClientLibraryDestination[]; + + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + + /** + * Creates a new CommonLanguageSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns CommonLanguageSettings instance + */ + public static create(properties?: google.api.ICommonLanguageSettings): google.api.CommonLanguageSettings; + + /** + * Encodes the specified CommonLanguageSettings message. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @param message CommonLanguageSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICommonLanguageSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CommonLanguageSettings message, length delimited. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @param message CommonLanguageSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICommonLanguageSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CommonLanguageSettings; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CommonLanguageSettings; + + /** + * Verifies a CommonLanguageSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CommonLanguageSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CommonLanguageSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.CommonLanguageSettings; + + /** + * Creates a plain object from a CommonLanguageSettings message. Also converts values to other types if specified. + * @param message CommonLanguageSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CommonLanguageSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CommonLanguageSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CommonLanguageSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ClientLibrarySettings. */ + interface IClientLibrarySettings { + + /** ClientLibrarySettings version */ + version?: (string|null); + + /** ClientLibrarySettings launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); + + /** ClientLibrarySettings restNumericEnums */ + restNumericEnums?: (boolean|null); + + /** ClientLibrarySettings javaSettings */ + javaSettings?: (google.api.IJavaSettings|null); + + /** ClientLibrarySettings cppSettings */ + cppSettings?: (google.api.ICppSettings|null); + + /** ClientLibrarySettings phpSettings */ + phpSettings?: (google.api.IPhpSettings|null); + + /** ClientLibrarySettings pythonSettings */ + pythonSettings?: (google.api.IPythonSettings|null); + + /** ClientLibrarySettings nodeSettings */ + nodeSettings?: (google.api.INodeSettings|null); + + /** ClientLibrarySettings dotnetSettings */ + dotnetSettings?: (google.api.IDotnetSettings|null); + + /** ClientLibrarySettings rubySettings */ + rubySettings?: (google.api.IRubySettings|null); + + /** ClientLibrarySettings goSettings */ + goSettings?: (google.api.IGoSettings|null); + } + + /** Represents a ClientLibrarySettings. */ + class ClientLibrarySettings implements IClientLibrarySettings { + + /** + * Constructs a new ClientLibrarySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IClientLibrarySettings); + + /** ClientLibrarySettings version. */ + public version: string; + + /** ClientLibrarySettings launchStage. */ + public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); + + /** ClientLibrarySettings restNumericEnums. */ + public restNumericEnums: boolean; + + /** ClientLibrarySettings javaSettings. */ + public javaSettings?: (google.api.IJavaSettings|null); + + /** ClientLibrarySettings cppSettings. */ + public cppSettings?: (google.api.ICppSettings|null); + + /** ClientLibrarySettings phpSettings. */ + public phpSettings?: (google.api.IPhpSettings|null); + + /** ClientLibrarySettings pythonSettings. */ + public pythonSettings?: (google.api.IPythonSettings|null); + + /** ClientLibrarySettings nodeSettings. */ + public nodeSettings?: (google.api.INodeSettings|null); + + /** ClientLibrarySettings dotnetSettings. */ + public dotnetSettings?: (google.api.IDotnetSettings|null); + + /** ClientLibrarySettings rubySettings. */ + public rubySettings?: (google.api.IRubySettings|null); + + /** ClientLibrarySettings goSettings. */ + public goSettings?: (google.api.IGoSettings|null); + + /** + * Creates a new ClientLibrarySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns ClientLibrarySettings instance + */ + public static create(properties?: google.api.IClientLibrarySettings): google.api.ClientLibrarySettings; + + /** + * Encodes the specified ClientLibrarySettings message. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @param message ClientLibrarySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IClientLibrarySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClientLibrarySettings message, length delimited. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @param message ClientLibrarySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IClientLibrarySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ClientLibrarySettings; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ClientLibrarySettings; + + /** + * Verifies a ClientLibrarySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClientLibrarySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClientLibrarySettings + */ + public static fromObject(object: { [k: string]: any }): google.api.ClientLibrarySettings; + + /** + * Creates a plain object from a ClientLibrarySettings message. Also converts values to other types if specified. + * @param message ClientLibrarySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ClientLibrarySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClientLibrarySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ClientLibrarySettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Publishing. */ + interface IPublishing { + + /** Publishing methodSettings */ + methodSettings?: (google.api.IMethodSettings[]|null); + + /** Publishing newIssueUri */ + newIssueUri?: (string|null); + + /** Publishing documentationUri */ + documentationUri?: (string|null); + + /** Publishing apiShortName */ + apiShortName?: (string|null); + + /** Publishing githubLabel */ + githubLabel?: (string|null); + + /** Publishing codeownerGithubTeams */ + codeownerGithubTeams?: (string[]|null); + + /** Publishing docTagPrefix */ + docTagPrefix?: (string|null); + + /** Publishing organization */ + organization?: (google.api.ClientLibraryOrganization|keyof typeof google.api.ClientLibraryOrganization|null); + + /** Publishing librarySettings */ + librarySettings?: (google.api.IClientLibrarySettings[]|null); + + /** Publishing protoReferenceDocumentationUri */ + protoReferenceDocumentationUri?: (string|null); + + /** Publishing restReferenceDocumentationUri */ + restReferenceDocumentationUri?: (string|null); + } + + /** Represents a Publishing. */ + class Publishing implements IPublishing { + + /** + * Constructs a new Publishing. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IPublishing); + + /** Publishing methodSettings. */ + public methodSettings: google.api.IMethodSettings[]; + + /** Publishing newIssueUri. */ + public newIssueUri: string; + + /** Publishing documentationUri. */ + public documentationUri: string; + + /** Publishing apiShortName. */ + public apiShortName: string; + + /** Publishing githubLabel. */ + public githubLabel: string; + + /** Publishing codeownerGithubTeams. */ + public codeownerGithubTeams: string[]; + + /** Publishing docTagPrefix. */ + public docTagPrefix: string; + + /** Publishing organization. */ + public organization: (google.api.ClientLibraryOrganization|keyof typeof google.api.ClientLibraryOrganization); + + /** Publishing librarySettings. */ + public librarySettings: google.api.IClientLibrarySettings[]; + + /** Publishing protoReferenceDocumentationUri. */ + public protoReferenceDocumentationUri: string; + + /** Publishing restReferenceDocumentationUri. */ + public restReferenceDocumentationUri: string; + + /** + * Creates a new Publishing instance using the specified properties. + * @param [properties] Properties to set + * @returns Publishing instance + */ + public static create(properties?: google.api.IPublishing): google.api.Publishing; + + /** + * Encodes the specified Publishing message. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @param message Publishing message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IPublishing, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Publishing message, length delimited. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @param message Publishing message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IPublishing, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Publishing message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Publishing; + + /** + * Decodes a Publishing message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Publishing; + + /** + * Verifies a Publishing message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Publishing message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Publishing + */ + public static fromObject(object: { [k: string]: any }): google.api.Publishing; + + /** + * Creates a plain object from a Publishing message. Also converts values to other types if specified. + * @param message Publishing + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Publishing, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Publishing to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Publishing + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a JavaSettings. */ + interface IJavaSettings { + + /** JavaSettings libraryPackage */ + libraryPackage?: (string|null); + + /** JavaSettings serviceClassNames */ + serviceClassNames?: ({ [k: string]: string }|null); + + /** JavaSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a JavaSettings. */ + class JavaSettings implements IJavaSettings { + + /** + * Constructs a new JavaSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IJavaSettings); + + /** JavaSettings libraryPackage. */ + public libraryPackage: string; + + /** JavaSettings serviceClassNames. */ + public serviceClassNames: { [k: string]: string }; + + /** JavaSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new JavaSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns JavaSettings instance + */ + public static create(properties?: google.api.IJavaSettings): google.api.JavaSettings; + + /** + * Encodes the specified JavaSettings message. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @param message JavaSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IJavaSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified JavaSettings message, length delimited. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @param message JavaSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IJavaSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a JavaSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.JavaSettings; + + /** + * Decodes a JavaSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.JavaSettings; + + /** + * Verifies a JavaSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a JavaSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns JavaSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.JavaSettings; + + /** + * Creates a plain object from a JavaSettings message. Also converts values to other types if specified. + * @param message JavaSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.JavaSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this JavaSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for JavaSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CppSettings. */ + interface ICppSettings { + + /** CppSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a CppSettings. */ + class CppSettings implements ICppSettings { + + /** + * Constructs a new CppSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICppSettings); + + /** CppSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new CppSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns CppSettings instance + */ + public static create(properties?: google.api.ICppSettings): google.api.CppSettings; + + /** + * Encodes the specified CppSettings message. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @param message CppSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICppSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CppSettings message, length delimited. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @param message CppSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICppSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CppSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CppSettings; + + /** + * Decodes a CppSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CppSettings; + + /** + * Verifies a CppSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CppSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CppSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.CppSettings; + + /** + * Creates a plain object from a CppSettings message. Also converts values to other types if specified. + * @param message CppSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CppSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CppSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CppSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PhpSettings. */ + interface IPhpSettings { + + /** PhpSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a PhpSettings. */ + class PhpSettings implements IPhpSettings { + + /** + * Constructs a new PhpSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IPhpSettings); + + /** PhpSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new PhpSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns PhpSettings instance + */ + public static create(properties?: google.api.IPhpSettings): google.api.PhpSettings; + + /** + * Encodes the specified PhpSettings message. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @param message PhpSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IPhpSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PhpSettings message, length delimited. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @param message PhpSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IPhpSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PhpSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PhpSettings; + + /** + * Decodes a PhpSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PhpSettings; + + /** + * Verifies a PhpSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PhpSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PhpSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.PhpSettings; + + /** + * Creates a plain object from a PhpSettings message. Also converts values to other types if specified. + * @param message PhpSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PhpSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PhpSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PhpSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PythonSettings. */ + interface IPythonSettings { + + /** PythonSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + } + + /** Represents a PythonSettings. */ + class PythonSettings implements IPythonSettings { + + /** + * Constructs a new PythonSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IPythonSettings); + + /** PythonSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + + /** + * Creates a new PythonSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns PythonSettings instance + */ + public static create(properties?: google.api.IPythonSettings): google.api.PythonSettings; + + /** + * Encodes the specified PythonSettings message. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @param message PythonSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IPythonSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PythonSettings message, length delimited. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @param message PythonSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IPythonSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PythonSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PythonSettings; + + /** + * Decodes a PythonSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PythonSettings; + + /** + * Verifies a PythonSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PythonSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PythonSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings; + + /** + * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. + * @param message PythonSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PythonSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PythonSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a NodeSettings. */ + interface INodeSettings { + + /** NodeSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a NodeSettings. */ + class NodeSettings implements INodeSettings { + + /** + * Constructs a new NodeSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.INodeSettings); + + /** NodeSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new NodeSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns NodeSettings instance + */ + public static create(properties?: google.api.INodeSettings): google.api.NodeSettings; + + /** + * Encodes the specified NodeSettings message. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @param message NodeSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.INodeSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NodeSettings message, length delimited. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @param message NodeSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.INodeSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NodeSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.NodeSettings; + + /** + * Decodes a NodeSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.NodeSettings; + + /** + * Verifies a NodeSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NodeSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NodeSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.NodeSettings; + + /** + * Creates a plain object from a NodeSettings message. Also converts values to other types if specified. + * @param message NodeSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.NodeSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NodeSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NodeSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DotnetSettings. */ + interface IDotnetSettings { + + /** DotnetSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + + /** DotnetSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); + + /** DotnetSettings renamedResources */ + renamedResources?: ({ [k: string]: string }|null); + + /** DotnetSettings ignoredResources */ + ignoredResources?: (string[]|null); + + /** DotnetSettings forcedNamespaceAliases */ + forcedNamespaceAliases?: (string[]|null); + + /** DotnetSettings handwrittenSignatures */ + handwrittenSignatures?: (string[]|null); + } + + /** Represents a DotnetSettings. */ + class DotnetSettings implements IDotnetSettings { + + /** + * Constructs a new DotnetSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IDotnetSettings); + + /** DotnetSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** DotnetSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + + /** DotnetSettings renamedResources. */ + public renamedResources: { [k: string]: string }; + + /** DotnetSettings ignoredResources. */ + public ignoredResources: string[]; + + /** DotnetSettings forcedNamespaceAliases. */ + public forcedNamespaceAliases: string[]; + + /** DotnetSettings handwrittenSignatures. */ + public handwrittenSignatures: string[]; + + /** + * Creates a new DotnetSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns DotnetSettings instance + */ + public static create(properties?: google.api.IDotnetSettings): google.api.DotnetSettings; + + /** + * Encodes the specified DotnetSettings message. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @param message DotnetSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IDotnetSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DotnetSettings message, length delimited. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @param message DotnetSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IDotnetSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.DotnetSettings; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.DotnetSettings; + + /** + * Verifies a DotnetSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DotnetSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DotnetSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.DotnetSettings; + + /** + * Creates a plain object from a DotnetSettings message. Also converts values to other types if specified. + * @param message DotnetSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.DotnetSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DotnetSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DotnetSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RubySettings. */ + interface IRubySettings { + + /** RubySettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a RubySettings. */ + class RubySettings implements IRubySettings { + + /** + * Constructs a new RubySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IRubySettings); + + /** RubySettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new RubySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns RubySettings instance + */ + public static create(properties?: google.api.IRubySettings): google.api.RubySettings; + + /** + * Encodes the specified RubySettings message. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @param message RubySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IRubySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RubySettings message, length delimited. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @param message RubySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IRubySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RubySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.RubySettings; + + /** + * Decodes a RubySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.RubySettings; + + /** + * Verifies a RubySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RubySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RubySettings + */ + public static fromObject(object: { [k: string]: any }): google.api.RubySettings; + + /** + * Creates a plain object from a RubySettings message. Also converts values to other types if specified. + * @param message RubySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.RubySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RubySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RubySettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GoSettings. */ + interface IGoSettings { + + /** GoSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); + } + + /** Represents a GoSettings. */ + class GoSettings implements IGoSettings { + + /** + * Constructs a new GoSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IGoSettings); + + /** GoSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + + /** + * Creates a new GoSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns GoSettings instance + */ + public static create(properties?: google.api.IGoSettings): google.api.GoSettings; + + /** + * Encodes the specified GoSettings message. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @param message GoSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IGoSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GoSettings message, length delimited. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @param message GoSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IGoSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GoSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.GoSettings; + + /** + * Decodes a GoSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.GoSettings; + + /** + * Verifies a GoSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GoSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GoSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.GoSettings; + + /** + * Creates a plain object from a GoSettings message. Also converts values to other types if specified. + * @param message GoSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.GoSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GoSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GoSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodSettings. */ + interface IMethodSettings { + + /** MethodSettings selector */ + selector?: (string|null); + + /** MethodSettings longRunning */ + longRunning?: (google.api.MethodSettings.ILongRunning|null); + + /** MethodSettings autoPopulatedFields */ + autoPopulatedFields?: (string[]|null); + } + + /** Represents a MethodSettings. */ + class MethodSettings implements IMethodSettings { + + /** + * Constructs a new MethodSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IMethodSettings); + + /** MethodSettings selector. */ + public selector: string; + + /** MethodSettings longRunning. */ + public longRunning?: (google.api.MethodSettings.ILongRunning|null); + + /** MethodSettings autoPopulatedFields. */ + public autoPopulatedFields: string[]; + + /** + * Creates a new MethodSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodSettings instance + */ + public static create(properties?: google.api.IMethodSettings): google.api.MethodSettings; + + /** + * Encodes the specified MethodSettings message. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @param message MethodSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IMethodSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodSettings message, length delimited. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @param message MethodSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IMethodSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.MethodSettings; + + /** + * Decodes a MethodSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.MethodSettings; + + /** + * Verifies a MethodSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.MethodSettings; + + /** + * Creates a plain object from a MethodSettings message. Also converts values to other types if specified. + * @param message MethodSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.MethodSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MethodSettings { + + /** Properties of a LongRunning. */ + interface ILongRunning { + + /** LongRunning initialPollDelay */ + initialPollDelay?: (google.protobuf.IDuration|null); + + /** LongRunning pollDelayMultiplier */ + pollDelayMultiplier?: (number|null); + + /** LongRunning maxPollDelay */ + maxPollDelay?: (google.protobuf.IDuration|null); + + /** LongRunning totalPollTimeout */ + totalPollTimeout?: (google.protobuf.IDuration|null); + } + + /** Represents a LongRunning. */ + class LongRunning implements ILongRunning { + + /** + * Constructs a new LongRunning. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.MethodSettings.ILongRunning); + + /** LongRunning initialPollDelay. */ + public initialPollDelay?: (google.protobuf.IDuration|null); + + /** LongRunning pollDelayMultiplier. */ + public pollDelayMultiplier: number; + + /** LongRunning maxPollDelay. */ + public maxPollDelay?: (google.protobuf.IDuration|null); + + /** LongRunning totalPollTimeout. */ + public totalPollTimeout?: (google.protobuf.IDuration|null); + + /** + * Creates a new LongRunning instance using the specified properties. + * @param [properties] Properties to set + * @returns LongRunning instance + */ + public static create(properties?: google.api.MethodSettings.ILongRunning): google.api.MethodSettings.LongRunning; + + /** + * Encodes the specified LongRunning message. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @param message LongRunning message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.MethodSettings.ILongRunning, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LongRunning message, length delimited. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @param message LongRunning message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.MethodSettings.ILongRunning, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LongRunning message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.MethodSettings.LongRunning; + + /** + * Decodes a LongRunning message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.MethodSettings.LongRunning; + + /** + * Verifies a LongRunning message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LongRunning message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LongRunning + */ + public static fromObject(object: { [k: string]: any }): google.api.MethodSettings.LongRunning; + + /** + * Creates a plain object from a LongRunning message. Also converts values to other types if specified. + * @param message LongRunning + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.MethodSettings.LongRunning, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LongRunning to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LongRunning + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** ClientLibraryOrganization enum. */ + enum ClientLibraryOrganization { + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0, + CLOUD = 1, + ADS = 2, + PHOTOS = 3, + STREET_VIEW = 4, + SHOPPING = 5, + GEO = 6, + GENERATIVE_AI = 7 + } + + /** ClientLibraryDestination enum. */ + enum ClientLibraryDestination { + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0, + GITHUB = 10, + PACKAGE_MANAGER = 20 + } + + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** LaunchStage enum. */ + enum LaunchStage { + LAUNCH_STAGE_UNSPECIFIED = 0, + UNIMPLEMENTED = 6, + PRELAUNCH = 7, + EARLY_ACCESS = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 5 + } + + /** Properties of a RoutingRule. */ + interface IRoutingRule { + + /** RoutingRule routingParameters */ + routingParameters?: (google.api.IRoutingParameter[]|null); + } + + /** Represents a RoutingRule. */ + class RoutingRule implements IRoutingRule { + + /** + * Constructs a new RoutingRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IRoutingRule); + + /** RoutingRule routingParameters. */ + public routingParameters: google.api.IRoutingParameter[]; + + /** + * Creates a new RoutingRule instance using the specified properties. + * @param [properties] Properties to set + * @returns RoutingRule instance + */ + public static create(properties?: google.api.IRoutingRule): google.api.RoutingRule; + + /** + * Encodes the specified RoutingRule message. Does not implicitly {@link google.api.RoutingRule.verify|verify} messages. + * @param message RoutingRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IRoutingRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RoutingRule message, length delimited. Does not implicitly {@link google.api.RoutingRule.verify|verify} messages. + * @param message RoutingRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IRoutingRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RoutingRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RoutingRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.RoutingRule; + + /** + * Decodes a RoutingRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RoutingRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.RoutingRule; + + /** + * Verifies a RoutingRule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RoutingRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RoutingRule + */ + public static fromObject(object: { [k: string]: any }): google.api.RoutingRule; + + /** + * Creates a plain object from a RoutingRule message. Also converts values to other types if specified. + * @param message RoutingRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.RoutingRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RoutingRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RoutingRule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RoutingParameter. */ + interface IRoutingParameter { + + /** RoutingParameter field */ + field?: (string|null); + + /** RoutingParameter pathTemplate */ + pathTemplate?: (string|null); + } + + /** Represents a RoutingParameter. */ + class RoutingParameter implements IRoutingParameter { + + /** + * Constructs a new RoutingParameter. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IRoutingParameter); + + /** RoutingParameter field. */ + public field: string; + + /** RoutingParameter pathTemplate. */ + public pathTemplate: string; + + /** + * Creates a new RoutingParameter instance using the specified properties. + * @param [properties] Properties to set + * @returns RoutingParameter instance + */ + public static create(properties?: google.api.IRoutingParameter): google.api.RoutingParameter; + + /** + * Encodes the specified RoutingParameter message. Does not implicitly {@link google.api.RoutingParameter.verify|verify} messages. + * @param message RoutingParameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IRoutingParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RoutingParameter message, length delimited. Does not implicitly {@link google.api.RoutingParameter.verify|verify} messages. + * @param message RoutingParameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IRoutingParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RoutingParameter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RoutingParameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.RoutingParameter; + + /** + * Decodes a RoutingParameter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RoutingParameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.RoutingParameter; + + /** + * Verifies a RoutingParameter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RoutingParameter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RoutingParameter + */ + public static fromObject(object: { [k: string]: any }): google.api.RoutingParameter; + + /** + * Creates a plain object from a RoutingParameter message. Also converts values to other types if specified. + * @param message RoutingParameter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.RoutingParameter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RoutingParameter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RoutingParameter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace protobuf. */ + namespace protobuf { + + /** Properties of a FileDescriptorSet. */ + interface IFileDescriptorSet { + + /** FileDescriptorSet file */ + file?: (google.protobuf.IFileDescriptorProto[]|null); + } + + /** Represents a FileDescriptorSet. */ + class FileDescriptorSet implements IFileDescriptorSet { + + /** + * Constructs a new FileDescriptorSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorSet); + + /** FileDescriptorSet file. */ + public file: google.protobuf.IFileDescriptorProto[]; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorSet instance + */ + public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; + + /** + * Verifies a FileDescriptorSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @param message FileDescriptorSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Edition enum. */ + enum Edition { + EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + EDITION_2023 = 1000, + EDITION_2024 = 1001, + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + EDITION_MAX = 2147483647 + } + + /** Properties of a FileDescriptorProto. */ + interface IFileDescriptorProto { + + /** FileDescriptorProto name */ + name?: (string|null); + + /** FileDescriptorProto package */ + "package"?: (string|null); + + /** FileDescriptorProto dependency */ + dependency?: (string[]|null); + + /** FileDescriptorProto publicDependency */ + publicDependency?: (number[]|null); + + /** FileDescriptorProto weakDependency */ + weakDependency?: (number[]|null); + + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + + /** FileDescriptorProto messageType */ + messageType?: (google.protobuf.IDescriptorProto[]|null); + + /** FileDescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** FileDescriptorProto service */ + service?: (google.protobuf.IServiceDescriptorProto[]|null); + + /** FileDescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** FileDescriptorProto options */ + options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo */ + sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax */ + syntax?: (string|null); + + /** FileDescriptorProto edition */ + edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FileDescriptorProto. */ + class FileDescriptorProto implements IFileDescriptorProto { + + /** + * Constructs a new FileDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorProto); + + /** FileDescriptorProto name. */ + public name: string; + + /** FileDescriptorProto package. */ + public package: string; + + /** FileDescriptorProto dependency. */ + public dependency: string[]; + + /** FileDescriptorProto publicDependency. */ + public publicDependency: number[]; + + /** FileDescriptorProto weakDependency. */ + public weakDependency: number[]; + + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + + /** FileDescriptorProto messageType. */ + public messageType: google.protobuf.IDescriptorProto[]; + + /** FileDescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** FileDescriptorProto service. */ + public service: google.protobuf.IServiceDescriptorProto[]; + + /** FileDescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** FileDescriptorProto options. */ + public options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo. */ + public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax. */ + public syntax: string; + + /** FileDescriptorProto edition. */ + public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; + + /** + * Verifies a FileDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @param message FileDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DescriptorProto. */ + interface IDescriptorProto { + + /** DescriptorProto name */ + name?: (string|null); + + /** DescriptorProto field */ + field?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto nestedType */ + nestedType?: (google.protobuf.IDescriptorProto[]|null); + + /** DescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** DescriptorProto extensionRange */ + extensionRange?: (google.protobuf.DescriptorProto.IExtensionRange[]|null); + + /** DescriptorProto oneofDecl */ + oneofDecl?: (google.protobuf.IOneofDescriptorProto[]|null); + + /** DescriptorProto options */ + options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange */ + reservedRange?: (google.protobuf.DescriptorProto.IReservedRange[]|null); + + /** DescriptorProto reservedName */ + reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); + } + + /** Represents a DescriptorProto. */ + class DescriptorProto implements IDescriptorProto { + + /** + * Constructs a new DescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDescriptorProto); + + /** DescriptorProto name. */ + public name: string; + + /** DescriptorProto field. */ + public field: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto nestedType. */ + public nestedType: google.protobuf.IDescriptorProto[]; + + /** DescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** DescriptorProto extensionRange. */ + public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; + + /** DescriptorProto oneofDecl. */ + public oneofDecl: google.protobuf.IOneofDescriptorProto[]; + + /** DescriptorProto options. */ + public options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange. */ + public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; + + /** DescriptorProto reservedName. */ + public reservedName: string[]; + + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns DescriptorProto instance + */ + public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; + + /** + * Verifies a DescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @param message DescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DescriptorProto { + + /** Properties of an ExtensionRange. */ + interface IExtensionRange { + + /** ExtensionRange start */ + start?: (number|null); + + /** ExtensionRange end */ + end?: (number|null); + + /** ExtensionRange options */ + options?: (google.protobuf.IExtensionRangeOptions|null); + } + + /** Represents an ExtensionRange. */ + class ExtensionRange implements IExtensionRange { + + /** + * Constructs a new ExtensionRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); + + /** ExtensionRange start. */ + public start: number; + + /** ExtensionRange end. */ + public end: number; + + /** ExtensionRange options. */ + public options?: (google.protobuf.IExtensionRangeOptions|null); + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Verifies an ExtensionRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @param message ExtensionRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReservedRange. */ + interface IReservedRange { + + /** ReservedRange start */ + start?: (number|null); + + /** ReservedRange end */ + end?: (number|null); + } + + /** Represents a ReservedRange. */ + class ReservedRange implements IReservedRange { + + /** + * Constructs a new ReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); + + /** ReservedRange start. */ + public start: number; + + /** ReservedRange end. */ + public end: number; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ReservedRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Verifies a ReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @param message ReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an ExtensionRangeOptions. */ + interface IExtensionRangeOptions { + + /** ExtensionRangeOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** ExtensionRangeOptions declaration */ + declaration?: (google.protobuf.ExtensionRangeOptions.IDeclaration[]|null); + + /** ExtensionRangeOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** ExtensionRangeOptions verification */ + verification?: (google.protobuf.ExtensionRangeOptions.VerificationState|keyof typeof google.protobuf.ExtensionRangeOptions.VerificationState|null); + } + + /** Represents an ExtensionRangeOptions. */ + class ExtensionRangeOptions implements IExtensionRangeOptions { + + /** + * Constructs a new ExtensionRangeOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IExtensionRangeOptions); + + /** ExtensionRangeOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** ExtensionRangeOptions declaration. */ + public declaration: google.protobuf.ExtensionRangeOptions.IDeclaration[]; + + /** ExtensionRangeOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** ExtensionRangeOptions verification. */ + public verification: (google.protobuf.ExtensionRangeOptions.VerificationState|keyof typeof google.protobuf.ExtensionRangeOptions.VerificationState); + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRangeOptions instance + */ + public static create(properties?: google.protobuf.IExtensionRangeOptions): google.protobuf.ExtensionRangeOptions; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions; + + /** + * Verifies an ExtensionRangeOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRangeOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @param message ExtensionRangeOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ExtensionRangeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ExtensionRangeOptions { + + /** Properties of a Declaration. */ + interface IDeclaration { + + /** Declaration number */ + number?: (number|null); + + /** Declaration fullName */ + fullName?: (string|null); + + /** Declaration type */ + type?: (string|null); + + /** Declaration reserved */ + reserved?: (boolean|null); + + /** Declaration repeated */ + repeated?: (boolean|null); + } + + /** Represents a Declaration. */ + class Declaration implements IDeclaration { + + /** + * Constructs a new Declaration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ExtensionRangeOptions.IDeclaration); + + /** Declaration number. */ + public number: number; + + /** Declaration fullName. */ + public fullName: string; + + /** Declaration type. */ + public type: string; + + /** Declaration reserved. */ + public reserved: boolean; + + /** Declaration repeated. */ + public repeated: boolean; + + /** + * Creates a new Declaration instance using the specified properties. + * @param [properties] Properties to set + * @returns Declaration instance + */ + public static create(properties?: google.protobuf.ExtensionRangeOptions.IDeclaration): google.protobuf.ExtensionRangeOptions.Declaration; + + /** + * Encodes the specified Declaration message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @param message Declaration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ExtensionRangeOptions.IDeclaration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Declaration message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @param message Declaration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ExtensionRangeOptions.IDeclaration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Declaration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions.Declaration; + + /** + * Decodes a Declaration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions.Declaration; + + /** + * Verifies a Declaration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Declaration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Declaration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions.Declaration; + + /** + * Creates a plain object from a Declaration message. Also converts values to other types if specified. + * @param message Declaration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ExtensionRangeOptions.Declaration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Declaration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Declaration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** VerificationState enum. */ + enum VerificationState { + DECLARATION = 0, + UNVERIFIED = 1 + } + } + + /** Properties of a FieldDescriptorProto. */ + interface IFieldDescriptorProto { + + /** FieldDescriptorProto name */ + name?: (string|null); + + /** FieldDescriptorProto number */ + number?: (number|null); + + /** FieldDescriptorProto label */ + label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); + + /** FieldDescriptorProto type */ + type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); + + /** FieldDescriptorProto typeName */ + typeName?: (string|null); + + /** FieldDescriptorProto extendee */ + extendee?: (string|null); + + /** FieldDescriptorProto defaultValue */ + defaultValue?: (string|null); + + /** FieldDescriptorProto oneofIndex */ + oneofIndex?: (number|null); + + /** FieldDescriptorProto jsonName */ + jsonName?: (string|null); + + /** FieldDescriptorProto options */ + options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional */ + proto3Optional?: (boolean|null); + } + + /** Represents a FieldDescriptorProto. */ + class FieldDescriptorProto implements IFieldDescriptorProto { + + /** + * Constructs a new FieldDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldDescriptorProto); + + /** FieldDescriptorProto name. */ + public name: string; + + /** FieldDescriptorProto number. */ + public number: number; + + /** FieldDescriptorProto label. */ + public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); + + /** FieldDescriptorProto type. */ + public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); + + /** FieldDescriptorProto typeName. */ + public typeName: string; + + /** FieldDescriptorProto extendee. */ + public extendee: string; + + /** FieldDescriptorProto defaultValue. */ + public defaultValue: string; + + /** FieldDescriptorProto oneofIndex. */ + public oneofIndex: number; + + /** FieldDescriptorProto jsonName. */ + public jsonName: string; + + /** FieldDescriptorProto options. */ + public options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional. */ + public proto3Optional: boolean; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + + /** + * Verifies a FieldDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @param message FieldDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldDescriptorProto { + + /** Type enum. */ + enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18 + } + + /** Label enum. */ + enum Label { + LABEL_OPTIONAL = 1, + LABEL_REPEATED = 3, + LABEL_REQUIRED = 2 + } + } + + /** Properties of an OneofDescriptorProto. */ + interface IOneofDescriptorProto { + + /** OneofDescriptorProto name */ + name?: (string|null); + + /** OneofDescriptorProto options */ + options?: (google.protobuf.IOneofOptions|null); + } + + /** Represents an OneofDescriptorProto. */ + class OneofDescriptorProto implements IOneofDescriptorProto { + + /** + * Constructs a new OneofDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofDescriptorProto); + + /** OneofDescriptorProto name. */ + public name: string; + + /** OneofDescriptorProto options. */ + public options?: (google.protobuf.IOneofOptions|null); + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofDescriptorProto instance + */ + public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; + + /** + * Verifies an OneofDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @param message OneofDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumDescriptorProto. */ + interface IEnumDescriptorProto { + + /** EnumDescriptorProto name */ + name?: (string|null); + + /** EnumDescriptorProto value */ + value?: (google.protobuf.IEnumValueDescriptorProto[]|null); + + /** EnumDescriptorProto options */ + options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange */ + reservedRange?: (google.protobuf.EnumDescriptorProto.IEnumReservedRange[]|null); + + /** EnumDescriptorProto reservedName */ + reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); + } + + /** Represents an EnumDescriptorProto. */ + class EnumDescriptorProto implements IEnumDescriptorProto { + + /** + * Constructs a new EnumDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumDescriptorProto); + + /** EnumDescriptorProto name. */ + public name: string; + + /** EnumDescriptorProto value. */ + public value: google.protobuf.IEnumValueDescriptorProto[]; + + /** EnumDescriptorProto options. */ + public options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange. */ + public reservedRange: google.protobuf.EnumDescriptorProto.IEnumReservedRange[]; + + /** EnumDescriptorProto reservedName. */ + public reservedName: string[]; + + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; + + /** + * Verifies an EnumDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @param message EnumDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EnumDescriptorProto { + + /** Properties of an EnumReservedRange. */ + interface IEnumReservedRange { + + /** EnumReservedRange start */ + start?: (number|null); + + /** EnumReservedRange end */ + end?: (number|null); + } + + /** Represents an EnumReservedRange. */ + class EnumReservedRange implements IEnumReservedRange { + + /** + * Constructs a new EnumReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange); + + /** EnumReservedRange start. */ + public start: number; + + /** EnumReservedRange end. */ + public end: number; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumReservedRange instance + */ + public static create(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Verifies an EnumReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @param message EnumReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto.EnumReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an EnumValueDescriptorProto. */ + interface IEnumValueDescriptorProto { + + /** EnumValueDescriptorProto name */ + name?: (string|null); + + /** EnumValueDescriptorProto number */ + number?: (number|null); + + /** EnumValueDescriptorProto options */ + options?: (google.protobuf.IEnumValueOptions|null); + } + + /** Represents an EnumValueDescriptorProto. */ + class EnumValueDescriptorProto implements IEnumValueDescriptorProto { + + /** + * Constructs a new EnumValueDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueDescriptorProto); + + /** EnumValueDescriptorProto name. */ + public name: string; + + /** EnumValueDescriptorProto number. */ + public number: number; + + /** EnumValueDescriptorProto options. */ + public options?: (google.protobuf.IEnumValueOptions|null); + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; + + /** + * Verifies an EnumValueDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @param message EnumValueDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceDescriptorProto. */ + interface IServiceDescriptorProto { + + /** ServiceDescriptorProto name */ + name?: (string|null); + + /** ServiceDescriptorProto method */ + method?: (google.protobuf.IMethodDescriptorProto[]|null); + + /** ServiceDescriptorProto options */ + options?: (google.protobuf.IServiceOptions|null); + } + + /** Represents a ServiceDescriptorProto. */ + class ServiceDescriptorProto implements IServiceDescriptorProto { + + /** + * Constructs a new ServiceDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceDescriptorProto); + + /** ServiceDescriptorProto name. */ + public name: string; + + /** ServiceDescriptorProto method. */ + public method: google.protobuf.IMethodDescriptorProto[]; + + /** ServiceDescriptorProto options. */ + public options?: (google.protobuf.IServiceOptions|null); + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceDescriptorProto instance + */ + public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; + + /** + * Verifies a ServiceDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @param message ServiceDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodDescriptorProto. */ + interface IMethodDescriptorProto { + + /** MethodDescriptorProto name */ + name?: (string|null); + + /** MethodDescriptorProto inputType */ + inputType?: (string|null); + + /** MethodDescriptorProto outputType */ + outputType?: (string|null); + + /** MethodDescriptorProto options */ + options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming */ + clientStreaming?: (boolean|null); + + /** MethodDescriptorProto serverStreaming */ + serverStreaming?: (boolean|null); + } + + /** Represents a MethodDescriptorProto. */ + class MethodDescriptorProto implements IMethodDescriptorProto { + + /** + * Constructs a new MethodDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodDescriptorProto); + + /** MethodDescriptorProto name. */ + public name: string; + + /** MethodDescriptorProto inputType. */ + public inputType: string; + + /** MethodDescriptorProto outputType. */ + public outputType: string; + + /** MethodDescriptorProto options. */ + public options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming. */ + public clientStreaming: boolean; + + /** MethodDescriptorProto serverStreaming. */ + public serverStreaming: boolean; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodDescriptorProto instance + */ + public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; + + /** + * Verifies a MethodDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @param message MethodDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FileOptions. */ + interface IFileOptions { + + /** FileOptions javaPackage */ + javaPackage?: (string|null); + + /** FileOptions javaOuterClassname */ + javaOuterClassname?: (string|null); + + /** FileOptions javaMultipleFiles */ + javaMultipleFiles?: (boolean|null); + + /** FileOptions javaGenerateEqualsAndHash */ + javaGenerateEqualsAndHash?: (boolean|null); + + /** FileOptions javaStringCheckUtf8 */ + javaStringCheckUtf8?: (boolean|null); + + /** FileOptions optimizeFor */ + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); + + /** FileOptions goPackage */ + goPackage?: (string|null); + + /** FileOptions ccGenericServices */ + ccGenericServices?: (boolean|null); + + /** FileOptions javaGenericServices */ + javaGenericServices?: (boolean|null); + + /** FileOptions pyGenericServices */ + pyGenericServices?: (boolean|null); + + /** FileOptions deprecated */ + deprecated?: (boolean|null); + + /** FileOptions ccEnableArenas */ + ccEnableArenas?: (boolean|null); + + /** FileOptions objcClassPrefix */ + objcClassPrefix?: (string|null); + + /** FileOptions csharpNamespace */ + csharpNamespace?: (string|null); + + /** FileOptions swiftPrefix */ + swiftPrefix?: (string|null); + + /** FileOptions phpClassPrefix */ + phpClassPrefix?: (string|null); + + /** FileOptions phpNamespace */ + phpNamespace?: (string|null); + + /** FileOptions phpMetadataNamespace */ + phpMetadataNamespace?: (string|null); + + /** FileOptions rubyPackage */ + rubyPackage?: (string|null); + + /** FileOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** FileOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); + } + + /** Represents a FileOptions. */ + class FileOptions implements IFileOptions { + + /** + * Constructs a new FileOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileOptions); + + /** FileOptions javaPackage. */ + public javaPackage: string; + + /** FileOptions javaOuterClassname. */ + public javaOuterClassname: string; + + /** FileOptions javaMultipleFiles. */ + public javaMultipleFiles: boolean; + + /** FileOptions javaGenerateEqualsAndHash. */ + public javaGenerateEqualsAndHash: boolean; + + /** FileOptions javaStringCheckUtf8. */ + public javaStringCheckUtf8: boolean; + + /** FileOptions optimizeFor. */ + public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); + + /** FileOptions goPackage. */ + public goPackage: string; + + /** FileOptions ccGenericServices. */ + public ccGenericServices: boolean; + + /** FileOptions javaGenericServices. */ + public javaGenericServices: boolean; + + /** FileOptions pyGenericServices. */ + public pyGenericServices: boolean; + + /** FileOptions deprecated. */ + public deprecated: boolean; + + /** FileOptions ccEnableArenas. */ + public ccEnableArenas: boolean; + + /** FileOptions objcClassPrefix. */ + public objcClassPrefix: string; + + /** FileOptions csharpNamespace. */ + public csharpNamespace: string; + + /** FileOptions swiftPrefix. */ + public swiftPrefix: string; + + /** FileOptions phpClassPrefix. */ + public phpClassPrefix: string; + + /** FileOptions phpNamespace. */ + public phpNamespace: string; + + /** FileOptions phpMetadataNamespace. */ + public phpMetadataNamespace: string; + + /** FileOptions rubyPackage. */ + public rubyPackage: string; + + /** FileOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** FileOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FileOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FileOptions instance + */ + public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + + /** + * Verifies a FileOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @param message FileOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FileOptions { + + /** OptimizeMode enum. */ + enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3 + } + } + + /** Properties of a MessageOptions. */ + interface IMessageOptions { + + /** MessageOptions messageSetWireFormat */ + messageSetWireFormat?: (boolean|null); + + /** MessageOptions noStandardDescriptorAccessor */ + noStandardDescriptorAccessor?: (boolean|null); + + /** MessageOptions deprecated */ + deprecated?: (boolean|null); + + /** MessageOptions mapEntry */ + mapEntry?: (boolean|null); + + /** MessageOptions deprecatedLegacyJsonFieldConflicts */ + deprecatedLegacyJsonFieldConflicts?: (boolean|null); + + /** MessageOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** MessageOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); + } + + /** Represents a MessageOptions. */ + class MessageOptions implements IMessageOptions { + + /** + * Constructs a new MessageOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMessageOptions); + + /** MessageOptions messageSetWireFormat. */ + public messageSetWireFormat: boolean; + + /** MessageOptions noStandardDescriptorAccessor. */ + public noStandardDescriptorAccessor: boolean; + + /** MessageOptions deprecated. */ + public deprecated: boolean; + + /** MessageOptions mapEntry. */ + public mapEntry: boolean; + + /** MessageOptions deprecatedLegacyJsonFieldConflicts. */ + public deprecatedLegacyJsonFieldConflicts: boolean; + + /** MessageOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** MessageOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageOptions instance + */ + public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + + /** + * Verifies a MessageOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @param message MessageOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldOptions. */ + interface IFieldOptions { + + /** FieldOptions ctype */ + ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); + + /** FieldOptions packed */ + packed?: (boolean|null); + + /** FieldOptions jstype */ + jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); + + /** FieldOptions lazy */ + lazy?: (boolean|null); + + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + + /** FieldOptions deprecated */ + deprecated?: (boolean|null); + + /** FieldOptions weak */ + weak?: (boolean|null); + + /** FieldOptions debugRedact */ + debugRedact?: (boolean|null); + + /** FieldOptions retention */ + retention?: (google.protobuf.FieldOptions.OptionRetention|keyof typeof google.protobuf.FieldOptions.OptionRetention|null); + + /** FieldOptions targets */ + targets?: (google.protobuf.FieldOptions.OptionTargetType[]|null); + + /** FieldOptions editionDefaults */ + editionDefaults?: (google.protobuf.FieldOptions.IEditionDefault[]|null); + + /** FieldOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + + /** FieldOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FieldOptions .google.api.fieldBehavior */ + ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); + } + + /** Represents a FieldOptions. */ + class FieldOptions implements IFieldOptions { + + /** + * Constructs a new FieldOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldOptions); + + /** FieldOptions ctype. */ + public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); + + /** FieldOptions lazy. */ + public lazy: boolean; + + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: boolean; + + /** FieldOptions deprecated. */ + public deprecated: boolean; + + /** FieldOptions weak. */ + public weak: boolean; + + /** FieldOptions debugRedact. */ + public debugRedact: boolean; + + /** FieldOptions retention. */ + public retention: (google.protobuf.FieldOptions.OptionRetention|keyof typeof google.protobuf.FieldOptions.OptionRetention); + + /** FieldOptions targets. */ + public targets: google.protobuf.FieldOptions.OptionTargetType[]; + + /** FieldOptions editionDefaults. */ + public editionDefaults: google.protobuf.FieldOptions.IEditionDefault[]; + + /** FieldOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + + /** FieldOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldOptions instance + */ + public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; + + /** + * Verifies a FieldOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @param message FieldOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldOptions { + + /** CType enum. */ + enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2 + } + + /** JSType enum. */ + enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2 + } + + /** OptionRetention enum. */ + enum OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2 + } + + /** OptionTargetType enum. */ + enum OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9 + } + + /** Properties of an EditionDefault. */ + interface IEditionDefault { + + /** EditionDefault edition */ + edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** EditionDefault value */ + value?: (string|null); + } + + /** Represents an EditionDefault. */ + class EditionDefault implements IEditionDefault { + + /** + * Constructs a new EditionDefault. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IEditionDefault); + + /** EditionDefault edition. */ + public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** EditionDefault value. */ + public value: string; + + /** + * Creates a new EditionDefault instance using the specified properties. + * @param [properties] Properties to set + * @returns EditionDefault instance + */ + public static create(properties?: google.protobuf.FieldOptions.IEditionDefault): google.protobuf.FieldOptions.EditionDefault; + + /** + * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @param message EditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @param message EditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EditionDefault message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions.EditionDefault; + + /** + * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions.EditionDefault; + + /** + * Verifies an EditionDefault message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EditionDefault + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.EditionDefault; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @param message EditionDefault + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.EditionDefault, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EditionDefault to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EditionDefault + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an OneofOptions. */ + interface IOneofOptions { + + /** OneofOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** OneofOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an OneofOptions. */ + class OneofOptions implements IOneofOptions { + + /** + * Constructs a new OneofOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofOptions); + + /** OneofOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** OneofOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofOptions instance + */ + public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; + + /** + * Verifies an OneofOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @param message OneofOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumOptions. */ + interface IEnumOptions { + + /** EnumOptions allowAlias */ + allowAlias?: (boolean|null); + + /** EnumOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumOptions deprecatedLegacyJsonFieldConflicts */ + deprecatedLegacyJsonFieldConflicts?: (boolean|null); + + /** EnumOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** EnumOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumOptions. */ + class EnumOptions implements IEnumOptions { + + /** + * Constructs a new EnumOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumOptions); + + /** EnumOptions allowAlias. */ + public allowAlias: boolean; + + /** EnumOptions deprecated. */ + public deprecated: boolean; + + /** EnumOptions deprecatedLegacyJsonFieldConflicts. */ + public deprecatedLegacyJsonFieldConflicts: boolean; + + /** EnumOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** EnumOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumOptions instance + */ + public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; + + /** + * Verifies an EnumOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @param message EnumOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumValueOptions. */ + interface IEnumValueOptions { + + /** EnumValueOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumValueOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** EnumValueOptions debugRedact */ + debugRedact?: (boolean|null); + + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + + /** EnumValueOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumValueOptions. */ + class EnumValueOptions implements IEnumValueOptions { + + /** + * Constructs a new EnumValueOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueOptions); + + /** EnumValueOptions deprecated. */ + public deprecated: boolean; + + /** EnumValueOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** EnumValueOptions debugRedact. */ + public debugRedact: boolean; + + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + + /** EnumValueOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueOptions instance + */ + public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; + + /** + * Verifies an EnumValueOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @param message EnumValueOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceOptions. */ + interface IServiceOptions { + + /** ServiceOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** ServiceOptions deprecated */ + deprecated?: (boolean|null); + + /** ServiceOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** ServiceOptions .google.api.defaultHost */ + ".google.api.defaultHost"?: (string|null); + + /** ServiceOptions .google.api.oauthScopes */ + ".google.api.oauthScopes"?: (string|null); + + /** ServiceOptions .google.api.apiVersion */ + ".google.api.apiVersion"?: (string|null); + } + + /** Represents a ServiceOptions. */ + class ServiceOptions implements IServiceOptions { + + /** + * Constructs a new ServiceOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceOptions); + + /** ServiceOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** ServiceOptions deprecated. */ + public deprecated: boolean; + + /** ServiceOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceOptions instance + */ + public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; + + /** + * Verifies a ServiceOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @param message ServiceOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodOptions. */ + interface IMethodOptions { + + /** MethodOptions deprecated */ + deprecated?: (boolean|null); + + /** MethodOptions idempotencyLevel */ + idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); + + /** MethodOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** MethodOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MethodOptions .google.api.http */ + ".google.api.http"?: (google.api.IHttpRule|null); + + /** MethodOptions .google.api.methodSignature */ + ".google.api.methodSignature"?: (string[]|null); + + /** MethodOptions .google.api.routing */ + ".google.api.routing"?: (google.api.IRoutingRule|null); + + /** MethodOptions .google.longrunning.operationInfo */ + ".google.longrunning.operationInfo"?: (google.longrunning.IOperationInfo|null); + } + + /** Represents a MethodOptions. */ + class MethodOptions implements IMethodOptions { + + /** + * Constructs a new MethodOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodOptions); + + /** MethodOptions deprecated. */ + public deprecated: boolean; + + /** MethodOptions idempotencyLevel. */ + public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); + + /** MethodOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** MethodOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodOptions instance + */ + public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; + + /** + * Verifies a MethodOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @param message MethodOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MethodOptions { + + /** IdempotencyLevel enum. */ + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2 + } + } + + /** Properties of an UninterpretedOption. */ + interface IUninterpretedOption { + + /** UninterpretedOption name */ + name?: (google.protobuf.UninterpretedOption.INamePart[]|null); + + /** UninterpretedOption identifierValue */ + identifierValue?: (string|null); + + /** UninterpretedOption positiveIntValue */ + positiveIntValue?: (number|Long|string|null); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long|string|null); + + /** UninterpretedOption doubleValue */ + doubleValue?: (number|null); + + /** UninterpretedOption stringValue */ + stringValue?: (Uint8Array|Buffer|string|null); + + /** UninterpretedOption aggregateValue */ + aggregateValue?: (string|null); + } + + /** Represents an UninterpretedOption. */ + class UninterpretedOption implements IUninterpretedOption { + + /** + * Constructs a new UninterpretedOption. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUninterpretedOption); + + /** UninterpretedOption name. */ + public name: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue. */ + public identifierValue: string; + + /** UninterpretedOption positiveIntValue. */ + public positiveIntValue: (number|Long|string); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long|string); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: (Uint8Array|Buffer|string); + + /** UninterpretedOption aggregateValue. */ + public aggregateValue: string; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @param [properties] Properties to set + * @returns UninterpretedOption instance + */ + public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + + /** + * Verifies an UninterpretedOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UninterpretedOption + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @param message UninterpretedOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UninterpretedOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UninterpretedOption + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UninterpretedOption { + + /** Properties of a NamePart. */ + interface INamePart { + + /** NamePart namePart */ + namePart: string; + + /** NamePart isExtension */ + isExtension: boolean; + } + + /** Represents a NamePart. */ + class NamePart implements INamePart { + + /** + * Constructs a new NamePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.UninterpretedOption.INamePart); + + /** NamePart namePart. */ + public namePart: string; + + /** NamePart isExtension. */ + public isExtension: boolean; + + /** + * Creates a new NamePart instance using the specified properties. + * @param [properties] Properties to set + * @returns NamePart instance + */ + public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; + + /** + * Verifies a NamePart message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NamePart + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @param message NamePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NamePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NamePart + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a FeatureSet. */ + interface IFeatureSet { + + /** FeatureSet fieldPresence */ + fieldPresence?: (google.protobuf.FeatureSet.FieldPresence|keyof typeof google.protobuf.FeatureSet.FieldPresence|null); + + /** FeatureSet enumType */ + enumType?: (google.protobuf.FeatureSet.EnumType|keyof typeof google.protobuf.FeatureSet.EnumType|null); + + /** FeatureSet repeatedFieldEncoding */ + repeatedFieldEncoding?: (google.protobuf.FeatureSet.RepeatedFieldEncoding|keyof typeof google.protobuf.FeatureSet.RepeatedFieldEncoding|null); + + /** FeatureSet utf8Validation */ + utf8Validation?: (google.protobuf.FeatureSet.Utf8Validation|keyof typeof google.protobuf.FeatureSet.Utf8Validation|null); + + /** FeatureSet messageEncoding */ + messageEncoding?: (google.protobuf.FeatureSet.MessageEncoding|keyof typeof google.protobuf.FeatureSet.MessageEncoding|null); + + /** FeatureSet jsonFormat */ + jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); + } + + /** Represents a FeatureSet. */ + class FeatureSet implements IFeatureSet { + + /** + * Constructs a new FeatureSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFeatureSet); + + /** FeatureSet fieldPresence. */ + public fieldPresence: (google.protobuf.FeatureSet.FieldPresence|keyof typeof google.protobuf.FeatureSet.FieldPresence); + + /** FeatureSet enumType. */ + public enumType: (google.protobuf.FeatureSet.EnumType|keyof typeof google.protobuf.FeatureSet.EnumType); + + /** FeatureSet repeatedFieldEncoding. */ + public repeatedFieldEncoding: (google.protobuf.FeatureSet.RepeatedFieldEncoding|keyof typeof google.protobuf.FeatureSet.RepeatedFieldEncoding); + + /** FeatureSet utf8Validation. */ + public utf8Validation: (google.protobuf.FeatureSet.Utf8Validation|keyof typeof google.protobuf.FeatureSet.Utf8Validation); + + /** FeatureSet messageEncoding. */ + public messageEncoding: (google.protobuf.FeatureSet.MessageEncoding|keyof typeof google.protobuf.FeatureSet.MessageEncoding); + + /** FeatureSet jsonFormat. */ + public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + + /** + * Creates a new FeatureSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSet instance + */ + public static create(properties?: google.protobuf.IFeatureSet): google.protobuf.FeatureSet; + + /** + * Encodes the specified FeatureSet message. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @param message FeatureSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFeatureSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSet message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @param message FeatureSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFeatureSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSet; + + /** + * Decodes a FeatureSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSet; + + /** + * Verifies a FeatureSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet; + + /** + * Creates a plain object from a FeatureSet message. Also converts values to other types if specified. + * @param message FeatureSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FeatureSet { + + /** FieldPresence enum. */ + enum FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3 + } + + /** EnumType enum. */ + enum EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2 + } + + /** RepeatedFieldEncoding enum. */ + enum RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2 + } + + /** Utf8Validation enum. */ + enum Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3 + } + + /** MessageEncoding enum. */ + enum MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2 + } + + /** JsonFormat enum. */ + enum JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2 + } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } + } + + /** Properties of a FeatureSetDefaults. */ + interface IFeatureSetDefaults { + + /** FeatureSetDefaults defaults */ + defaults?: (google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]|null); + + /** FeatureSetDefaults minimumEdition */ + minimumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSetDefaults maximumEdition */ + maximumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSetDefaults. */ + class FeatureSetDefaults implements IFeatureSetDefaults { + + /** + * Constructs a new FeatureSetDefaults. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFeatureSetDefaults); + + /** FeatureSetDefaults defaults. */ + public defaults: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]; + + /** FeatureSetDefaults minimumEdition. */ + public minimumEdition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSetDefaults maximumEdition. */ + public maximumEdition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSetDefaults instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSetDefaults instance + */ + public static create(properties?: google.protobuf.IFeatureSetDefaults): google.protobuf.FeatureSetDefaults; + + /** + * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @param message FeatureSetDefaults message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFeatureSetDefaults, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @param message FeatureSetDefaults message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFeatureSetDefaults, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSetDefaults; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSetDefaults; + + /** + * Verifies a FeatureSetDefaults message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSetDefaults + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSetDefaults; + + /** + * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. + * @param message FeatureSetDefaults + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSetDefaults, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSetDefaults to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSetDefaults + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FeatureSetDefaults { + + /** Properties of a FeatureSetEditionDefault. */ + interface IFeatureSetEditionDefault { + + /** FeatureSetEditionDefault edition */ + edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); + } + + /** Represents a FeatureSetEditionDefault. */ + class FeatureSetEditionDefault implements IFeatureSetEditionDefault { + + /** + * Constructs a new FeatureSetEditionDefault. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault); + + /** FeatureSetEditionDefault edition. */ + public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); + + /** + * Creates a new FeatureSetEditionDefault instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSetEditionDefault instance + */ + public static create(properties?: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @param message FeatureSetEditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @param message FeatureSetEditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Verifies a FeatureSetEditionDefault message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSetEditionDefault + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. + * @param message FeatureSetEditionDefault + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSetEditionDefault to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSetEditionDefault + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SourceCodeInfo. */ + interface ISourceCodeInfo { + + /** SourceCodeInfo location */ + location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); + } + + /** Represents a SourceCodeInfo. */ + class SourceCodeInfo implements ISourceCodeInfo { + + /** + * Constructs a new SourceCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ISourceCodeInfo); + + /** SourceCodeInfo location. */ + public location: google.protobuf.SourceCodeInfo.ILocation[]; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceCodeInfo instance + */ + public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; + + /** + * Verifies a SourceCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @param message SourceCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SourceCodeInfo { + + /** Properties of a Location. */ + interface ILocation { + + /** Location path */ + path?: (number[]|null); + + /** Location span */ + span?: (number[]|null); + + /** Location leadingComments */ + leadingComments?: (string|null); + + /** Location trailingComments */ + trailingComments?: (string|null); + + /** Location leadingDetachedComments */ + leadingDetachedComments?: (string[]|null); + } + + /** Represents a Location. */ + class Location implements ILocation { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); + + /** Location path. */ + public path: number[]; + + /** Location span. */ + public span: number[]; + + /** Location leadingComments. */ + public leadingComments: string; + + /** Location trailingComments. */ + public trailingComments: string; + + /** Location leadingDetachedComments. */ + public leadingDetachedComments: string[]; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Location + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a GeneratedCodeInfo. */ + interface IGeneratedCodeInfo { + + /** GeneratedCodeInfo annotation */ + annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); + } + + /** Represents a GeneratedCodeInfo. */ + class GeneratedCodeInfo implements IGeneratedCodeInfo { + + /** + * Constructs a new GeneratedCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IGeneratedCodeInfo); + + /** GeneratedCodeInfo annotation. */ + public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns GeneratedCodeInfo instance + */ + public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; + + /** + * Verifies a GeneratedCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeneratedCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @param message GeneratedCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace GeneratedCodeInfo { + + /** Properties of an Annotation. */ + interface IAnnotation { + + /** Annotation path */ + path?: (number[]|null); + + /** Annotation sourceFile */ + sourceFile?: (string|null); + + /** Annotation begin */ + begin?: (number|null); + + /** Annotation end */ + end?: (number|null); + + /** Annotation semantic */ + semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null); + } + + /** Represents an Annotation. */ + class Annotation implements IAnnotation { + + /** + * Constructs a new Annotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); + + /** Annotation path. */ + public path: number[]; + + /** Annotation sourceFile. */ + public sourceFile: string; + + /** Annotation begin. */ + public begin: number; + + /** Annotation end. */ + public end: number; + + /** Annotation semantic. */ + public semantic: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic); + + /** + * Creates a new Annotation instance using the specified properties. + * @param [properties] Properties to set + * @returns Annotation instance + */ + public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Verifies an Annotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Annotation + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @param message Annotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Annotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Annotation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Annotation { + + /** Semantic enum. */ + enum Semantic { + NONE = 0, + SET = 1, + ALIAS = 2 + } + } + } + + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + + /** + * Constructs a new Timestamp. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + + /** + * Verifies a Timestamp message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Timestamp + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Timestamp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Timestamp + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); + } + + /** Represents a Duration. */ + class Duration implements IDuration { + + /** + * Constructs a new Duration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + + /** + * Verifies a Duration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Duration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Duration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Duration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|Buffer|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|Buffer|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Any message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; + + /** + * Verifies an Any message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Any + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @param message Any + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Any to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Any + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Struct. */ + interface IStruct { + + /** Struct fields */ + fields?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a Struct. */ + class Struct implements IStruct { + + /** + * Constructs a new Struct. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IStruct); + + /** Struct fields. */ + public fields: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new Struct instance using the specified properties. + * @param [properties] Properties to set + * @returns Struct instance + */ + public static create(properties?: google.protobuf.IStruct): google.protobuf.Struct; + + /** + * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @param message Struct message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IStruct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @param message Struct message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IStruct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Struct message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Struct; + + /** + * Decodes a Struct message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Struct; + + /** + * Verifies a Struct message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Struct message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Struct + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Struct; + + /** + * Creates a plain object from a Struct message. Also converts values to other types if specified. + * @param message Struct + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Struct, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Struct to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Struct + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Value. */ + interface IValue { + + /** Value nullValue */ + nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value numberValue */ + numberValue?: (number|null); + + /** Value stringValue */ + stringValue?: (string|null); + + /** Value boolValue */ + boolValue?: (boolean|null); + + /** Value structValue */ + structValue?: (google.protobuf.IStruct|null); + + /** Value listValue */ + listValue?: (google.protobuf.IListValue|null); + } + + /** Represents a Value. */ + class Value implements IValue { + + /** + * Constructs a new Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IValue); + + /** Value nullValue. */ + public nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value numberValue. */ + public numberValue?: (number|null); + + /** Value stringValue. */ + public stringValue?: (string|null); + + /** Value boolValue. */ + public boolValue?: (boolean|null); + + /** Value structValue. */ + public structValue?: (google.protobuf.IStruct|null); + + /** Value listValue. */ + public listValue?: (google.protobuf.IListValue|null); + + /** Value kind. */ + public kind?: ("nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"); + + /** + * Creates a new Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Value instance + */ + public static create(properties?: google.protobuf.IValue): google.protobuf.Value; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Value; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Value; + + /** + * Verifies a Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Value; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @param message Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** NullValue enum. */ + enum NullValue { + NULL_VALUE = 0 + } + + /** Properties of a ListValue. */ + interface IListValue { + + /** ListValue values */ + values?: (google.protobuf.IValue[]|null); + } + + /** Represents a ListValue. */ + class ListValue implements IListValue { + + /** + * Constructs a new ListValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IListValue); + + /** ListValue values. */ + public values: google.protobuf.IValue[]; + + /** + * Creates a new ListValue instance using the specified properties. + * @param [properties] Properties to set + * @returns ListValue instance + */ + public static create(properties?: google.protobuf.IListValue): google.protobuf.ListValue; + + /** + * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @param message ListValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IListValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @param message ListValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IListValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ListValue; + + /** + * Decodes a ListValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ListValue; + + /** + * Verifies a ListValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ListValue; + + /** + * Creates a plain object from a ListValue message. Also converts values to other types if specified. + * @param message ListValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ListValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DoubleValue. */ + interface IDoubleValue { + + /** DoubleValue value */ + value?: (number|null); + } + + /** Represents a DoubleValue. */ + class DoubleValue implements IDoubleValue { + + /** + * Constructs a new DoubleValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDoubleValue); + + /** DoubleValue value. */ + public value: number; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @param [properties] Properties to set + * @returns DoubleValue instance + */ + public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DoubleValue; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DoubleValue; + + /** + * Verifies a DoubleValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoubleValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DoubleValue; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @param message DoubleValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DoubleValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DoubleValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DoubleValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FloatValue. */ + interface IFloatValue { + + /** FloatValue value */ + value?: (number|null); + } + + /** Represents a FloatValue. */ + class FloatValue implements IFloatValue { + + /** + * Constructs a new FloatValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFloatValue); + + /** FloatValue value. */ + public value: number; + + /** + * Creates a new FloatValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FloatValue instance + */ + public static create(properties?: google.protobuf.IFloatValue): google.protobuf.FloatValue; + + /** + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FloatValue; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FloatValue; + + /** + * Verifies a FloatValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FloatValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FloatValue; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @param message FloatValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FloatValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FloatValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FloatValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Int64Value. */ + interface IInt64Value { + + /** Int64Value value */ + value?: (number|Long|string|null); + } + + /** Represents an Int64Value. */ + class Int64Value implements IInt64Value { + + /** + * Constructs a new Int64Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IInt64Value); + + /** Int64Value value. */ + public value: (number|Long|string); + + /** + * Creates a new Int64Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Int64Value instance + */ + public static create(properties?: google.protobuf.IInt64Value): google.protobuf.Int64Value; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int64Value; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int64Value; + + /** + * Verifies an Int64Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Int64Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Int64Value; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @param message Int64Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Int64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Int64Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Int64Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UInt64Value. */ + interface IUInt64Value { + + /** UInt64Value value */ + value?: (number|Long|string|null); + } + + /** Represents a UInt64Value. */ + class UInt64Value implements IUInt64Value { + + /** + * Constructs a new UInt64Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt64Value); + + /** UInt64Value value. */ + public value: (number|Long|string); + + /** + * Creates a new UInt64Value instance using the specified properties. + * @param [properties] Properties to set + * @returns UInt64Value instance + */ + public static create(properties?: google.protobuf.IUInt64Value): google.protobuf.UInt64Value; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt64Value; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt64Value; + + /** + * Verifies a UInt64Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UInt64Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt64Value; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @param message UInt64Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UInt64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UInt64Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UInt64Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Int32Value. */ + interface IInt32Value { + + /** Int32Value value */ + value?: (number|null); + } + + /** Represents an Int32Value. */ + class Int32Value implements IInt32Value { + + /** + * Constructs a new Int32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IInt32Value); + + /** Int32Value value. */ + public value: number; + + /** + * Creates a new Int32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Int32Value instance + */ + public static create(properties?: google.protobuf.IInt32Value): google.protobuf.Int32Value; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int32Value; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int32Value; + + /** + * Verifies an Int32Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Int32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Int32Value; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @param message Int32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Int32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Int32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Int32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UInt32Value. */ + interface IUInt32Value { + + /** UInt32Value value */ + value?: (number|null); + } + + /** Represents a UInt32Value. */ + class UInt32Value implements IUInt32Value { + + /** + * Constructs a new UInt32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt32Value); + + /** UInt32Value value. */ + public value: number; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns UInt32Value instance + */ + public static create(properties?: google.protobuf.IUInt32Value): google.protobuf.UInt32Value; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt32Value; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt32Value; + + /** + * Verifies a UInt32Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UInt32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt32Value; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @param message UInt32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UInt32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UInt32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UInt32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BoolValue. */ + interface IBoolValue { + + /** BoolValue value */ + value?: (boolean|null); + } + + /** Represents a BoolValue. */ + class BoolValue implements IBoolValue { + + /** + * Constructs a new BoolValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBoolValue); + + /** BoolValue value. */ + public value: boolean; + + /** + * Creates a new BoolValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BoolValue instance + */ + public static create(properties?: google.protobuf.IBoolValue): google.protobuf.BoolValue; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BoolValue; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BoolValue; + + /** + * Verifies a BoolValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoolValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BoolValue; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @param message BoolValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BoolValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoolValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoolValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StringValue. */ + interface IStringValue { + + /** StringValue value */ + value?: (string|null); + } + + /** Represents a StringValue. */ + class StringValue implements IStringValue { + + /** + * Constructs a new StringValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IStringValue); + + /** StringValue value. */ + public value: string; + + /** + * Creates a new StringValue instance using the specified properties. + * @param [properties] Properties to set + * @returns StringValue instance + */ + public static create(properties?: google.protobuf.IStringValue): google.protobuf.StringValue; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.StringValue; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.StringValue; + + /** + * Verifies a StringValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StringValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.StringValue; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @param message StringValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.StringValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StringValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StringValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BytesValue. */ + interface IBytesValue { + + /** BytesValue value */ + value?: (Uint8Array|Buffer|string|null); + } + + /** Represents a BytesValue. */ + class BytesValue implements IBytesValue { + + /** + * Constructs a new BytesValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBytesValue); + + /** BytesValue value. */ + public value: (Uint8Array|Buffer|string); + + /** + * Creates a new BytesValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BytesValue instance + */ + public static create(properties?: google.protobuf.IBytesValue): google.protobuf.BytesValue; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BytesValue; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BytesValue; + + /** + * Verifies a BytesValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BytesValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BytesValue; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @param message BytesValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BytesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BytesValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BytesValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace type. */ + namespace type { + + /** DayOfWeek enum. */ + enum DayOfWeek { + DAY_OF_WEEK_UNSPECIFIED = 0, + MONDAY = 1, + TUESDAY = 2, + WEDNESDAY = 3, + THURSDAY = 4, + FRIDAY = 5, + SATURDAY = 6, + SUNDAY = 7 + } + + /** Properties of a LatLng. */ + interface ILatLng { + + /** LatLng latitude */ + latitude?: (number|null); + + /** LatLng longitude */ + longitude?: (number|null); + } + + /** Represents a LatLng. */ + class LatLng implements ILatLng { + + /** + * Constructs a new LatLng. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.ILatLng); + + /** LatLng latitude. */ + public latitude: number; + + /** LatLng longitude. */ + public longitude: number; + + /** + * Creates a new LatLng instance using the specified properties. + * @param [properties] Properties to set + * @returns LatLng instance + */ + public static create(properties?: google.type.ILatLng): google.type.LatLng; + + /** + * Encodes the specified LatLng message. Does not implicitly {@link google.type.LatLng.verify|verify} messages. + * @param message LatLng message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.type.ILatLng, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LatLng message, length delimited. Does not implicitly {@link google.type.LatLng.verify|verify} messages. + * @param message LatLng message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.type.ILatLng, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LatLng message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LatLng + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.LatLng; + + /** + * Decodes a LatLng message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LatLng + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.LatLng; + + /** + * Verifies a LatLng message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LatLng message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LatLng + */ + public static fromObject(object: { [k: string]: any }): google.type.LatLng; + + /** + * Creates a plain object from a LatLng message. Also converts values to other types if specified. + * @param message LatLng + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.type.LatLng, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LatLng to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LatLng + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace longrunning. */ + namespace longrunning { + + /** Represents an Operations */ + class Operations extends $protobuf.rpc.Service { + + /** + * Constructs a new Operations service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Operations service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Operations; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListOperationsResponse + */ + public listOperations(request: google.longrunning.IListOperationsRequest, callback: google.longrunning.Operations.ListOperationsCallback): void; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @returns Promise + */ + public listOperations(request: google.longrunning.IListOperationsRequest): Promise; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public getOperation(request: google.longrunning.IGetOperationRequest, callback: google.longrunning.Operations.GetOperationCallback): void; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @returns Promise + */ + public getOperation(request: google.longrunning.IGetOperationRequest): Promise; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest, callback: google.longrunning.Operations.DeleteOperationCallback): void; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @returns Promise + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest): Promise; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest, callback: google.longrunning.Operations.CancelOperationCallback): void; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @returns Promise + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest): Promise; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest, callback: google.longrunning.Operations.WaitOperationCallback): void; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @returns Promise + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest): Promise; + } + + namespace Operations { + + /** + * Callback as used by {@link google.longrunning.Operations|listOperations}. + * @param error Error, if any + * @param [response] ListOperationsResponse + */ + type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|getOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|waitOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type WaitOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an Operation. */ + interface IOperation { + + /** Operation name */ + name?: (string|null); + + /** Operation metadata */ + metadata?: (google.protobuf.IAny|null); + + /** Operation done */ + done?: (boolean|null); + + /** Operation error */ + error?: (google.rpc.IStatus|null); + + /** Operation response */ + response?: (google.protobuf.IAny|null); + } + + /** Represents an Operation. */ + class Operation implements IOperation { + + /** + * Constructs a new Operation. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IOperation); + + /** Operation name. */ + public name: string; + + /** Operation metadata. */ + public metadata?: (google.protobuf.IAny|null); + + /** Operation done. */ + public done: boolean; + + /** Operation error. */ + public error?: (google.rpc.IStatus|null); + + /** Operation response. */ + public response?: (google.protobuf.IAny|null); + + /** Operation result. */ + public result?: ("error"|"response"); + + /** + * Creates a new Operation instance using the specified properties. + * @param [properties] Properties to set + * @returns Operation instance + */ + public static create(properties?: google.longrunning.IOperation): google.longrunning.Operation; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.Operation; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.Operation; + + /** + * Verifies an Operation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Operation + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.Operation; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @param message Operation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Operation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Operation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetOperationRequest. */ + interface IGetOperationRequest { + + /** GetOperationRequest name */ + name?: (string|null); + } + + /** Represents a GetOperationRequest. */ + class GetOperationRequest implements IGetOperationRequest { + + /** + * Constructs a new GetOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IGetOperationRequest); + + /** GetOperationRequest name. */ + public name: string; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetOperationRequest instance + */ + public static create(properties?: google.longrunning.IGetOperationRequest): google.longrunning.GetOperationRequest; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.GetOperationRequest; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.GetOperationRequest; + + /** + * Verifies a GetOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.GetOperationRequest; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @param message GetOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.GetOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListOperationsRequest. */ + interface IListOperationsRequest { + + /** ListOperationsRequest name */ + name?: (string|null); + + /** ListOperationsRequest filter */ + filter?: (string|null); + + /** ListOperationsRequest pageSize */ + pageSize?: (number|null); + + /** ListOperationsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListOperationsRequest. */ + class ListOperationsRequest implements IListOperationsRequest { + + /** + * Constructs a new ListOperationsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IListOperationsRequest); + + /** ListOperationsRequest name. */ + public name: string; + + /** ListOperationsRequest filter. */ + public filter: string; + + /** ListOperationsRequest pageSize. */ + public pageSize: number; + + /** ListOperationsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListOperationsRequest instance + */ + public static create(properties?: google.longrunning.IListOperationsRequest): google.longrunning.ListOperationsRequest; + + /** + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @param message ListOperationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @param message ListOperationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.ListOperationsRequest; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.ListOperationsRequest; + + /** + * Verifies a ListOperationsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListOperationsRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsRequest; + + /** + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. + * @param message ListOperationsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.ListOperationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListOperationsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListOperationsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListOperationsResponse. */ + interface IListOperationsResponse { + + /** ListOperationsResponse operations */ + operations?: (google.longrunning.IOperation[]|null); + + /** ListOperationsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListOperationsResponse. */ + class ListOperationsResponse implements IListOperationsResponse { + + /** + * Constructs a new ListOperationsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IListOperationsResponse); + + /** ListOperationsResponse operations. */ + public operations: google.longrunning.IOperation[]; + + /** ListOperationsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListOperationsResponse instance + */ + public static create(properties?: google.longrunning.IListOperationsResponse): google.longrunning.ListOperationsResponse; + + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @param message ListOperationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @param message ListOperationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.ListOperationsResponse; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.ListOperationsResponse; + + /** + * Verifies a ListOperationsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListOperationsResponse + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsResponse; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @param message ListOperationsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.ListOperationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListOperationsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListOperationsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CancelOperationRequest. */ + interface ICancelOperationRequest { + + /** CancelOperationRequest name */ + name?: (string|null); + } + + /** Represents a CancelOperationRequest. */ + class CancelOperationRequest implements ICancelOperationRequest { + + /** + * Constructs a new CancelOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.ICancelOperationRequest); + + /** CancelOperationRequest name. */ + public name: string; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CancelOperationRequest instance + */ + public static create(properties?: google.longrunning.ICancelOperationRequest): google.longrunning.CancelOperationRequest; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @param message CancelOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @param message CancelOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.CancelOperationRequest; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.CancelOperationRequest; + + /** + * Verifies a CancelOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CancelOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.CancelOperationRequest; + + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @param message CancelOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.CancelOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CancelOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CancelOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteOperationRequest. */ + interface IDeleteOperationRequest { + + /** DeleteOperationRequest name */ + name?: (string|null); + } + + /** Represents a DeleteOperationRequest. */ + class DeleteOperationRequest implements IDeleteOperationRequest { + + /** + * Constructs a new DeleteOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IDeleteOperationRequest); + + /** DeleteOperationRequest name. */ + public name: string; + + /** + * Creates a new DeleteOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteOperationRequest instance + */ + public static create(properties?: google.longrunning.IDeleteOperationRequest): google.longrunning.DeleteOperationRequest; + + /** + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @param message DeleteOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @param message DeleteOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.DeleteOperationRequest; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.DeleteOperationRequest; + + /** + * Verifies a DeleteOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.DeleteOperationRequest; + + /** + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. + * @param message DeleteOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.DeleteOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WaitOperationRequest. */ + interface IWaitOperationRequest { + + /** WaitOperationRequest name */ + name?: (string|null); + + /** WaitOperationRequest timeout */ + timeout?: (google.protobuf.IDuration|null); + } + + /** Represents a WaitOperationRequest. */ + class WaitOperationRequest implements IWaitOperationRequest { + + /** + * Constructs a new WaitOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IWaitOperationRequest); + + /** WaitOperationRequest name. */ + public name: string; + + /** WaitOperationRequest timeout. */ + public timeout?: (google.protobuf.IDuration|null); + + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WaitOperationRequest instance + */ + public static create(properties?: google.longrunning.IWaitOperationRequest): google.longrunning.WaitOperationRequest; + + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @param message WaitOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @param message WaitOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.WaitOperationRequest; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.WaitOperationRequest; + + /** + * Verifies a WaitOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WaitOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.WaitOperationRequest; + + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @param message WaitOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.WaitOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WaitOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WaitOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OperationInfo. */ + interface IOperationInfo { + + /** OperationInfo responseType */ + responseType?: (string|null); + + /** OperationInfo metadataType */ + metadataType?: (string|null); + } + + /** Represents an OperationInfo. */ + class OperationInfo implements IOperationInfo { + + /** + * Constructs a new OperationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IOperationInfo); + + /** OperationInfo responseType. */ + public responseType: string; + + /** OperationInfo metadataType. */ + public metadataType: string; + + /** + * Creates a new OperationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationInfo instance + */ + public static create(properties?: google.longrunning.IOperationInfo): google.longrunning.OperationInfo; + + /** + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @param message OperationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @param message OperationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.OperationInfo; + + /** + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.OperationInfo; + + /** + * Verifies an OperationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationInfo + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.OperationInfo; + + /** + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. + * @param message OperationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.OperationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace rpc. */ + namespace rpc { + + /** Properties of a Status. */ + interface IStatus { + + /** Status code */ + code?: (number|null); + + /** Status message */ + message?: (string|null); + + /** Status details */ + details?: (google.protobuf.IAny[]|null); + } + + /** Represents a Status. */ + class Status implements IStatus { + + /** + * Constructs a new Status. + * @param [properties] Properties to set + */ + constructor(properties?: google.rpc.IStatus); + + /** Status code. */ + public code: number; + + /** Status message. */ + public message: string; + + /** Status details. */ + public details: google.protobuf.IAny[]; + + /** + * Creates a new Status instance using the specified properties. + * @param [properties] Properties to set + * @returns Status instance + */ + public static create(properties?: google.rpc.IStatus): google.rpc.Status; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Status message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; + + /** + * Verifies a Status message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Status + */ + public static fromObject(object: { [k: string]: any }): google.rpc.Status; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @param message Status + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Status to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Status + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } +} diff --git a/packages/google-cloud-firestore-api/protos/protos.js b/packages/google-cloud-firestore-api/protos/protos.js new file mode 100644 index 000000000000..0968c8733ccd --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/protos.js @@ -0,0 +1,98414 @@ +// Copyright 2026 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. + +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +(function(global, factory) { /* global define, require, module */ + + /* AMD */ if (typeof define === 'function' && define.amd) + define(["protobufjs/minimal"], factory); + + /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) + module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); + +})(this, function($protobuf) { + "use strict"; + + // Common aliases + var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + + // Exported root namespace + var $root = $protobuf.roots["_google_cloud_firestore_api_protos"] || ($protobuf.roots["_google_cloud_firestore_api_protos"] = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.firestore = (function() { + + /** + * Namespace firestore. + * @memberof google + * @namespace + */ + var firestore = {}; + + firestore.admin = (function() { + + /** + * Namespace admin. + * @memberof google.firestore + * @namespace + */ + var admin = {}; + + admin.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.firestore.admin + * @namespace + */ + var v1 = {}; + + v1.Backup = (function() { + + /** + * Properties of a Backup. + * @memberof google.firestore.admin.v1 + * @interface IBackup + * @property {string|null} [name] Backup name + * @property {string|null} [database] Backup database + * @property {string|null} [databaseUid] Backup databaseUid + * @property {google.protobuf.ITimestamp|null} [snapshotTime] Backup snapshotTime + * @property {google.protobuf.ITimestamp|null} [expireTime] Backup expireTime + * @property {google.firestore.admin.v1.Backup.IStats|null} [stats] Backup stats + * @property {google.firestore.admin.v1.Backup.State|null} [state] Backup state + */ + + /** + * Constructs a new Backup. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a Backup. + * @implements IBackup + * @constructor + * @param {google.firestore.admin.v1.IBackup=} [properties] Properties to set + */ + function Backup(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Backup name. + * @member {string} name + * @memberof google.firestore.admin.v1.Backup + * @instance + */ + Backup.prototype.name = ""; + + /** + * Backup database. + * @member {string} database + * @memberof google.firestore.admin.v1.Backup + * @instance + */ + Backup.prototype.database = ""; + + /** + * Backup databaseUid. + * @member {string} databaseUid + * @memberof google.firestore.admin.v1.Backup + * @instance + */ + Backup.prototype.databaseUid = ""; + + /** + * Backup snapshotTime. + * @member {google.protobuf.ITimestamp|null|undefined} snapshotTime + * @memberof google.firestore.admin.v1.Backup + * @instance + */ + Backup.prototype.snapshotTime = null; + + /** + * Backup expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.firestore.admin.v1.Backup + * @instance + */ + Backup.prototype.expireTime = null; + + /** + * Backup stats. + * @member {google.firestore.admin.v1.Backup.IStats|null|undefined} stats + * @memberof google.firestore.admin.v1.Backup + * @instance + */ + Backup.prototype.stats = null; + + /** + * Backup state. + * @member {google.firestore.admin.v1.Backup.State} state + * @memberof google.firestore.admin.v1.Backup + * @instance + */ + Backup.prototype.state = 0; + + /** + * Creates a new Backup instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Backup + * @static + * @param {google.firestore.admin.v1.IBackup=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Backup} Backup instance + */ + Backup.create = function create(properties) { + return new Backup(properties); + }; + + /** + * Encodes the specified Backup message. Does not implicitly {@link google.firestore.admin.v1.Backup.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Backup + * @static + * @param {google.firestore.admin.v1.IBackup} message Backup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Backup.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.database); + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + $root.google.protobuf.Timestamp.encode(message.snapshotTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.stats != null && Object.hasOwnProperty.call(message, "stats")) + $root.google.firestore.admin.v1.Backup.Stats.encode(message.stats, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.databaseUid != null && Object.hasOwnProperty.call(message, "databaseUid")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.databaseUid); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.state); + return writer; + }; + + /** + * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Backup.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Backup + * @static + * @param {google.firestore.admin.v1.IBackup} message Backup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Backup.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Backup message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Backup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Backup} Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Backup.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Backup(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.database = reader.string(); + break; + } + case 7: { + message.databaseUid = reader.string(); + break; + } + case 3: { + message.snapshotTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.stats = $root.google.firestore.admin.v1.Backup.Stats.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 8: { + message.state = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Backup message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Backup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Backup} Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Backup.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Backup message. + * @function verify + * @memberof google.firestore.admin.v1.Backup + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Backup.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.databaseUid != null && Object.hasOwnProperty.call(message, "databaseUid")) + if (!$util.isString(message.databaseUid)) + return "databaseUid: string expected"; + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.snapshotTime, long + 1); + if (error) + return "snapshotTime." + error; + } + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime, long + 1); + if (error) + return "expireTime." + error; + } + if (message.stats != null && Object.hasOwnProperty.call(message, "stats")) { + var error = $root.google.firestore.admin.v1.Backup.Stats.verify(message.stats, long + 1); + if (error) + return "stats." + error; + } + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a Backup message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Backup + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Backup} Backup + */ + Backup.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Backup) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Backup: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Backup(); + if (object.name != null) + message.name = String(object.name); + if (object.database != null) + message.database = String(object.database); + if (object.databaseUid != null) + message.databaseUid = String(object.databaseUid); + if (object.snapshotTime != null) { + if (!$util.isObject(object.snapshotTime)) + throw TypeError(".google.firestore.admin.v1.Backup.snapshotTime: object expected"); + message.snapshotTime = $root.google.protobuf.Timestamp.fromObject(object.snapshotTime, long + 1); + } + if (object.expireTime != null) { + if (!$util.isObject(object.expireTime)) + throw TypeError(".google.firestore.admin.v1.Backup.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime, long + 1); + } + if (object.stats != null) { + if (!$util.isObject(object.stats)) + throw TypeError(".google.firestore.admin.v1.Backup.stats: object expected"); + message.stats = $root.google.firestore.admin.v1.Backup.Stats.fromObject(object.stats, long + 1); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATING": + case 1: + message.state = 1; + break; + case "READY": + case 2: + message.state = 2; + break; + case "NOT_AVAILABLE": + case 3: + message.state = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a Backup message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Backup + * @static + * @param {google.firestore.admin.v1.Backup} message Backup + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Backup.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.database = ""; + object.snapshotTime = null; + object.expireTime = null; + object.stats = null; + object.databaseUid = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + object.snapshotTime = $root.google.protobuf.Timestamp.toObject(message.snapshotTime, options, q + 1); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options, q + 1); + if (message.stats != null && Object.hasOwnProperty.call(message, "stats")) + object.stats = $root.google.firestore.admin.v1.Backup.Stats.toObject(message.stats, options, q + 1); + if (message.databaseUid != null && Object.hasOwnProperty.call(message, "databaseUid")) + object.databaseUid = message.databaseUid; + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + object.state = options.enums === String ? $root.google.firestore.admin.v1.Backup.State[message.state] === undefined ? message.state : $root.google.firestore.admin.v1.Backup.State[message.state] : message.state; + return object; + }; + + /** + * Converts this Backup to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Backup + * @instance + * @returns {Object.} JSON object + */ + Backup.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Backup + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Backup + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Backup.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Backup"; + }; + + Backup.Stats = (function() { + + /** + * Properties of a Stats. + * @memberof google.firestore.admin.v1.Backup + * @interface IStats + * @property {number|Long|null} [sizeBytes] Stats sizeBytes + * @property {number|Long|null} [documentCount] Stats documentCount + * @property {number|Long|null} [indexCount] Stats indexCount + */ + + /** + * Constructs a new Stats. + * @memberof google.firestore.admin.v1.Backup + * @classdesc Represents a Stats. + * @implements IStats + * @constructor + * @param {google.firestore.admin.v1.Backup.IStats=} [properties] Properties to set + */ + function Stats(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Stats sizeBytes. + * @member {number|Long} sizeBytes + * @memberof google.firestore.admin.v1.Backup.Stats + * @instance + */ + Stats.prototype.sizeBytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Stats documentCount. + * @member {number|Long} documentCount + * @memberof google.firestore.admin.v1.Backup.Stats + * @instance + */ + Stats.prototype.documentCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Stats indexCount. + * @member {number|Long} indexCount + * @memberof google.firestore.admin.v1.Backup.Stats + * @instance + */ + Stats.prototype.indexCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Stats instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Backup.Stats + * @static + * @param {google.firestore.admin.v1.Backup.IStats=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Backup.Stats} Stats instance + */ + Stats.create = function create(properties) { + return new Stats(properties); + }; + + /** + * Encodes the specified Stats message. Does not implicitly {@link google.firestore.admin.v1.Backup.Stats.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Backup.Stats + * @static + * @param {google.firestore.admin.v1.Backup.IStats} message Stats message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stats.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.sizeBytes != null && Object.hasOwnProperty.call(message, "sizeBytes")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.sizeBytes); + if (message.documentCount != null && Object.hasOwnProperty.call(message, "documentCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.documentCount); + if (message.indexCount != null && Object.hasOwnProperty.call(message, "indexCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.indexCount); + return writer; + }; + + /** + * Encodes the specified Stats message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Backup.Stats.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Backup.Stats + * @static + * @param {google.firestore.admin.v1.Backup.IStats} message Stats message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stats.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Stats message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Backup.Stats + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Backup.Stats} Stats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stats.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Backup.Stats(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.sizeBytes = reader.int64(); + break; + } + case 2: { + message.documentCount = reader.int64(); + break; + } + case 3: { + message.indexCount = reader.int64(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Stats message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Backup.Stats + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Backup.Stats} Stats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stats.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Stats message. + * @function verify + * @memberof google.firestore.admin.v1.Backup.Stats + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Stats.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.sizeBytes != null && Object.hasOwnProperty.call(message, "sizeBytes")) + if (!$util.isInteger(message.sizeBytes) && !(message.sizeBytes && $util.isInteger(message.sizeBytes.low) && $util.isInteger(message.sizeBytes.high))) + return "sizeBytes: integer|Long expected"; + if (message.documentCount != null && Object.hasOwnProperty.call(message, "documentCount")) + if (!$util.isInteger(message.documentCount) && !(message.documentCount && $util.isInteger(message.documentCount.low) && $util.isInteger(message.documentCount.high))) + return "documentCount: integer|Long expected"; + if (message.indexCount != null && Object.hasOwnProperty.call(message, "indexCount")) + if (!$util.isInteger(message.indexCount) && !(message.indexCount && $util.isInteger(message.indexCount.low) && $util.isInteger(message.indexCount.high))) + return "indexCount: integer|Long expected"; + return null; + }; + + /** + * Creates a Stats message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Backup.Stats + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Backup.Stats} Stats + */ + Stats.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Backup.Stats) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Backup.Stats: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Backup.Stats(); + if (object.sizeBytes != null) + if ($util.Long) + message.sizeBytes = $util.Long.fromValue(object.sizeBytes, false); + else if (typeof object.sizeBytes === "string") + message.sizeBytes = parseInt(object.sizeBytes, 10); + else if (typeof object.sizeBytes === "number") + message.sizeBytes = object.sizeBytes; + else if (typeof object.sizeBytes === "object") + message.sizeBytes = new $util.LongBits(object.sizeBytes.low >>> 0, object.sizeBytes.high >>> 0).toNumber(); + if (object.documentCount != null) + if ($util.Long) + message.documentCount = $util.Long.fromValue(object.documentCount, false); + else if (typeof object.documentCount === "string") + message.documentCount = parseInt(object.documentCount, 10); + else if (typeof object.documentCount === "number") + message.documentCount = object.documentCount; + else if (typeof object.documentCount === "object") + message.documentCount = new $util.LongBits(object.documentCount.low >>> 0, object.documentCount.high >>> 0).toNumber(); + if (object.indexCount != null) + if ($util.Long) + message.indexCount = $util.Long.fromValue(object.indexCount, false); + else if (typeof object.indexCount === "string") + message.indexCount = parseInt(object.indexCount, 10); + else if (typeof object.indexCount === "number") + message.indexCount = object.indexCount; + else if (typeof object.indexCount === "object") + message.indexCount = new $util.LongBits(object.indexCount.low >>> 0, object.indexCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Stats message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Backup.Stats + * @static + * @param {google.firestore.admin.v1.Backup.Stats} message Stats + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Stats.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.sizeBytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.sizeBytes = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.documentCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.documentCount = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.indexCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.indexCount = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + } + if (message.sizeBytes != null && Object.hasOwnProperty.call(message, "sizeBytes")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.sizeBytes = typeof message.sizeBytes === "number" ? BigInt(message.sizeBytes) : $util.Long.fromBits(message.sizeBytes.low >>> 0, message.sizeBytes.high >>> 0, false).toBigInt(); + else if (typeof message.sizeBytes === "number") + object.sizeBytes = options.longs === String ? String(message.sizeBytes) : message.sizeBytes; + else + object.sizeBytes = options.longs === String ? $util.Long.prototype.toString.call(message.sizeBytes) : options.longs === Number ? new $util.LongBits(message.sizeBytes.low >>> 0, message.sizeBytes.high >>> 0).toNumber() : message.sizeBytes; + if (message.documentCount != null && Object.hasOwnProperty.call(message, "documentCount")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.documentCount = typeof message.documentCount === "number" ? BigInt(message.documentCount) : $util.Long.fromBits(message.documentCount.low >>> 0, message.documentCount.high >>> 0, false).toBigInt(); + else if (typeof message.documentCount === "number") + object.documentCount = options.longs === String ? String(message.documentCount) : message.documentCount; + else + object.documentCount = options.longs === String ? $util.Long.prototype.toString.call(message.documentCount) : options.longs === Number ? new $util.LongBits(message.documentCount.low >>> 0, message.documentCount.high >>> 0).toNumber() : message.documentCount; + if (message.indexCount != null && Object.hasOwnProperty.call(message, "indexCount")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.indexCount = typeof message.indexCount === "number" ? BigInt(message.indexCount) : $util.Long.fromBits(message.indexCount.low >>> 0, message.indexCount.high >>> 0, false).toBigInt(); + else if (typeof message.indexCount === "number") + object.indexCount = options.longs === String ? String(message.indexCount) : message.indexCount; + else + object.indexCount = options.longs === String ? $util.Long.prototype.toString.call(message.indexCount) : options.longs === Number ? new $util.LongBits(message.indexCount.low >>> 0, message.indexCount.high >>> 0).toNumber() : message.indexCount; + return object; + }; + + /** + * Converts this Stats to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Backup.Stats + * @instance + * @returns {Object.} JSON object + */ + Stats.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Stats + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Backup.Stats + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Stats.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Backup.Stats"; + }; + + return Stats; + })(); + + /** + * State enum. + * @name google.firestore.admin.v1.Backup.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} READY=2 READY value + * @property {number} NOT_AVAILABLE=3 NOT_AVAILABLE value + */ + Backup.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "READY"] = 2; + values[valuesById[3] = "NOT_AVAILABLE"] = 3; + return values; + })(); + + return Backup; + })(); + + v1.Database = (function() { + + /** + * Properties of a Database. + * @memberof google.firestore.admin.v1 + * @interface IDatabase + * @property {string|null} [name] Database name + * @property {string|null} [uid] Database uid + * @property {google.protobuf.ITimestamp|null} [createTime] Database createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Database updateTime + * @property {google.protobuf.ITimestamp|null} [deleteTime] Database deleteTime + * @property {string|null} [locationId] Database locationId + * @property {google.firestore.admin.v1.Database.DatabaseType|null} [type] Database type + * @property {google.firestore.admin.v1.Database.ConcurrencyMode|null} [concurrencyMode] Database concurrencyMode + * @property {google.protobuf.IDuration|null} [versionRetentionPeriod] Database versionRetentionPeriod + * @property {google.protobuf.ITimestamp|null} [earliestVersionTime] Database earliestVersionTime + * @property {google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement|null} [pointInTimeRecoveryEnablement] Database pointInTimeRecoveryEnablement + * @property {google.firestore.admin.v1.Database.AppEngineIntegrationMode|null} [appEngineIntegrationMode] Database appEngineIntegrationMode + * @property {string|null} [keyPrefix] Database keyPrefix + * @property {google.firestore.admin.v1.Database.DeleteProtectionState|null} [deleteProtectionState] Database deleteProtectionState + * @property {google.firestore.admin.v1.Database.ICmekConfig|null} [cmekConfig] Database cmekConfig + * @property {string|null} [previousId] Database previousId + * @property {google.firestore.admin.v1.Database.ISourceInfo|null} [sourceInfo] Database sourceInfo + * @property {Object.|null} [tags] Database tags + * @property {boolean|null} [freeTier] Database freeTier + * @property {string|null} [etag] Database etag + * @property {google.firestore.admin.v1.Database.DatabaseEdition|null} [databaseEdition] Database databaseEdition + * @property {google.firestore.admin.v1.RealtimeUpdatesMode|null} [realtimeUpdatesMode] Database realtimeUpdatesMode + * @property {google.firestore.admin.v1.Database.DataAccessMode|null} [firestoreDataAccessMode] Database firestoreDataAccessMode + * @property {google.firestore.admin.v1.Database.DataAccessMode|null} [mongodbCompatibleDataAccessMode] Database mongodbCompatibleDataAccessMode + */ + + /** + * Constructs a new Database. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a Database. + * @implements IDatabase + * @constructor + * @param {google.firestore.admin.v1.IDatabase=} [properties] Properties to set + */ + function Database(properties) { + this.tags = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Database name. + * @member {string} name + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.name = ""; + + /** + * Database uid. + * @member {string} uid + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.uid = ""; + + /** + * Database createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.createTime = null; + + /** + * Database updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.updateTime = null; + + /** + * Database deleteTime. + * @member {google.protobuf.ITimestamp|null|undefined} deleteTime + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.deleteTime = null; + + /** + * Database locationId. + * @member {string} locationId + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.locationId = ""; + + /** + * Database type. + * @member {google.firestore.admin.v1.Database.DatabaseType} type + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.type = 0; + + /** + * Database concurrencyMode. + * @member {google.firestore.admin.v1.Database.ConcurrencyMode} concurrencyMode + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.concurrencyMode = 0; + + /** + * Database versionRetentionPeriod. + * @member {google.protobuf.IDuration|null|undefined} versionRetentionPeriod + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.versionRetentionPeriod = null; + + /** + * Database earliestVersionTime. + * @member {google.protobuf.ITimestamp|null|undefined} earliestVersionTime + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.earliestVersionTime = null; + + /** + * Database pointInTimeRecoveryEnablement. + * @member {google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement} pointInTimeRecoveryEnablement + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.pointInTimeRecoveryEnablement = 0; + + /** + * Database appEngineIntegrationMode. + * @member {google.firestore.admin.v1.Database.AppEngineIntegrationMode} appEngineIntegrationMode + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.appEngineIntegrationMode = 0; + + /** + * Database keyPrefix. + * @member {string} keyPrefix + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.keyPrefix = ""; + + /** + * Database deleteProtectionState. + * @member {google.firestore.admin.v1.Database.DeleteProtectionState} deleteProtectionState + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.deleteProtectionState = 0; + + /** + * Database cmekConfig. + * @member {google.firestore.admin.v1.Database.ICmekConfig|null|undefined} cmekConfig + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.cmekConfig = null; + + /** + * Database previousId. + * @member {string} previousId + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.previousId = ""; + + /** + * Database sourceInfo. + * @member {google.firestore.admin.v1.Database.ISourceInfo|null|undefined} sourceInfo + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.sourceInfo = null; + + /** + * Database tags. + * @member {Object.} tags + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.tags = $util.emptyObject; + + /** + * Database freeTier. + * @member {boolean|null|undefined} freeTier + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.freeTier = null; + + /** + * Database etag. + * @member {string} etag + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.etag = ""; + + /** + * Database databaseEdition. + * @member {google.firestore.admin.v1.Database.DatabaseEdition} databaseEdition + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.databaseEdition = 0; + + /** + * Database realtimeUpdatesMode. + * @member {google.firestore.admin.v1.RealtimeUpdatesMode} realtimeUpdatesMode + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.realtimeUpdatesMode = 0; + + /** + * Database firestoreDataAccessMode. + * @member {google.firestore.admin.v1.Database.DataAccessMode} firestoreDataAccessMode + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.firestoreDataAccessMode = 0; + + /** + * Database mongodbCompatibleDataAccessMode. + * @member {google.firestore.admin.v1.Database.DataAccessMode} mongodbCompatibleDataAccessMode + * @memberof google.firestore.admin.v1.Database + * @instance + */ + Database.prototype.mongodbCompatibleDataAccessMode = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Database.prototype, "_freeTier", { + get: $util.oneOfGetter($oneOfFields = ["freeTier"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Database instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Database + * @static + * @param {google.firestore.admin.v1.IDatabase=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Database} Database instance + */ + Database.create = function create(properties) { + return new Database(properties); + }; + + /** + * Encodes the specified Database message. Does not implicitly {@link google.firestore.admin.v1.Database.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Database + * @static + * @param {google.firestore.admin.v1.IDatabase} message Database message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Database.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.uid != null && Object.hasOwnProperty.call(message, "uid")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.uid); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.deleteTime != null && Object.hasOwnProperty.call(message, "deleteTime")) + $root.google.protobuf.Timestamp.encode(message.deleteTime, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.locationId != null && Object.hasOwnProperty.call(message, "locationId")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.locationId); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.type); + if (message.concurrencyMode != null && Object.hasOwnProperty.call(message, "concurrencyMode")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.concurrencyMode); + if (message.versionRetentionPeriod != null && Object.hasOwnProperty.call(message, "versionRetentionPeriod")) + $root.google.protobuf.Duration.encode(message.versionRetentionPeriod, writer.uint32(/* id 17, wireType 2 =*/138).fork(), q + 1).ldelim(); + if (message.earliestVersionTime != null && Object.hasOwnProperty.call(message, "earliestVersionTime")) + $root.google.protobuf.Timestamp.encode(message.earliestVersionTime, writer.uint32(/* id 18, wireType 2 =*/146).fork(), q + 1).ldelim(); + if (message.appEngineIntegrationMode != null && Object.hasOwnProperty.call(message, "appEngineIntegrationMode")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.appEngineIntegrationMode); + if (message.keyPrefix != null && Object.hasOwnProperty.call(message, "keyPrefix")) + writer.uint32(/* id 20, wireType 2 =*/162).string(message.keyPrefix); + if (message.pointInTimeRecoveryEnablement != null && Object.hasOwnProperty.call(message, "pointInTimeRecoveryEnablement")) + writer.uint32(/* id 21, wireType 0 =*/168).int32(message.pointInTimeRecoveryEnablement); + if (message.deleteProtectionState != null && Object.hasOwnProperty.call(message, "deleteProtectionState")) + writer.uint32(/* id 22, wireType 0 =*/176).int32(message.deleteProtectionState); + if (message.cmekConfig != null && Object.hasOwnProperty.call(message, "cmekConfig")) + $root.google.firestore.admin.v1.Database.CmekConfig.encode(message.cmekConfig, writer.uint32(/* id 23, wireType 2 =*/186).fork(), q + 1).ldelim(); + if (message.previousId != null && Object.hasOwnProperty.call(message, "previousId")) + writer.uint32(/* id 25, wireType 2 =*/202).string(message.previousId); + if (message.sourceInfo != null && Object.hasOwnProperty.call(message, "sourceInfo")) + $root.google.firestore.admin.v1.Database.SourceInfo.encode(message.sourceInfo, writer.uint32(/* id 26, wireType 2 =*/210).fork(), q + 1).ldelim(); + if (message.databaseEdition != null && Object.hasOwnProperty.call(message, "databaseEdition")) + writer.uint32(/* id 28, wireType 0 =*/224).int32(message.databaseEdition); + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) + for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) + writer.uint32(/* id 29, wireType 2 =*/234).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); + if (message.freeTier != null && Object.hasOwnProperty.call(message, "freeTier")) + writer.uint32(/* id 30, wireType 0 =*/240).bool(message.freeTier); + if (message.realtimeUpdatesMode != null && Object.hasOwnProperty.call(message, "realtimeUpdatesMode")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.realtimeUpdatesMode); + if (message.firestoreDataAccessMode != null && Object.hasOwnProperty.call(message, "firestoreDataAccessMode")) + writer.uint32(/* id 33, wireType 0 =*/264).int32(message.firestoreDataAccessMode); + if (message.mongodbCompatibleDataAccessMode != null && Object.hasOwnProperty.call(message, "mongodbCompatibleDataAccessMode")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.mongodbCompatibleDataAccessMode); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 99, wireType 2 =*/794).string(message.etag); + return writer; + }; + + /** + * Encodes the specified Database message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Database + * @static + * @param {google.firestore.admin.v1.IDatabase} message Database message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Database.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Database message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Database + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Database} Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Database.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Database(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.uid = reader.string(); + break; + } + case 5: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.deleteTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 9: { + message.locationId = reader.string(); + break; + } + case 10: { + message.type = reader.int32(); + break; + } + case 15: { + message.concurrencyMode = reader.int32(); + break; + } + case 17: { + message.versionRetentionPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 18: { + message.earliestVersionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 21: { + message.pointInTimeRecoveryEnablement = reader.int32(); + break; + } + case 19: { + message.appEngineIntegrationMode = reader.int32(); + break; + } + case 20: { + message.keyPrefix = reader.string(); + break; + } + case 22: { + message.deleteProtectionState = reader.int32(); + break; + } + case 23: { + message.cmekConfig = $root.google.firestore.admin.v1.Database.CmekConfig.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 25: { + message.previousId = reader.string(); + break; + } + case 26: { + message.sourceInfo = $root.google.firestore.admin.v1.Database.SourceInfo.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 29: { + if (message.tags === $util.emptyObject) + message.tags = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.tags, key); + message.tags[key] = value; + break; + } + case 30: { + message.freeTier = reader.bool(); + break; + } + case 99: { + message.etag = reader.string(); + break; + } + case 28: { + message.databaseEdition = reader.int32(); + break; + } + case 31: { + message.realtimeUpdatesMode = reader.int32(); + break; + } + case 33: { + message.firestoreDataAccessMode = reader.int32(); + break; + } + case 34: { + message.mongodbCompatibleDataAccessMode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Database message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Database + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Database} Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Database.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Database message. + * @function verify + * @memberof google.firestore.admin.v1.Database + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Database.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.uid != null && Object.hasOwnProperty.call(message, "uid")) + if (!$util.isString(message.uid)) + return "uid: string expected"; + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime, long + 1); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime, long + 1); + if (error) + return "updateTime." + error; + } + if (message.deleteTime != null && Object.hasOwnProperty.call(message, "deleteTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.deleteTime, long + 1); + if (error) + return "deleteTime." + error; + } + if (message.locationId != null && Object.hasOwnProperty.call(message, "locationId")) + if (!$util.isString(message.locationId)) + return "locationId: string expected"; + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.concurrencyMode != null && Object.hasOwnProperty.call(message, "concurrencyMode")) + switch (message.concurrencyMode) { + default: + return "concurrencyMode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.versionRetentionPeriod != null && Object.hasOwnProperty.call(message, "versionRetentionPeriod")) { + var error = $root.google.protobuf.Duration.verify(message.versionRetentionPeriod, long + 1); + if (error) + return "versionRetentionPeriod." + error; + } + if (message.earliestVersionTime != null && Object.hasOwnProperty.call(message, "earliestVersionTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.earliestVersionTime, long + 1); + if (error) + return "earliestVersionTime." + error; + } + if (message.pointInTimeRecoveryEnablement != null && Object.hasOwnProperty.call(message, "pointInTimeRecoveryEnablement")) + switch (message.pointInTimeRecoveryEnablement) { + default: + return "pointInTimeRecoveryEnablement: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.appEngineIntegrationMode != null && Object.hasOwnProperty.call(message, "appEngineIntegrationMode")) + switch (message.appEngineIntegrationMode) { + default: + return "appEngineIntegrationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.keyPrefix != null && Object.hasOwnProperty.call(message, "keyPrefix")) + if (!$util.isString(message.keyPrefix)) + return "keyPrefix: string expected"; + if (message.deleteProtectionState != null && Object.hasOwnProperty.call(message, "deleteProtectionState")) + switch (message.deleteProtectionState) { + default: + return "deleteProtectionState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.cmekConfig != null && Object.hasOwnProperty.call(message, "cmekConfig")) { + var error = $root.google.firestore.admin.v1.Database.CmekConfig.verify(message.cmekConfig, long + 1); + if (error) + return "cmekConfig." + error; + } + if (message.previousId != null && Object.hasOwnProperty.call(message, "previousId")) + if (!$util.isString(message.previousId)) + return "previousId: string expected"; + if (message.sourceInfo != null && Object.hasOwnProperty.call(message, "sourceInfo")) { + var error = $root.google.firestore.admin.v1.Database.SourceInfo.verify(message.sourceInfo, long + 1); + if (error) + return "sourceInfo." + error; + } + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) { + if (!$util.isObject(message.tags)) + return "tags: object expected"; + var key = Object.keys(message.tags); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.tags[key[i]])) + return "tags: string{k:string} expected"; + } + if (message.freeTier != null && Object.hasOwnProperty.call(message, "freeTier")) { + properties._freeTier = 1; + if (typeof message.freeTier !== "boolean") + return "freeTier: boolean expected"; + } + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + if (message.databaseEdition != null && Object.hasOwnProperty.call(message, "databaseEdition")) + switch (message.databaseEdition) { + default: + return "databaseEdition: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.realtimeUpdatesMode != null && Object.hasOwnProperty.call(message, "realtimeUpdatesMode")) + switch (message.realtimeUpdatesMode) { + default: + return "realtimeUpdatesMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.firestoreDataAccessMode != null && Object.hasOwnProperty.call(message, "firestoreDataAccessMode")) + switch (message.firestoreDataAccessMode) { + default: + return "firestoreDataAccessMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.mongodbCompatibleDataAccessMode != null && Object.hasOwnProperty.call(message, "mongodbCompatibleDataAccessMode")) + switch (message.mongodbCompatibleDataAccessMode) { + default: + return "mongodbCompatibleDataAccessMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a Database message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Database + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Database} Database + */ + Database.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Database) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Database: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Database(); + if (object.name != null) + message.name = String(object.name); + if (object.uid != null) + message.uid = String(object.uid); + if (object.createTime != null) { + if (!$util.isObject(object.createTime)) + throw TypeError(".google.firestore.admin.v1.Database.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime, long + 1); + } + if (object.updateTime != null) { + if (!$util.isObject(object.updateTime)) + throw TypeError(".google.firestore.admin.v1.Database.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime, long + 1); + } + if (object.deleteTime != null) { + if (!$util.isObject(object.deleteTime)) + throw TypeError(".google.firestore.admin.v1.Database.deleteTime: object expected"); + message.deleteTime = $root.google.protobuf.Timestamp.fromObject(object.deleteTime, long + 1); + } + if (object.locationId != null) + message.locationId = String(object.locationId); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "DATABASE_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "FIRESTORE_NATIVE": + case 1: + message.type = 1; + break; + case "DATASTORE_MODE": + case 2: + message.type = 2; + break; + } + switch (object.concurrencyMode) { + default: + if (typeof object.concurrencyMode === "number") { + message.concurrencyMode = object.concurrencyMode; + break; + } + break; + case "CONCURRENCY_MODE_UNSPECIFIED": + case 0: + message.concurrencyMode = 0; + break; + case "OPTIMISTIC": + case 1: + message.concurrencyMode = 1; + break; + case "PESSIMISTIC": + case 2: + message.concurrencyMode = 2; + break; + case "OPTIMISTIC_WITH_ENTITY_GROUPS": + case 3: + message.concurrencyMode = 3; + break; + } + if (object.versionRetentionPeriod != null) { + if (!$util.isObject(object.versionRetentionPeriod)) + throw TypeError(".google.firestore.admin.v1.Database.versionRetentionPeriod: object expected"); + message.versionRetentionPeriod = $root.google.protobuf.Duration.fromObject(object.versionRetentionPeriod, long + 1); + } + if (object.earliestVersionTime != null) { + if (!$util.isObject(object.earliestVersionTime)) + throw TypeError(".google.firestore.admin.v1.Database.earliestVersionTime: object expected"); + message.earliestVersionTime = $root.google.protobuf.Timestamp.fromObject(object.earliestVersionTime, long + 1); + } + switch (object.pointInTimeRecoveryEnablement) { + default: + if (typeof object.pointInTimeRecoveryEnablement === "number") { + message.pointInTimeRecoveryEnablement = object.pointInTimeRecoveryEnablement; + break; + } + break; + case "POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED": + case 0: + message.pointInTimeRecoveryEnablement = 0; + break; + case "POINT_IN_TIME_RECOVERY_ENABLED": + case 1: + message.pointInTimeRecoveryEnablement = 1; + break; + case "POINT_IN_TIME_RECOVERY_DISABLED": + case 2: + message.pointInTimeRecoveryEnablement = 2; + break; + } + switch (object.appEngineIntegrationMode) { + default: + if (typeof object.appEngineIntegrationMode === "number") { + message.appEngineIntegrationMode = object.appEngineIntegrationMode; + break; + } + break; + case "APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED": + case 0: + message.appEngineIntegrationMode = 0; + break; + case "ENABLED": + case 1: + message.appEngineIntegrationMode = 1; + break; + case "DISABLED": + case 2: + message.appEngineIntegrationMode = 2; + break; + } + if (object.keyPrefix != null) + message.keyPrefix = String(object.keyPrefix); + switch (object.deleteProtectionState) { + default: + if (typeof object.deleteProtectionState === "number") { + message.deleteProtectionState = object.deleteProtectionState; + break; + } + break; + case "DELETE_PROTECTION_STATE_UNSPECIFIED": + case 0: + message.deleteProtectionState = 0; + break; + case "DELETE_PROTECTION_DISABLED": + case 1: + message.deleteProtectionState = 1; + break; + case "DELETE_PROTECTION_ENABLED": + case 2: + message.deleteProtectionState = 2; + break; + } + if (object.cmekConfig != null) { + if (!$util.isObject(object.cmekConfig)) + throw TypeError(".google.firestore.admin.v1.Database.cmekConfig: object expected"); + message.cmekConfig = $root.google.firestore.admin.v1.Database.CmekConfig.fromObject(object.cmekConfig, long + 1); + } + if (object.previousId != null) + message.previousId = String(object.previousId); + if (object.sourceInfo != null) { + if (!$util.isObject(object.sourceInfo)) + throw TypeError(".google.firestore.admin.v1.Database.sourceInfo: object expected"); + message.sourceInfo = $root.google.firestore.admin.v1.Database.SourceInfo.fromObject(object.sourceInfo, long + 1); + } + if (object.tags) { + if (!$util.isObject(object.tags)) + throw TypeError(".google.firestore.admin.v1.Database.tags: object expected"); + message.tags = {}; + for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.tags, keys[i]); + message.tags[keys[i]] = String(object.tags[keys[i]]); + } + } + if (object.freeTier != null) + message.freeTier = Boolean(object.freeTier); + if (object.etag != null) + message.etag = String(object.etag); + switch (object.databaseEdition) { + default: + if (typeof object.databaseEdition === "number") { + message.databaseEdition = object.databaseEdition; + break; + } + break; + case "DATABASE_EDITION_UNSPECIFIED": + case 0: + message.databaseEdition = 0; + break; + case "STANDARD": + case 1: + message.databaseEdition = 1; + break; + case "ENTERPRISE": + case 2: + message.databaseEdition = 2; + break; + } + switch (object.realtimeUpdatesMode) { + default: + if (typeof object.realtimeUpdatesMode === "number") { + message.realtimeUpdatesMode = object.realtimeUpdatesMode; + break; + } + break; + case "REALTIME_UPDATES_MODE_UNSPECIFIED": + case 0: + message.realtimeUpdatesMode = 0; + break; + case "REALTIME_UPDATES_MODE_ENABLED": + case 1: + message.realtimeUpdatesMode = 1; + break; + case "REALTIME_UPDATES_MODE_DISABLED": + case 2: + message.realtimeUpdatesMode = 2; + break; + } + switch (object.firestoreDataAccessMode) { + default: + if (typeof object.firestoreDataAccessMode === "number") { + message.firestoreDataAccessMode = object.firestoreDataAccessMode; + break; + } + break; + case "DATA_ACCESS_MODE_UNSPECIFIED": + case 0: + message.firestoreDataAccessMode = 0; + break; + case "DATA_ACCESS_MODE_ENABLED": + case 1: + message.firestoreDataAccessMode = 1; + break; + case "DATA_ACCESS_MODE_DISABLED": + case 2: + message.firestoreDataAccessMode = 2; + break; + } + switch (object.mongodbCompatibleDataAccessMode) { + default: + if (typeof object.mongodbCompatibleDataAccessMode === "number") { + message.mongodbCompatibleDataAccessMode = object.mongodbCompatibleDataAccessMode; + break; + } + break; + case "DATA_ACCESS_MODE_UNSPECIFIED": + case 0: + message.mongodbCompatibleDataAccessMode = 0; + break; + case "DATA_ACCESS_MODE_ENABLED": + case 1: + message.mongodbCompatibleDataAccessMode = 1; + break; + case "DATA_ACCESS_MODE_DISABLED": + case 2: + message.mongodbCompatibleDataAccessMode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a Database message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Database + * @static + * @param {google.firestore.admin.v1.Database} message Database + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Database.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.tags = {}; + if (options.defaults) { + object.name = ""; + object.uid = ""; + object.createTime = null; + object.updateTime = null; + object.deleteTime = null; + object.locationId = ""; + object.type = options.enums === String ? "DATABASE_TYPE_UNSPECIFIED" : 0; + object.concurrencyMode = options.enums === String ? "CONCURRENCY_MODE_UNSPECIFIED" : 0; + object.versionRetentionPeriod = null; + object.earliestVersionTime = null; + object.appEngineIntegrationMode = options.enums === String ? "APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED" : 0; + object.keyPrefix = ""; + object.pointInTimeRecoveryEnablement = options.enums === String ? "POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED" : 0; + object.deleteProtectionState = options.enums === String ? "DELETE_PROTECTION_STATE_UNSPECIFIED" : 0; + object.cmekConfig = null; + object.previousId = ""; + object.sourceInfo = null; + object.databaseEdition = options.enums === String ? "DATABASE_EDITION_UNSPECIFIED" : 0; + object.realtimeUpdatesMode = options.enums === String ? "REALTIME_UPDATES_MODE_UNSPECIFIED" : 0; + object.firestoreDataAccessMode = options.enums === String ? "DATA_ACCESS_MODE_UNSPECIFIED" : 0; + object.mongodbCompatibleDataAccessMode = options.enums === String ? "DATA_ACCESS_MODE_UNSPECIFIED" : 0; + object.etag = ""; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.uid != null && Object.hasOwnProperty.call(message, "uid")) + object.uid = message.uid; + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options, q + 1); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options, q + 1); + if (message.deleteTime != null && Object.hasOwnProperty.call(message, "deleteTime")) + object.deleteTime = $root.google.protobuf.Timestamp.toObject(message.deleteTime, options, q + 1); + if (message.locationId != null && Object.hasOwnProperty.call(message, "locationId")) + object.locationId = message.locationId; + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + object.type = options.enums === String ? $root.google.firestore.admin.v1.Database.DatabaseType[message.type] === undefined ? message.type : $root.google.firestore.admin.v1.Database.DatabaseType[message.type] : message.type; + if (message.concurrencyMode != null && Object.hasOwnProperty.call(message, "concurrencyMode")) + object.concurrencyMode = options.enums === String ? $root.google.firestore.admin.v1.Database.ConcurrencyMode[message.concurrencyMode] === undefined ? message.concurrencyMode : $root.google.firestore.admin.v1.Database.ConcurrencyMode[message.concurrencyMode] : message.concurrencyMode; + if (message.versionRetentionPeriod != null && Object.hasOwnProperty.call(message, "versionRetentionPeriod")) + object.versionRetentionPeriod = $root.google.protobuf.Duration.toObject(message.versionRetentionPeriod, options, q + 1); + if (message.earliestVersionTime != null && Object.hasOwnProperty.call(message, "earliestVersionTime")) + object.earliestVersionTime = $root.google.protobuf.Timestamp.toObject(message.earliestVersionTime, options, q + 1); + if (message.appEngineIntegrationMode != null && Object.hasOwnProperty.call(message, "appEngineIntegrationMode")) + object.appEngineIntegrationMode = options.enums === String ? $root.google.firestore.admin.v1.Database.AppEngineIntegrationMode[message.appEngineIntegrationMode] === undefined ? message.appEngineIntegrationMode : $root.google.firestore.admin.v1.Database.AppEngineIntegrationMode[message.appEngineIntegrationMode] : message.appEngineIntegrationMode; + if (message.keyPrefix != null && Object.hasOwnProperty.call(message, "keyPrefix")) + object.keyPrefix = message.keyPrefix; + if (message.pointInTimeRecoveryEnablement != null && Object.hasOwnProperty.call(message, "pointInTimeRecoveryEnablement")) + object.pointInTimeRecoveryEnablement = options.enums === String ? $root.google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement[message.pointInTimeRecoveryEnablement] === undefined ? message.pointInTimeRecoveryEnablement : $root.google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement[message.pointInTimeRecoveryEnablement] : message.pointInTimeRecoveryEnablement; + if (message.deleteProtectionState != null && Object.hasOwnProperty.call(message, "deleteProtectionState")) + object.deleteProtectionState = options.enums === String ? $root.google.firestore.admin.v1.Database.DeleteProtectionState[message.deleteProtectionState] === undefined ? message.deleteProtectionState : $root.google.firestore.admin.v1.Database.DeleteProtectionState[message.deleteProtectionState] : message.deleteProtectionState; + if (message.cmekConfig != null && Object.hasOwnProperty.call(message, "cmekConfig")) + object.cmekConfig = $root.google.firestore.admin.v1.Database.CmekConfig.toObject(message.cmekConfig, options, q + 1); + if (message.previousId != null && Object.hasOwnProperty.call(message, "previousId")) + object.previousId = message.previousId; + if (message.sourceInfo != null && Object.hasOwnProperty.call(message, "sourceInfo")) + object.sourceInfo = $root.google.firestore.admin.v1.Database.SourceInfo.toObject(message.sourceInfo, options, q + 1); + if (message.databaseEdition != null && Object.hasOwnProperty.call(message, "databaseEdition")) + object.databaseEdition = options.enums === String ? $root.google.firestore.admin.v1.Database.DatabaseEdition[message.databaseEdition] === undefined ? message.databaseEdition : $root.google.firestore.admin.v1.Database.DatabaseEdition[message.databaseEdition] : message.databaseEdition; + var keys2; + if (message.tags && (keys2 = Object.keys(message.tags)).length) { + object.tags = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.tags, keys2[j]); + object.tags[keys2[j]] = message.tags[keys2[j]]; + } + } + if (message.freeTier != null && Object.hasOwnProperty.call(message, "freeTier")) { + object.freeTier = message.freeTier; + if (options.oneofs) + object._freeTier = "freeTier"; + } + if (message.realtimeUpdatesMode != null && Object.hasOwnProperty.call(message, "realtimeUpdatesMode")) + object.realtimeUpdatesMode = options.enums === String ? $root.google.firestore.admin.v1.RealtimeUpdatesMode[message.realtimeUpdatesMode] === undefined ? message.realtimeUpdatesMode : $root.google.firestore.admin.v1.RealtimeUpdatesMode[message.realtimeUpdatesMode] : message.realtimeUpdatesMode; + if (message.firestoreDataAccessMode != null && Object.hasOwnProperty.call(message, "firestoreDataAccessMode")) + object.firestoreDataAccessMode = options.enums === String ? $root.google.firestore.admin.v1.Database.DataAccessMode[message.firestoreDataAccessMode] === undefined ? message.firestoreDataAccessMode : $root.google.firestore.admin.v1.Database.DataAccessMode[message.firestoreDataAccessMode] : message.firestoreDataAccessMode; + if (message.mongodbCompatibleDataAccessMode != null && Object.hasOwnProperty.call(message, "mongodbCompatibleDataAccessMode")) + object.mongodbCompatibleDataAccessMode = options.enums === String ? $root.google.firestore.admin.v1.Database.DataAccessMode[message.mongodbCompatibleDataAccessMode] === undefined ? message.mongodbCompatibleDataAccessMode : $root.google.firestore.admin.v1.Database.DataAccessMode[message.mongodbCompatibleDataAccessMode] : message.mongodbCompatibleDataAccessMode; + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + object.etag = message.etag; + return object; + }; + + /** + * Converts this Database to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Database + * @instance + * @returns {Object.} JSON object + */ + Database.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Database + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Database + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Database.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Database"; + }; + + /** + * DatabaseType enum. + * @name google.firestore.admin.v1.Database.DatabaseType + * @enum {number} + * @property {number} DATABASE_TYPE_UNSPECIFIED=0 DATABASE_TYPE_UNSPECIFIED value + * @property {number} FIRESTORE_NATIVE=1 FIRESTORE_NATIVE value + * @property {number} DATASTORE_MODE=2 DATASTORE_MODE value + */ + Database.DatabaseType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DATABASE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FIRESTORE_NATIVE"] = 1; + values[valuesById[2] = "DATASTORE_MODE"] = 2; + return values; + })(); + + /** + * ConcurrencyMode enum. + * @name google.firestore.admin.v1.Database.ConcurrencyMode + * @enum {number} + * @property {number} CONCURRENCY_MODE_UNSPECIFIED=0 CONCURRENCY_MODE_UNSPECIFIED value + * @property {number} OPTIMISTIC=1 OPTIMISTIC value + * @property {number} PESSIMISTIC=2 PESSIMISTIC value + * @property {number} OPTIMISTIC_WITH_ENTITY_GROUPS=3 OPTIMISTIC_WITH_ENTITY_GROUPS value + */ + Database.ConcurrencyMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONCURRENCY_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIMISTIC"] = 1; + values[valuesById[2] = "PESSIMISTIC"] = 2; + values[valuesById[3] = "OPTIMISTIC_WITH_ENTITY_GROUPS"] = 3; + return values; + })(); + + /** + * PointInTimeRecoveryEnablement enum. + * @name google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement + * @enum {number} + * @property {number} POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED=0 POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED value + * @property {number} POINT_IN_TIME_RECOVERY_ENABLED=1 POINT_IN_TIME_RECOVERY_ENABLED value + * @property {number} POINT_IN_TIME_RECOVERY_DISABLED=2 POINT_IN_TIME_RECOVERY_DISABLED value + */ + Database.PointInTimeRecoveryEnablement = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "POINT_IN_TIME_RECOVERY_ENABLED"] = 1; + values[valuesById[2] = "POINT_IN_TIME_RECOVERY_DISABLED"] = 2; + return values; + })(); + + /** + * AppEngineIntegrationMode enum. + * @name google.firestore.admin.v1.Database.AppEngineIntegrationMode + * @enum {number} + * @property {number} APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED=0 APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED value + * @property {number} ENABLED=1 ENABLED value + * @property {number} DISABLED=2 DISABLED value + */ + Database.AppEngineIntegrationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENABLED"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + return values; + })(); + + /** + * DeleteProtectionState enum. + * @name google.firestore.admin.v1.Database.DeleteProtectionState + * @enum {number} + * @property {number} DELETE_PROTECTION_STATE_UNSPECIFIED=0 DELETE_PROTECTION_STATE_UNSPECIFIED value + * @property {number} DELETE_PROTECTION_DISABLED=1 DELETE_PROTECTION_DISABLED value + * @property {number} DELETE_PROTECTION_ENABLED=2 DELETE_PROTECTION_ENABLED value + */ + Database.DeleteProtectionState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DELETE_PROTECTION_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DELETE_PROTECTION_DISABLED"] = 1; + values[valuesById[2] = "DELETE_PROTECTION_ENABLED"] = 2; + return values; + })(); + + Database.CmekConfig = (function() { + + /** + * Properties of a CmekConfig. + * @memberof google.firestore.admin.v1.Database + * @interface ICmekConfig + * @property {string|null} [kmsKeyName] CmekConfig kmsKeyName + * @property {Array.|null} [activeKeyVersion] CmekConfig activeKeyVersion + */ + + /** + * Constructs a new CmekConfig. + * @memberof google.firestore.admin.v1.Database + * @classdesc Represents a CmekConfig. + * @implements ICmekConfig + * @constructor + * @param {google.firestore.admin.v1.Database.ICmekConfig=} [properties] Properties to set + */ + function CmekConfig(properties) { + this.activeKeyVersion = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CmekConfig kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @instance + */ + CmekConfig.prototype.kmsKeyName = ""; + + /** + * CmekConfig activeKeyVersion. + * @member {Array.} activeKeyVersion + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @instance + */ + CmekConfig.prototype.activeKeyVersion = $util.emptyArray; + + /** + * Creates a new CmekConfig instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @static + * @param {google.firestore.admin.v1.Database.ICmekConfig=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Database.CmekConfig} CmekConfig instance + */ + CmekConfig.create = function create(properties) { + return new CmekConfig(properties); + }; + + /** + * Encodes the specified CmekConfig message. Does not implicitly {@link google.firestore.admin.v1.Database.CmekConfig.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @static + * @param {google.firestore.admin.v1.Database.ICmekConfig} message CmekConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CmekConfig.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyName); + if (message.activeKeyVersion != null && message.activeKeyVersion.length) + for (var i = 0; i < message.activeKeyVersion.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.activeKeyVersion[i]); + return writer; + }; + + /** + * Encodes the specified CmekConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.CmekConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @static + * @param {google.firestore.admin.v1.Database.ICmekConfig} message CmekConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CmekConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CmekConfig message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Database.CmekConfig} CmekConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CmekConfig.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Database.CmekConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kmsKeyName = reader.string(); + break; + } + case 2: { + if (!(message.activeKeyVersion && message.activeKeyVersion.length)) + message.activeKeyVersion = []; + message.activeKeyVersion.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CmekConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Database.CmekConfig} CmekConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CmekConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CmekConfig message. + * @function verify + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CmekConfig.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + if (message.activeKeyVersion != null && Object.hasOwnProperty.call(message, "activeKeyVersion")) { + if (!Array.isArray(message.activeKeyVersion)) + return "activeKeyVersion: array expected"; + for (var i = 0; i < message.activeKeyVersion.length; ++i) + if (!$util.isString(message.activeKeyVersion[i])) + return "activeKeyVersion: string[] expected"; + } + return null; + }; + + /** + * Creates a CmekConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Database.CmekConfig} CmekConfig + */ + CmekConfig.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Database.CmekConfig) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Database.CmekConfig: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Database.CmekConfig(); + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.activeKeyVersion) { + if (!Array.isArray(object.activeKeyVersion)) + throw TypeError(".google.firestore.admin.v1.Database.CmekConfig.activeKeyVersion: array expected"); + message.activeKeyVersion = []; + for (var i = 0; i < object.activeKeyVersion.length; ++i) + message.activeKeyVersion[i] = String(object.activeKeyVersion[i]); + } + return message; + }; + + /** + * Creates a plain object from a CmekConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @static + * @param {google.firestore.admin.v1.Database.CmekConfig} message CmekConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CmekConfig.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.activeKeyVersion = []; + if (options.defaults) + object.kmsKeyName = ""; + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.activeKeyVersion && message.activeKeyVersion.length) { + object.activeKeyVersion = []; + for (var j = 0; j < message.activeKeyVersion.length; ++j) + object.activeKeyVersion[j] = message.activeKeyVersion[j]; + } + return object; + }; + + /** + * Converts this CmekConfig to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @instance + * @returns {Object.} JSON object + */ + CmekConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CmekConfig + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Database.CmekConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CmekConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Database.CmekConfig"; + }; + + return CmekConfig; + })(); + + Database.SourceInfo = (function() { + + /** + * Properties of a SourceInfo. + * @memberof google.firestore.admin.v1.Database + * @interface ISourceInfo + * @property {google.firestore.admin.v1.Database.SourceInfo.IBackupSource|null} [backup] SourceInfo backup + * @property {string|null} [operation] SourceInfo operation + */ + + /** + * Constructs a new SourceInfo. + * @memberof google.firestore.admin.v1.Database + * @classdesc Represents a SourceInfo. + * @implements ISourceInfo + * @constructor + * @param {google.firestore.admin.v1.Database.ISourceInfo=} [properties] Properties to set + */ + function SourceInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceInfo backup. + * @member {google.firestore.admin.v1.Database.SourceInfo.IBackupSource|null|undefined} backup + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @instance + */ + SourceInfo.prototype.backup = null; + + /** + * SourceInfo operation. + * @member {string} operation + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @instance + */ + SourceInfo.prototype.operation = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SourceInfo source. + * @member {"backup"|undefined} source + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @instance + */ + Object.defineProperty(SourceInfo.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["backup"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SourceInfo instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @static + * @param {google.firestore.admin.v1.Database.ISourceInfo=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Database.SourceInfo} SourceInfo instance + */ + SourceInfo.create = function create(properties) { + return new SourceInfo(properties); + }; + + /** + * Encodes the specified SourceInfo message. Does not implicitly {@link google.firestore.admin.v1.Database.SourceInfo.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @static + * @param {google.firestore.admin.v1.Database.ISourceInfo} message SourceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceInfo.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + $root.google.firestore.admin.v1.Database.SourceInfo.BackupSource.encode(message.backup, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.operation); + return writer; + }; + + /** + * Encodes the specified SourceInfo message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.SourceInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @static + * @param {google.firestore.admin.v1.Database.ISourceInfo} message SourceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a SourceInfo message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Database.SourceInfo} SourceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceInfo.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Database.SourceInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backup = $root.google.firestore.admin.v1.Database.SourceInfo.BackupSource.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.operation = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a SourceInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Database.SourceInfo} SourceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceInfo message. + * @function verify + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceInfo.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) { + properties.source = 1; + { + var error = $root.google.firestore.admin.v1.Database.SourceInfo.BackupSource.verify(message.backup, long + 1); + if (error) + return "backup." + error; + } + } + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + if (!$util.isString(message.operation)) + return "operation: string expected"; + return null; + }; + + /** + * Creates a SourceInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Database.SourceInfo} SourceInfo + */ + SourceInfo.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Database.SourceInfo) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Database.SourceInfo: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Database.SourceInfo(); + if (object.backup != null) { + if (!$util.isObject(object.backup)) + throw TypeError(".google.firestore.admin.v1.Database.SourceInfo.backup: object expected"); + message.backup = $root.google.firestore.admin.v1.Database.SourceInfo.BackupSource.fromObject(object.backup, long + 1); + } + if (object.operation != null) + message.operation = String(object.operation); + return message; + }; + + /** + * Creates a plain object from a SourceInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @static + * @param {google.firestore.admin.v1.Database.SourceInfo} message SourceInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceInfo.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.operation = ""; + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) { + object.backup = $root.google.firestore.admin.v1.Database.SourceInfo.BackupSource.toObject(message.backup, options, q + 1); + if (options.oneofs) + object.source = "backup"; + } + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + object.operation = message.operation; + return object; + }; + + /** + * Converts this SourceInfo to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @instance + * @returns {Object.} JSON object + */ + SourceInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SourceInfo + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Database.SourceInfo"; + }; + + SourceInfo.BackupSource = (function() { + + /** + * Properties of a BackupSource. + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @interface IBackupSource + * @property {string|null} [backup] BackupSource backup + */ + + /** + * Constructs a new BackupSource. + * @memberof google.firestore.admin.v1.Database.SourceInfo + * @classdesc Represents a BackupSource. + * @implements IBackupSource + * @constructor + * @param {google.firestore.admin.v1.Database.SourceInfo.IBackupSource=} [properties] Properties to set + */ + function BackupSource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupSource backup. + * @member {string} backup + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @instance + */ + BackupSource.prototype.backup = ""; + + /** + * Creates a new BackupSource instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @static + * @param {google.firestore.admin.v1.Database.SourceInfo.IBackupSource=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Database.SourceInfo.BackupSource} BackupSource instance + */ + BackupSource.create = function create(properties) { + return new BackupSource(properties); + }; + + /** + * Encodes the specified BackupSource message. Does not implicitly {@link google.firestore.admin.v1.Database.SourceInfo.BackupSource.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @static + * @param {google.firestore.admin.v1.Database.SourceInfo.IBackupSource} message BackupSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupSource.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.backup); + return writer; + }; + + /** + * Encodes the specified BackupSource message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.SourceInfo.BackupSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @static + * @param {google.firestore.admin.v1.Database.SourceInfo.IBackupSource} message BackupSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BackupSource message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Database.SourceInfo.BackupSource} BackupSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupSource.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Database.SourceInfo.BackupSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backup = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BackupSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Database.SourceInfo.BackupSource} BackupSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupSource message. + * @function verify + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupSource.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + if (!$util.isString(message.backup)) + return "backup: string expected"; + return null; + }; + + /** + * Creates a BackupSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Database.SourceInfo.BackupSource} BackupSource + */ + BackupSource.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Database.SourceInfo.BackupSource) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Database.SourceInfo.BackupSource: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Database.SourceInfo.BackupSource(); + if (object.backup != null) + message.backup = String(object.backup); + return message; + }; + + /** + * Creates a plain object from a BackupSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @static + * @param {google.firestore.admin.v1.Database.SourceInfo.BackupSource} message BackupSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupSource.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.backup = ""; + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + object.backup = message.backup; + return object; + }; + + /** + * Converts this BackupSource to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @instance + * @returns {Object.} JSON object + */ + BackupSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupSource + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Database.SourceInfo.BackupSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Database.SourceInfo.BackupSource"; + }; + + return BackupSource; + })(); + + return SourceInfo; + })(); + + Database.EncryptionConfig = (function() { + + /** + * Properties of an EncryptionConfig. + * @memberof google.firestore.admin.v1.Database + * @interface IEncryptionConfig + * @property {google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions|null} [googleDefaultEncryption] EncryptionConfig googleDefaultEncryption + * @property {google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions|null} [useSourceEncryption] EncryptionConfig useSourceEncryption + * @property {google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions|null} [customerManagedEncryption] EncryptionConfig customerManagedEncryption + */ + + /** + * Constructs a new EncryptionConfig. + * @memberof google.firestore.admin.v1.Database + * @classdesc Represents an EncryptionConfig. + * @implements IEncryptionConfig + * @constructor + * @param {google.firestore.admin.v1.Database.IEncryptionConfig=} [properties] Properties to set + */ + function EncryptionConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * EncryptionConfig googleDefaultEncryption. + * @member {google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions|null|undefined} googleDefaultEncryption + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @instance + */ + EncryptionConfig.prototype.googleDefaultEncryption = null; + + /** + * EncryptionConfig useSourceEncryption. + * @member {google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions|null|undefined} useSourceEncryption + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @instance + */ + EncryptionConfig.prototype.useSourceEncryption = null; + + /** + * EncryptionConfig customerManagedEncryption. + * @member {google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions|null|undefined} customerManagedEncryption + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @instance + */ + EncryptionConfig.prototype.customerManagedEncryption = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * EncryptionConfig encryptionType. + * @member {"googleDefaultEncryption"|"useSourceEncryption"|"customerManagedEncryption"|undefined} encryptionType + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @instance + */ + Object.defineProperty(EncryptionConfig.prototype, "encryptionType", { + get: $util.oneOfGetter($oneOfFields = ["googleDefaultEncryption", "useSourceEncryption", "customerManagedEncryption"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new EncryptionConfig instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @static + * @param {google.firestore.admin.v1.Database.IEncryptionConfig=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Database.EncryptionConfig} EncryptionConfig instance + */ + EncryptionConfig.create = function create(properties) { + return new EncryptionConfig(properties); + }; + + /** + * Encodes the specified EncryptionConfig message. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @static + * @param {google.firestore.admin.v1.Database.IEncryptionConfig} message EncryptionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptionConfig.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.googleDefaultEncryption != null && Object.hasOwnProperty.call(message, "googleDefaultEncryption")) + $root.google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions.encode(message.googleDefaultEncryption, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.useSourceEncryption != null && Object.hasOwnProperty.call(message, "useSourceEncryption")) + $root.google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions.encode(message.useSourceEncryption, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.customerManagedEncryption != null && Object.hasOwnProperty.call(message, "customerManagedEncryption")) + $root.google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions.encode(message.customerManagedEncryption, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified EncryptionConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @static + * @param {google.firestore.admin.v1.Database.IEncryptionConfig} message EncryptionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptionConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an EncryptionConfig message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Database.EncryptionConfig} EncryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptionConfig.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Database.EncryptionConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.googleDefaultEncryption = $root.google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.useSourceEncryption = $root.google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.customerManagedEncryption = $root.google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an EncryptionConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Database.EncryptionConfig} EncryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptionConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EncryptionConfig message. + * @function verify + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EncryptionConfig.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.googleDefaultEncryption != null && Object.hasOwnProperty.call(message, "googleDefaultEncryption")) { + properties.encryptionType = 1; + { + var error = $root.google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions.verify(message.googleDefaultEncryption, long + 1); + if (error) + return "googleDefaultEncryption." + error; + } + } + if (message.useSourceEncryption != null && Object.hasOwnProperty.call(message, "useSourceEncryption")) { + if (properties.encryptionType === 1) + return "encryptionType: multiple values"; + properties.encryptionType = 1; + { + var error = $root.google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions.verify(message.useSourceEncryption, long + 1); + if (error) + return "useSourceEncryption." + error; + } + } + if (message.customerManagedEncryption != null && Object.hasOwnProperty.call(message, "customerManagedEncryption")) { + if (properties.encryptionType === 1) + return "encryptionType: multiple values"; + properties.encryptionType = 1; + { + var error = $root.google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions.verify(message.customerManagedEncryption, long + 1); + if (error) + return "customerManagedEncryption." + error; + } + } + return null; + }; + + /** + * Creates an EncryptionConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Database.EncryptionConfig} EncryptionConfig + */ + EncryptionConfig.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Database.EncryptionConfig) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Database.EncryptionConfig: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Database.EncryptionConfig(); + if (object.googleDefaultEncryption != null) { + if (!$util.isObject(object.googleDefaultEncryption)) + throw TypeError(".google.firestore.admin.v1.Database.EncryptionConfig.googleDefaultEncryption: object expected"); + message.googleDefaultEncryption = $root.google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions.fromObject(object.googleDefaultEncryption, long + 1); + } + if (object.useSourceEncryption != null) { + if (!$util.isObject(object.useSourceEncryption)) + throw TypeError(".google.firestore.admin.v1.Database.EncryptionConfig.useSourceEncryption: object expected"); + message.useSourceEncryption = $root.google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions.fromObject(object.useSourceEncryption, long + 1); + } + if (object.customerManagedEncryption != null) { + if (!$util.isObject(object.customerManagedEncryption)) + throw TypeError(".google.firestore.admin.v1.Database.EncryptionConfig.customerManagedEncryption: object expected"); + message.customerManagedEncryption = $root.google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions.fromObject(object.customerManagedEncryption, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an EncryptionConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig} message EncryptionConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EncryptionConfig.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.googleDefaultEncryption != null && Object.hasOwnProperty.call(message, "googleDefaultEncryption")) { + object.googleDefaultEncryption = $root.google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions.toObject(message.googleDefaultEncryption, options, q + 1); + if (options.oneofs) + object.encryptionType = "googleDefaultEncryption"; + } + if (message.useSourceEncryption != null && Object.hasOwnProperty.call(message, "useSourceEncryption")) { + object.useSourceEncryption = $root.google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions.toObject(message.useSourceEncryption, options, q + 1); + if (options.oneofs) + object.encryptionType = "useSourceEncryption"; + } + if (message.customerManagedEncryption != null && Object.hasOwnProperty.call(message, "customerManagedEncryption")) { + object.customerManagedEncryption = $root.google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions.toObject(message.customerManagedEncryption, options, q + 1); + if (options.oneofs) + object.encryptionType = "customerManagedEncryption"; + } + return object; + }; + + /** + * Converts this EncryptionConfig to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @instance + * @returns {Object.} JSON object + */ + EncryptionConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EncryptionConfig + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EncryptionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Database.EncryptionConfig"; + }; + + EncryptionConfig.GoogleDefaultEncryptionOptions = (function() { + + /** + * Properties of a GoogleDefaultEncryptionOptions. + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @interface IGoogleDefaultEncryptionOptions + */ + + /** + * Constructs a new GoogleDefaultEncryptionOptions. + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @classdesc Represents a GoogleDefaultEncryptionOptions. + * @implements IGoogleDefaultEncryptionOptions + * @constructor + * @param {google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions=} [properties] Properties to set + */ + function GoogleDefaultEncryptionOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new GoogleDefaultEncryptionOptions instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions} GoogleDefaultEncryptionOptions instance + */ + GoogleDefaultEncryptionOptions.create = function create(properties) { + return new GoogleDefaultEncryptionOptions(properties); + }; + + /** + * Encodes the specified GoogleDefaultEncryptionOptions message. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions} message GoogleDefaultEncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoogleDefaultEncryptionOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified GoogleDefaultEncryptionOptions message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.IGoogleDefaultEncryptionOptions} message GoogleDefaultEncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoogleDefaultEncryptionOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GoogleDefaultEncryptionOptions message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions} GoogleDefaultEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoogleDefaultEncryptionOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GoogleDefaultEncryptionOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions} GoogleDefaultEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoogleDefaultEncryptionOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GoogleDefaultEncryptionOptions message. + * @function verify + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GoogleDefaultEncryptionOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates a GoogleDefaultEncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions} GoogleDefaultEncryptionOptions + */ + GoogleDefaultEncryptionOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions) + return object; + return new $root.google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions(); + }; + + /** + * Creates a plain object from a GoogleDefaultEncryptionOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions} message GoogleDefaultEncryptionOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GoogleDefaultEncryptionOptions.toObject = function toObject() { + return {}; + }; + + /** + * Converts this GoogleDefaultEncryptionOptions to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @instance + * @returns {Object.} JSON object + */ + GoogleDefaultEncryptionOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GoogleDefaultEncryptionOptions + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GoogleDefaultEncryptionOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions"; + }; + + return GoogleDefaultEncryptionOptions; + })(); + + EncryptionConfig.SourceEncryptionOptions = (function() { + + /** + * Properties of a SourceEncryptionOptions. + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @interface ISourceEncryptionOptions + */ + + /** + * Constructs a new SourceEncryptionOptions. + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @classdesc Represents a SourceEncryptionOptions. + * @implements ISourceEncryptionOptions + * @constructor + * @param {google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions=} [properties] Properties to set + */ + function SourceEncryptionOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new SourceEncryptionOptions instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions} SourceEncryptionOptions instance + */ + SourceEncryptionOptions.create = function create(properties) { + return new SourceEncryptionOptions(properties); + }; + + /** + * Encodes the specified SourceEncryptionOptions message. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions} message SourceEncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceEncryptionOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified SourceEncryptionOptions message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.ISourceEncryptionOptions} message SourceEncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceEncryptionOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a SourceEncryptionOptions message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions} SourceEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceEncryptionOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a SourceEncryptionOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions} SourceEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceEncryptionOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceEncryptionOptions message. + * @function verify + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceEncryptionOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates a SourceEncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions} SourceEncryptionOptions + */ + SourceEncryptionOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions) + return object; + return new $root.google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions(); + }; + + /** + * Creates a plain object from a SourceEncryptionOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions} message SourceEncryptionOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceEncryptionOptions.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SourceEncryptionOptions to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @instance + * @returns {Object.} JSON object + */ + SourceEncryptionOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SourceEncryptionOptions + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceEncryptionOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions"; + }; + + return SourceEncryptionOptions; + })(); + + EncryptionConfig.CustomerManagedEncryptionOptions = (function() { + + /** + * Properties of a CustomerManagedEncryptionOptions. + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @interface ICustomerManagedEncryptionOptions + * @property {string|null} [kmsKeyName] CustomerManagedEncryptionOptions kmsKeyName + */ + + /** + * Constructs a new CustomerManagedEncryptionOptions. + * @memberof google.firestore.admin.v1.Database.EncryptionConfig + * @classdesc Represents a CustomerManagedEncryptionOptions. + * @implements ICustomerManagedEncryptionOptions + * @constructor + * @param {google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions=} [properties] Properties to set + */ + function CustomerManagedEncryptionOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomerManagedEncryptionOptions kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @instance + */ + CustomerManagedEncryptionOptions.prototype.kmsKeyName = ""; + + /** + * Creates a new CustomerManagedEncryptionOptions instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions} CustomerManagedEncryptionOptions instance + */ + CustomerManagedEncryptionOptions.create = function create(properties) { + return new CustomerManagedEncryptionOptions(properties); + }; + + /** + * Encodes the specified CustomerManagedEncryptionOptions message. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions} message CustomerManagedEncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomerManagedEncryptionOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyName); + return writer; + }; + + /** + * Encodes the specified CustomerManagedEncryptionOptions message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.ICustomerManagedEncryptionOptions} message CustomerManagedEncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomerManagedEncryptionOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CustomerManagedEncryptionOptions message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions} CustomerManagedEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomerManagedEncryptionOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kmsKeyName = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CustomerManagedEncryptionOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions} CustomerManagedEncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomerManagedEncryptionOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomerManagedEncryptionOptions message. + * @function verify + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomerManagedEncryptionOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + return null; + }; + + /** + * Creates a CustomerManagedEncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions} CustomerManagedEncryptionOptions + */ + CustomerManagedEncryptionOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions(); + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + return message; + }; + + /** + * Creates a plain object from a CustomerManagedEncryptionOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @static + * @param {google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions} message CustomerManagedEncryptionOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomerManagedEncryptionOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.kmsKeyName = ""; + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + return object; + }; + + /** + * Converts this CustomerManagedEncryptionOptions to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @instance + * @returns {Object.} JSON object + */ + CustomerManagedEncryptionOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomerManagedEncryptionOptions + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomerManagedEncryptionOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions"; + }; + + return CustomerManagedEncryptionOptions; + })(); + + return EncryptionConfig; + })(); + + /** + * DatabaseEdition enum. + * @name google.firestore.admin.v1.Database.DatabaseEdition + * @enum {number} + * @property {number} DATABASE_EDITION_UNSPECIFIED=0 DATABASE_EDITION_UNSPECIFIED value + * @property {number} STANDARD=1 STANDARD value + * @property {number} ENTERPRISE=2 ENTERPRISE value + */ + Database.DatabaseEdition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DATABASE_EDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "STANDARD"] = 1; + values[valuesById[2] = "ENTERPRISE"] = 2; + return values; + })(); + + /** + * DataAccessMode enum. + * @name google.firestore.admin.v1.Database.DataAccessMode + * @enum {number} + * @property {number} DATA_ACCESS_MODE_UNSPECIFIED=0 DATA_ACCESS_MODE_UNSPECIFIED value + * @property {number} DATA_ACCESS_MODE_ENABLED=1 DATA_ACCESS_MODE_ENABLED value + * @property {number} DATA_ACCESS_MODE_DISABLED=2 DATA_ACCESS_MODE_DISABLED value + */ + Database.DataAccessMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DATA_ACCESS_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DATA_ACCESS_MODE_ENABLED"] = 1; + values[valuesById[2] = "DATA_ACCESS_MODE_DISABLED"] = 2; + return values; + })(); + + return Database; + })(); + + /** + * RealtimeUpdatesMode enum. + * @name google.firestore.admin.v1.RealtimeUpdatesMode + * @enum {number} + * @property {number} REALTIME_UPDATES_MODE_UNSPECIFIED=0 REALTIME_UPDATES_MODE_UNSPECIFIED value + * @property {number} REALTIME_UPDATES_MODE_ENABLED=1 REALTIME_UPDATES_MODE_ENABLED value + * @property {number} REALTIME_UPDATES_MODE_DISABLED=2 REALTIME_UPDATES_MODE_DISABLED value + */ + v1.RealtimeUpdatesMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REALTIME_UPDATES_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "REALTIME_UPDATES_MODE_ENABLED"] = 1; + values[valuesById[2] = "REALTIME_UPDATES_MODE_DISABLED"] = 2; + return values; + })(); + + v1.Field = (function() { + + /** + * Properties of a Field. + * @memberof google.firestore.admin.v1 + * @interface IField + * @property {string|null} [name] Field name + * @property {google.firestore.admin.v1.Field.IIndexConfig|null} [indexConfig] Field indexConfig + * @property {google.firestore.admin.v1.Field.ITtlConfig|null} [ttlConfig] Field ttlConfig + */ + + /** + * Constructs a new Field. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a Field. + * @implements IField + * @constructor + * @param {google.firestore.admin.v1.IField=} [properties] Properties to set + */ + function Field(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Field name. + * @member {string} name + * @memberof google.firestore.admin.v1.Field + * @instance + */ + Field.prototype.name = ""; + + /** + * Field indexConfig. + * @member {google.firestore.admin.v1.Field.IIndexConfig|null|undefined} indexConfig + * @memberof google.firestore.admin.v1.Field + * @instance + */ + Field.prototype.indexConfig = null; + + /** + * Field ttlConfig. + * @member {google.firestore.admin.v1.Field.ITtlConfig|null|undefined} ttlConfig + * @memberof google.firestore.admin.v1.Field + * @instance + */ + Field.prototype.ttlConfig = null; + + /** + * Creates a new Field instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Field + * @static + * @param {google.firestore.admin.v1.IField=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Field} Field instance + */ + Field.create = function create(properties) { + return new Field(properties); + }; + + /** + * Encodes the specified Field message. Does not implicitly {@link google.firestore.admin.v1.Field.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Field + * @static + * @param {google.firestore.admin.v1.IField} message Field message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Field.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.indexConfig != null && Object.hasOwnProperty.call(message, "indexConfig")) + $root.google.firestore.admin.v1.Field.IndexConfig.encode(message.indexConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.ttlConfig != null && Object.hasOwnProperty.call(message, "ttlConfig")) + $root.google.firestore.admin.v1.Field.TtlConfig.encode(message.ttlConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Field message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Field.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Field + * @static + * @param {google.firestore.admin.v1.IField} message Field message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Field.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Field message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Field + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Field} Field + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Field.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Field(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.indexConfig = $root.google.firestore.admin.v1.Field.IndexConfig.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.ttlConfig = $root.google.firestore.admin.v1.Field.TtlConfig.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Field message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Field + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Field} Field + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Field.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Field message. + * @function verify + * @memberof google.firestore.admin.v1.Field + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Field.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.indexConfig != null && Object.hasOwnProperty.call(message, "indexConfig")) { + var error = $root.google.firestore.admin.v1.Field.IndexConfig.verify(message.indexConfig, long + 1); + if (error) + return "indexConfig." + error; + } + if (message.ttlConfig != null && Object.hasOwnProperty.call(message, "ttlConfig")) { + var error = $root.google.firestore.admin.v1.Field.TtlConfig.verify(message.ttlConfig, long + 1); + if (error) + return "ttlConfig." + error; + } + return null; + }; + + /** + * Creates a Field message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Field + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Field} Field + */ + Field.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Field) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Field: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Field(); + if (object.name != null) + message.name = String(object.name); + if (object.indexConfig != null) { + if (!$util.isObject(object.indexConfig)) + throw TypeError(".google.firestore.admin.v1.Field.indexConfig: object expected"); + message.indexConfig = $root.google.firestore.admin.v1.Field.IndexConfig.fromObject(object.indexConfig, long + 1); + } + if (object.ttlConfig != null) { + if (!$util.isObject(object.ttlConfig)) + throw TypeError(".google.firestore.admin.v1.Field.ttlConfig: object expected"); + message.ttlConfig = $root.google.firestore.admin.v1.Field.TtlConfig.fromObject(object.ttlConfig, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Field message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Field + * @static + * @param {google.firestore.admin.v1.Field} message Field + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Field.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.indexConfig = null; + object.ttlConfig = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.indexConfig != null && Object.hasOwnProperty.call(message, "indexConfig")) + object.indexConfig = $root.google.firestore.admin.v1.Field.IndexConfig.toObject(message.indexConfig, options, q + 1); + if (message.ttlConfig != null && Object.hasOwnProperty.call(message, "ttlConfig")) + object.ttlConfig = $root.google.firestore.admin.v1.Field.TtlConfig.toObject(message.ttlConfig, options, q + 1); + return object; + }; + + /** + * Converts this Field to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Field + * @instance + * @returns {Object.} JSON object + */ + Field.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Field + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Field + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Field.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Field"; + }; + + Field.IndexConfig = (function() { + + /** + * Properties of an IndexConfig. + * @memberof google.firestore.admin.v1.Field + * @interface IIndexConfig + * @property {Array.|null} [indexes] IndexConfig indexes + * @property {boolean|null} [usesAncestorConfig] IndexConfig usesAncestorConfig + * @property {string|null} [ancestorField] IndexConfig ancestorField + * @property {boolean|null} [reverting] IndexConfig reverting + */ + + /** + * Constructs a new IndexConfig. + * @memberof google.firestore.admin.v1.Field + * @classdesc Represents an IndexConfig. + * @implements IIndexConfig + * @constructor + * @param {google.firestore.admin.v1.Field.IIndexConfig=} [properties] Properties to set + */ + function IndexConfig(properties) { + this.indexes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * IndexConfig indexes. + * @member {Array.} indexes + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @instance + */ + IndexConfig.prototype.indexes = $util.emptyArray; + + /** + * IndexConfig usesAncestorConfig. + * @member {boolean} usesAncestorConfig + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @instance + */ + IndexConfig.prototype.usesAncestorConfig = false; + + /** + * IndexConfig ancestorField. + * @member {string} ancestorField + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @instance + */ + IndexConfig.prototype.ancestorField = ""; + + /** + * IndexConfig reverting. + * @member {boolean} reverting + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @instance + */ + IndexConfig.prototype.reverting = false; + + /** + * Creates a new IndexConfig instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @static + * @param {google.firestore.admin.v1.Field.IIndexConfig=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Field.IndexConfig} IndexConfig instance + */ + IndexConfig.create = function create(properties) { + return new IndexConfig(properties); + }; + + /** + * Encodes the specified IndexConfig message. Does not implicitly {@link google.firestore.admin.v1.Field.IndexConfig.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @static + * @param {google.firestore.admin.v1.Field.IIndexConfig} message IndexConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexConfig.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.indexes != null && message.indexes.length) + for (var i = 0; i < message.indexes.length; ++i) + $root.google.firestore.admin.v1.Index.encode(message.indexes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.usesAncestorConfig != null && Object.hasOwnProperty.call(message, "usesAncestorConfig")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.usesAncestorConfig); + if (message.ancestorField != null && Object.hasOwnProperty.call(message, "ancestorField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.ancestorField); + if (message.reverting != null && Object.hasOwnProperty.call(message, "reverting")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.reverting); + return writer; + }; + + /** + * Encodes the specified IndexConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Field.IndexConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @static + * @param {google.firestore.admin.v1.Field.IIndexConfig} message IndexConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an IndexConfig message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Field.IndexConfig} IndexConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexConfig.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Field.IndexConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.indexes && message.indexes.length)) + message.indexes = []; + message.indexes.push($root.google.firestore.admin.v1.Index.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.usesAncestorConfig = reader.bool(); + break; + } + case 3: { + message.ancestorField = reader.string(); + break; + } + case 4: { + message.reverting = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an IndexConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Field.IndexConfig} IndexConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IndexConfig message. + * @function verify + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IndexConfig.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.indexes != null && Object.hasOwnProperty.call(message, "indexes")) { + if (!Array.isArray(message.indexes)) + return "indexes: array expected"; + for (var i = 0; i < message.indexes.length; ++i) { + var error = $root.google.firestore.admin.v1.Index.verify(message.indexes[i], long + 1); + if (error) + return "indexes." + error; + } + } + if (message.usesAncestorConfig != null && Object.hasOwnProperty.call(message, "usesAncestorConfig")) + if (typeof message.usesAncestorConfig !== "boolean") + return "usesAncestorConfig: boolean expected"; + if (message.ancestorField != null && Object.hasOwnProperty.call(message, "ancestorField")) + if (!$util.isString(message.ancestorField)) + return "ancestorField: string expected"; + if (message.reverting != null && Object.hasOwnProperty.call(message, "reverting")) + if (typeof message.reverting !== "boolean") + return "reverting: boolean expected"; + return null; + }; + + /** + * Creates an IndexConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Field.IndexConfig} IndexConfig + */ + IndexConfig.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Field.IndexConfig) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Field.IndexConfig: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Field.IndexConfig(); + if (object.indexes) { + if (!Array.isArray(object.indexes)) + throw TypeError(".google.firestore.admin.v1.Field.IndexConfig.indexes: array expected"); + message.indexes = []; + for (var i = 0; i < object.indexes.length; ++i) { + if (!$util.isObject(object.indexes[i])) + throw TypeError(".google.firestore.admin.v1.Field.IndexConfig.indexes: object expected"); + message.indexes[i] = $root.google.firestore.admin.v1.Index.fromObject(object.indexes[i], long + 1); + } + } + if (object.usesAncestorConfig != null) + message.usesAncestorConfig = Boolean(object.usesAncestorConfig); + if (object.ancestorField != null) + message.ancestorField = String(object.ancestorField); + if (object.reverting != null) + message.reverting = Boolean(object.reverting); + return message; + }; + + /** + * Creates a plain object from an IndexConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @static + * @param {google.firestore.admin.v1.Field.IndexConfig} message IndexConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IndexConfig.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.indexes = []; + if (options.defaults) { + object.usesAncestorConfig = false; + object.ancestorField = ""; + object.reverting = false; + } + if (message.indexes && message.indexes.length) { + object.indexes = []; + for (var j = 0; j < message.indexes.length; ++j) + object.indexes[j] = $root.google.firestore.admin.v1.Index.toObject(message.indexes[j], options, q + 1); + } + if (message.usesAncestorConfig != null && Object.hasOwnProperty.call(message, "usesAncestorConfig")) + object.usesAncestorConfig = message.usesAncestorConfig; + if (message.ancestorField != null && Object.hasOwnProperty.call(message, "ancestorField")) + object.ancestorField = message.ancestorField; + if (message.reverting != null && Object.hasOwnProperty.call(message, "reverting")) + object.reverting = message.reverting; + return object; + }; + + /** + * Converts this IndexConfig to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @instance + * @returns {Object.} JSON object + */ + IndexConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IndexConfig + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Field.IndexConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IndexConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Field.IndexConfig"; + }; + + return IndexConfig; + })(); + + Field.TtlConfig = (function() { + + /** + * Properties of a TtlConfig. + * @memberof google.firestore.admin.v1.Field + * @interface ITtlConfig + * @property {google.firestore.admin.v1.Field.TtlConfig.State|null} [state] TtlConfig state + * @property {google.protobuf.IDuration|null} [expirationOffset] TtlConfig expirationOffset + */ + + /** + * Constructs a new TtlConfig. + * @memberof google.firestore.admin.v1.Field + * @classdesc Represents a TtlConfig. + * @implements ITtlConfig + * @constructor + * @param {google.firestore.admin.v1.Field.ITtlConfig=} [properties] Properties to set + */ + function TtlConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * TtlConfig state. + * @member {google.firestore.admin.v1.Field.TtlConfig.State} state + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @instance + */ + TtlConfig.prototype.state = 0; + + /** + * TtlConfig expirationOffset. + * @member {google.protobuf.IDuration|null|undefined} expirationOffset + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @instance + */ + TtlConfig.prototype.expirationOffset = null; + + /** + * Creates a new TtlConfig instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @static + * @param {google.firestore.admin.v1.Field.ITtlConfig=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Field.TtlConfig} TtlConfig instance + */ + TtlConfig.create = function create(properties) { + return new TtlConfig(properties); + }; + + /** + * Encodes the specified TtlConfig message. Does not implicitly {@link google.firestore.admin.v1.Field.TtlConfig.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @static + * @param {google.firestore.admin.v1.Field.ITtlConfig} message TtlConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TtlConfig.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.expirationOffset != null && Object.hasOwnProperty.call(message, "expirationOffset")) + $root.google.protobuf.Duration.encode(message.expirationOffset, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified TtlConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Field.TtlConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @static + * @param {google.firestore.admin.v1.Field.ITtlConfig} message TtlConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TtlConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a TtlConfig message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Field.TtlConfig} TtlConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TtlConfig.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Field.TtlConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 3: { + message.expirationOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a TtlConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Field.TtlConfig} TtlConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TtlConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TtlConfig message. + * @function verify + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TtlConfig.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.expirationOffset != null && Object.hasOwnProperty.call(message, "expirationOffset")) { + var error = $root.google.protobuf.Duration.verify(message.expirationOffset, long + 1); + if (error) + return "expirationOffset." + error; + } + return null; + }; + + /** + * Creates a TtlConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Field.TtlConfig} TtlConfig + */ + TtlConfig.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Field.TtlConfig) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Field.TtlConfig: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Field.TtlConfig(); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATING": + case 1: + message.state = 1; + break; + case "ACTIVE": + case 2: + message.state = 2; + break; + case "NEEDS_REPAIR": + case 3: + message.state = 3; + break; + } + if (object.expirationOffset != null) { + if (!$util.isObject(object.expirationOffset)) + throw TypeError(".google.firestore.admin.v1.Field.TtlConfig.expirationOffset: object expected"); + message.expirationOffset = $root.google.protobuf.Duration.fromObject(object.expirationOffset, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a TtlConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @static + * @param {google.firestore.admin.v1.Field.TtlConfig} message TtlConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TtlConfig.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.expirationOffset = null; + } + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + object.state = options.enums === String ? $root.google.firestore.admin.v1.Field.TtlConfig.State[message.state] === undefined ? message.state : $root.google.firestore.admin.v1.Field.TtlConfig.State[message.state] : message.state; + if (message.expirationOffset != null && Object.hasOwnProperty.call(message, "expirationOffset")) + object.expirationOffset = $root.google.protobuf.Duration.toObject(message.expirationOffset, options, q + 1); + return object; + }; + + /** + * Converts this TtlConfig to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @instance + * @returns {Object.} JSON object + */ + TtlConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TtlConfig + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Field.TtlConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TtlConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Field.TtlConfig"; + }; + + /** + * State enum. + * @name google.firestore.admin.v1.Field.TtlConfig.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} ACTIVE=2 ACTIVE value + * @property {number} NEEDS_REPAIR=3 NEEDS_REPAIR value + */ + TtlConfig.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + values[valuesById[3] = "NEEDS_REPAIR"] = 3; + return values; + })(); + + return TtlConfig; + })(); + + return Field; + })(); + + v1.Index = (function() { + + /** + * Properties of an Index. + * @memberof google.firestore.admin.v1 + * @interface IIndex + * @property {string|null} [name] Index name + * @property {google.firestore.admin.v1.Index.QueryScope|null} [queryScope] Index queryScope + * @property {google.firestore.admin.v1.Index.ApiScope|null} [apiScope] Index apiScope + * @property {Array.|null} [fields] Index fields + * @property {google.firestore.admin.v1.Index.State|null} [state] Index state + * @property {google.firestore.admin.v1.Index.Density|null} [density] Index density + * @property {boolean|null} [multikey] Index multikey + * @property {number|null} [shardCount] Index shardCount + * @property {boolean|null} [unique] Index unique + * @property {google.firestore.admin.v1.Index.ISearchIndexOptions|null} [searchIndexOptions] Index searchIndexOptions + */ + + /** + * Constructs a new Index. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an Index. + * @implements IIndex + * @constructor + * @param {google.firestore.admin.v1.IIndex=} [properties] Properties to set + */ + function Index(properties) { + this.fields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Index name. + * @member {string} name + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.name = ""; + + /** + * Index queryScope. + * @member {google.firestore.admin.v1.Index.QueryScope} queryScope + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.queryScope = 0; + + /** + * Index apiScope. + * @member {google.firestore.admin.v1.Index.ApiScope} apiScope + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.apiScope = 0; + + /** + * Index fields. + * @member {Array.} fields + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.fields = $util.emptyArray; + + /** + * Index state. + * @member {google.firestore.admin.v1.Index.State} state + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.state = 0; + + /** + * Index density. + * @member {google.firestore.admin.v1.Index.Density} density + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.density = 0; + + /** + * Index multikey. + * @member {boolean} multikey + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.multikey = false; + + /** + * Index shardCount. + * @member {number} shardCount + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.shardCount = 0; + + /** + * Index unique. + * @member {boolean} unique + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.unique = false; + + /** + * Index searchIndexOptions. + * @member {google.firestore.admin.v1.Index.ISearchIndexOptions|null|undefined} searchIndexOptions + * @memberof google.firestore.admin.v1.Index + * @instance + */ + Index.prototype.searchIndexOptions = null; + + /** + * Creates a new Index instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Index + * @static + * @param {google.firestore.admin.v1.IIndex=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Index} Index instance + */ + Index.create = function create(properties) { + return new Index(properties); + }; + + /** + * Encodes the specified Index message. Does not implicitly {@link google.firestore.admin.v1.Index.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Index + * @static + * @param {google.firestore.admin.v1.IIndex} message Index message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Index.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.queryScope != null && Object.hasOwnProperty.call(message, "queryScope")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.queryScope); + if (message.fields != null && message.fields.length) + for (var i = 0; i < message.fields.length; ++i) + $root.google.firestore.admin.v1.Index.IndexField.encode(message.fields[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.apiScope != null && Object.hasOwnProperty.call(message, "apiScope")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.apiScope); + if (message.density != null && Object.hasOwnProperty.call(message, "density")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.density); + if (message.multikey != null && Object.hasOwnProperty.call(message, "multikey")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.multikey); + if (message.shardCount != null && Object.hasOwnProperty.call(message, "shardCount")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.shardCount); + if (message.searchIndexOptions != null && Object.hasOwnProperty.call(message, "searchIndexOptions")) + $root.google.firestore.admin.v1.Index.SearchIndexOptions.encode(message.searchIndexOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); + if (message.unique != null && Object.hasOwnProperty.call(message, "unique")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.unique); + return writer; + }; + + /** + * Encodes the specified Index message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Index + * @static + * @param {google.firestore.admin.v1.IIndex} message Index message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Index.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Index message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Index + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Index} Index + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Index.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Index(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.queryScope = reader.int32(); + break; + } + case 5: { + message.apiScope = reader.int32(); + break; + } + case 3: { + if (!(message.fields && message.fields.length)) + message.fields = []; + message.fields.push($root.google.firestore.admin.v1.Index.IndexField.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 4: { + message.state = reader.int32(); + break; + } + case 6: { + message.density = reader.int32(); + break; + } + case 7: { + message.multikey = reader.bool(); + break; + } + case 8: { + message.shardCount = reader.int32(); + break; + } + case 10: { + message.unique = reader.bool(); + break; + } + case 9: { + message.searchIndexOptions = $root.google.firestore.admin.v1.Index.SearchIndexOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Index message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Index + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Index} Index + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Index.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Index message. + * @function verify + * @memberof google.firestore.admin.v1.Index + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Index.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.queryScope != null && Object.hasOwnProperty.call(message, "queryScope")) + switch (message.queryScope) { + default: + return "queryScope: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.apiScope != null && Object.hasOwnProperty.call(message, "apiScope")) + switch (message.apiScope) { + default: + return "apiScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { + if (!Array.isArray(message.fields)) + return "fields: array expected"; + for (var i = 0; i < message.fields.length; ++i) { + var error = $root.google.firestore.admin.v1.Index.IndexField.verify(message.fields[i], long + 1); + if (error) + return "fields." + error; + } + } + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.density != null && Object.hasOwnProperty.call(message, "density")) + switch (message.density) { + default: + return "density: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.multikey != null && Object.hasOwnProperty.call(message, "multikey")) + if (typeof message.multikey !== "boolean") + return "multikey: boolean expected"; + if (message.shardCount != null && Object.hasOwnProperty.call(message, "shardCount")) + if (!$util.isInteger(message.shardCount)) + return "shardCount: integer expected"; + if (message.unique != null && Object.hasOwnProperty.call(message, "unique")) + if (typeof message.unique !== "boolean") + return "unique: boolean expected"; + if (message.searchIndexOptions != null && Object.hasOwnProperty.call(message, "searchIndexOptions")) { + var error = $root.google.firestore.admin.v1.Index.SearchIndexOptions.verify(message.searchIndexOptions, long + 1); + if (error) + return "searchIndexOptions." + error; + } + return null; + }; + + /** + * Creates an Index message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Index + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Index} Index + */ + Index.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Index) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Index: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Index(); + if (object.name != null) + message.name = String(object.name); + switch (object.queryScope) { + default: + if (typeof object.queryScope === "number") { + message.queryScope = object.queryScope; + break; + } + break; + case "QUERY_SCOPE_UNSPECIFIED": + case 0: + message.queryScope = 0; + break; + case "COLLECTION": + case 1: + message.queryScope = 1; + break; + case "COLLECTION_GROUP": + case 2: + message.queryScope = 2; + break; + case "COLLECTION_RECURSIVE": + case 3: + message.queryScope = 3; + break; + } + switch (object.apiScope) { + default: + if (typeof object.apiScope === "number") { + message.apiScope = object.apiScope; + break; + } + break; + case "ANY_API": + case 0: + message.apiScope = 0; + break; + case "DATASTORE_MODE_API": + case 1: + message.apiScope = 1; + break; + case "MONGODB_COMPATIBLE_API": + case 2: + message.apiScope = 2; + break; + } + if (object.fields) { + if (!Array.isArray(object.fields)) + throw TypeError(".google.firestore.admin.v1.Index.fields: array expected"); + message.fields = []; + for (var i = 0; i < object.fields.length; ++i) { + if (!$util.isObject(object.fields[i])) + throw TypeError(".google.firestore.admin.v1.Index.fields: object expected"); + message.fields[i] = $root.google.firestore.admin.v1.Index.IndexField.fromObject(object.fields[i], long + 1); + } + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATING": + case 1: + message.state = 1; + break; + case "READY": + case 2: + message.state = 2; + break; + case "NEEDS_REPAIR": + case 3: + message.state = 3; + break; + } + switch (object.density) { + default: + if (typeof object.density === "number") { + message.density = object.density; + break; + } + break; + case "DENSITY_UNSPECIFIED": + case 0: + message.density = 0; + break; + case "SPARSE_ALL": + case 1: + message.density = 1; + break; + case "SPARSE_ANY": + case 2: + message.density = 2; + break; + case "DENSE": + case 3: + message.density = 3; + break; + } + if (object.multikey != null) + message.multikey = Boolean(object.multikey); + if (object.shardCount != null) + message.shardCount = object.shardCount | 0; + if (object.unique != null) + message.unique = Boolean(object.unique); + if (object.searchIndexOptions != null) { + if (!$util.isObject(object.searchIndexOptions)) + throw TypeError(".google.firestore.admin.v1.Index.searchIndexOptions: object expected"); + message.searchIndexOptions = $root.google.firestore.admin.v1.Index.SearchIndexOptions.fromObject(object.searchIndexOptions, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an Index message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Index + * @static + * @param {google.firestore.admin.v1.Index} message Index + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Index.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.fields = []; + if (options.defaults) { + object.name = ""; + object.queryScope = options.enums === String ? "QUERY_SCOPE_UNSPECIFIED" : 0; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.apiScope = options.enums === String ? "ANY_API" : 0; + object.density = options.enums === String ? "DENSITY_UNSPECIFIED" : 0; + object.multikey = false; + object.shardCount = 0; + object.searchIndexOptions = null; + object.unique = false; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.queryScope != null && Object.hasOwnProperty.call(message, "queryScope")) + object.queryScope = options.enums === String ? $root.google.firestore.admin.v1.Index.QueryScope[message.queryScope] === undefined ? message.queryScope : $root.google.firestore.admin.v1.Index.QueryScope[message.queryScope] : message.queryScope; + if (message.fields && message.fields.length) { + object.fields = []; + for (var j = 0; j < message.fields.length; ++j) + object.fields[j] = $root.google.firestore.admin.v1.Index.IndexField.toObject(message.fields[j], options, q + 1); + } + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + object.state = options.enums === String ? $root.google.firestore.admin.v1.Index.State[message.state] === undefined ? message.state : $root.google.firestore.admin.v1.Index.State[message.state] : message.state; + if (message.apiScope != null && Object.hasOwnProperty.call(message, "apiScope")) + object.apiScope = options.enums === String ? $root.google.firestore.admin.v1.Index.ApiScope[message.apiScope] === undefined ? message.apiScope : $root.google.firestore.admin.v1.Index.ApiScope[message.apiScope] : message.apiScope; + if (message.density != null && Object.hasOwnProperty.call(message, "density")) + object.density = options.enums === String ? $root.google.firestore.admin.v1.Index.Density[message.density] === undefined ? message.density : $root.google.firestore.admin.v1.Index.Density[message.density] : message.density; + if (message.multikey != null && Object.hasOwnProperty.call(message, "multikey")) + object.multikey = message.multikey; + if (message.shardCount != null && Object.hasOwnProperty.call(message, "shardCount")) + object.shardCount = message.shardCount; + if (message.searchIndexOptions != null && Object.hasOwnProperty.call(message, "searchIndexOptions")) + object.searchIndexOptions = $root.google.firestore.admin.v1.Index.SearchIndexOptions.toObject(message.searchIndexOptions, options, q + 1); + if (message.unique != null && Object.hasOwnProperty.call(message, "unique")) + object.unique = message.unique; + return object; + }; + + /** + * Converts this Index to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Index + * @instance + * @returns {Object.} JSON object + */ + Index.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Index + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Index + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Index.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Index"; + }; + + /** + * QueryScope enum. + * @name google.firestore.admin.v1.Index.QueryScope + * @enum {number} + * @property {number} QUERY_SCOPE_UNSPECIFIED=0 QUERY_SCOPE_UNSPECIFIED value + * @property {number} COLLECTION=1 COLLECTION value + * @property {number} COLLECTION_GROUP=2 COLLECTION_GROUP value + * @property {number} COLLECTION_RECURSIVE=3 COLLECTION_RECURSIVE value + */ + Index.QueryScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "QUERY_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "COLLECTION"] = 1; + values[valuesById[2] = "COLLECTION_GROUP"] = 2; + values[valuesById[3] = "COLLECTION_RECURSIVE"] = 3; + return values; + })(); + + /** + * ApiScope enum. + * @name google.firestore.admin.v1.Index.ApiScope + * @enum {number} + * @property {number} ANY_API=0 ANY_API value + * @property {number} DATASTORE_MODE_API=1 DATASTORE_MODE_API value + * @property {number} MONGODB_COMPATIBLE_API=2 MONGODB_COMPATIBLE_API value + */ + Index.ApiScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ANY_API"] = 0; + values[valuesById[1] = "DATASTORE_MODE_API"] = 1; + values[valuesById[2] = "MONGODB_COMPATIBLE_API"] = 2; + return values; + })(); + + Index.IndexField = (function() { + + /** + * Properties of an IndexField. + * @memberof google.firestore.admin.v1.Index + * @interface IIndexField + * @property {string|null} [fieldPath] IndexField fieldPath + * @property {google.firestore.admin.v1.Index.IndexField.Order|null} [order] IndexField order + * @property {google.firestore.admin.v1.Index.IndexField.ArrayConfig|null} [arrayConfig] IndexField arrayConfig + * @property {google.firestore.admin.v1.Index.IndexField.IVectorConfig|null} [vectorConfig] IndexField vectorConfig + * @property {google.firestore.admin.v1.Index.IndexField.ISearchConfig|null} [searchConfig] IndexField searchConfig + */ + + /** + * Constructs a new IndexField. + * @memberof google.firestore.admin.v1.Index + * @classdesc Represents an IndexField. + * @implements IIndexField + * @constructor + * @param {google.firestore.admin.v1.Index.IIndexField=} [properties] Properties to set + */ + function IndexField(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * IndexField fieldPath. + * @member {string} fieldPath + * @memberof google.firestore.admin.v1.Index.IndexField + * @instance + */ + IndexField.prototype.fieldPath = ""; + + /** + * IndexField order. + * @member {google.firestore.admin.v1.Index.IndexField.Order|null|undefined} order + * @memberof google.firestore.admin.v1.Index.IndexField + * @instance + */ + IndexField.prototype.order = null; + + /** + * IndexField arrayConfig. + * @member {google.firestore.admin.v1.Index.IndexField.ArrayConfig|null|undefined} arrayConfig + * @memberof google.firestore.admin.v1.Index.IndexField + * @instance + */ + IndexField.prototype.arrayConfig = null; + + /** + * IndexField vectorConfig. + * @member {google.firestore.admin.v1.Index.IndexField.IVectorConfig|null|undefined} vectorConfig + * @memberof google.firestore.admin.v1.Index.IndexField + * @instance + */ + IndexField.prototype.vectorConfig = null; + + /** + * IndexField searchConfig. + * @member {google.firestore.admin.v1.Index.IndexField.ISearchConfig|null|undefined} searchConfig + * @memberof google.firestore.admin.v1.Index.IndexField + * @instance + */ + IndexField.prototype.searchConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * IndexField valueMode. + * @member {"order"|"arrayConfig"|"vectorConfig"|"searchConfig"|undefined} valueMode + * @memberof google.firestore.admin.v1.Index.IndexField + * @instance + */ + Object.defineProperty(IndexField.prototype, "valueMode", { + get: $util.oneOfGetter($oneOfFields = ["order", "arrayConfig", "vectorConfig", "searchConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new IndexField instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Index.IndexField + * @static + * @param {google.firestore.admin.v1.Index.IIndexField=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Index.IndexField} IndexField instance + */ + IndexField.create = function create(properties) { + return new IndexField(properties); + }; + + /** + * Encodes the specified IndexField message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Index.IndexField + * @static + * @param {google.firestore.admin.v1.Index.IIndexField} message IndexField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexField.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fieldPath); + if (message.order != null && Object.hasOwnProperty.call(message, "order")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.order); + if (message.arrayConfig != null && Object.hasOwnProperty.call(message, "arrayConfig")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.arrayConfig); + if (message.vectorConfig != null && Object.hasOwnProperty.call(message, "vectorConfig")) + $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.encode(message.vectorConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.searchConfig != null && Object.hasOwnProperty.call(message, "searchConfig")) + $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.encode(message.searchConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified IndexField message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField + * @static + * @param {google.firestore.admin.v1.Index.IIndexField} message IndexField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexField.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an IndexField message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Index.IndexField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Index.IndexField} IndexField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexField.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Index.IndexField(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.fieldPath = reader.string(); + break; + } + case 2: { + message.order = reader.int32(); + break; + } + case 3: { + message.arrayConfig = reader.int32(); + break; + } + case 4: { + message.vectorConfig = $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.searchConfig = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an IndexField message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Index.IndexField} IndexField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexField.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IndexField message. + * @function verify + * @memberof google.firestore.admin.v1.Index.IndexField + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IndexField.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + if (!$util.isString(message.fieldPath)) + return "fieldPath: string expected"; + if (message.order != null && Object.hasOwnProperty.call(message, "order")) { + properties.valueMode = 1; + switch (message.order) { + default: + return "order: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.arrayConfig != null && Object.hasOwnProperty.call(message, "arrayConfig")) { + if (properties.valueMode === 1) + return "valueMode: multiple values"; + properties.valueMode = 1; + switch (message.arrayConfig) { + default: + return "arrayConfig: enum value expected"; + case 0: + case 1: + break; + } + } + if (message.vectorConfig != null && Object.hasOwnProperty.call(message, "vectorConfig")) { + if (properties.valueMode === 1) + return "valueMode: multiple values"; + properties.valueMode = 1; + { + var error = $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.verify(message.vectorConfig, long + 1); + if (error) + return "vectorConfig." + error; + } + } + if (message.searchConfig != null && Object.hasOwnProperty.call(message, "searchConfig")) { + if (properties.valueMode === 1) + return "valueMode: multiple values"; + properties.valueMode = 1; + { + var error = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.verify(message.searchConfig, long + 1); + if (error) + return "searchConfig." + error; + } + } + return null; + }; + + /** + * Creates an IndexField message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Index.IndexField + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Index.IndexField} IndexField + */ + IndexField.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Index.IndexField) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Index.IndexField(); + if (object.fieldPath != null) + message.fieldPath = String(object.fieldPath); + switch (object.order) { + default: + if (typeof object.order === "number") { + message.order = object.order; + break; + } + break; + case "ORDER_UNSPECIFIED": + case 0: + message.order = 0; + break; + case "ASCENDING": + case 1: + message.order = 1; + break; + case "DESCENDING": + case 2: + message.order = 2; + break; + } + switch (object.arrayConfig) { + default: + if (typeof object.arrayConfig === "number") { + message.arrayConfig = object.arrayConfig; + break; + } + break; + case "ARRAY_CONFIG_UNSPECIFIED": + case 0: + message.arrayConfig = 0; + break; + case "CONTAINS": + case 1: + message.arrayConfig = 1; + break; + } + if (object.vectorConfig != null) { + if (!$util.isObject(object.vectorConfig)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.vectorConfig: object expected"); + message.vectorConfig = $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.fromObject(object.vectorConfig, long + 1); + } + if (object.searchConfig != null) { + if (!$util.isObject(object.searchConfig)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.searchConfig: object expected"); + message.searchConfig = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.fromObject(object.searchConfig, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an IndexField message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Index.IndexField + * @static + * @param {google.firestore.admin.v1.Index.IndexField} message IndexField + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IndexField.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.fieldPath = ""; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + object.fieldPath = message.fieldPath; + if (message.order != null && Object.hasOwnProperty.call(message, "order")) { + object.order = options.enums === String ? $root.google.firestore.admin.v1.Index.IndexField.Order[message.order] === undefined ? message.order : $root.google.firestore.admin.v1.Index.IndexField.Order[message.order] : message.order; + if (options.oneofs) + object.valueMode = "order"; + } + if (message.arrayConfig != null && Object.hasOwnProperty.call(message, "arrayConfig")) { + object.arrayConfig = options.enums === String ? $root.google.firestore.admin.v1.Index.IndexField.ArrayConfig[message.arrayConfig] === undefined ? message.arrayConfig : $root.google.firestore.admin.v1.Index.IndexField.ArrayConfig[message.arrayConfig] : message.arrayConfig; + if (options.oneofs) + object.valueMode = "arrayConfig"; + } + if (message.vectorConfig != null && Object.hasOwnProperty.call(message, "vectorConfig")) { + object.vectorConfig = $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.toObject(message.vectorConfig, options, q + 1); + if (options.oneofs) + object.valueMode = "vectorConfig"; + } + if (message.searchConfig != null && Object.hasOwnProperty.call(message, "searchConfig")) { + object.searchConfig = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.toObject(message.searchConfig, options, q + 1); + if (options.oneofs) + object.valueMode = "searchConfig"; + } + return object; + }; + + /** + * Converts this IndexField to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Index.IndexField + * @instance + * @returns {Object.} JSON object + */ + IndexField.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IndexField + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Index.IndexField + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IndexField.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Index.IndexField"; + }; + + /** + * Order enum. + * @name google.firestore.admin.v1.Index.IndexField.Order + * @enum {number} + * @property {number} ORDER_UNSPECIFIED=0 ORDER_UNSPECIFIED value + * @property {number} ASCENDING=1 ASCENDING value + * @property {number} DESCENDING=2 DESCENDING value + */ + IndexField.Order = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ORDER_UNSPECIFIED"] = 0; + values[valuesById[1] = "ASCENDING"] = 1; + values[valuesById[2] = "DESCENDING"] = 2; + return values; + })(); + + /** + * ArrayConfig enum. + * @name google.firestore.admin.v1.Index.IndexField.ArrayConfig + * @enum {number} + * @property {number} ARRAY_CONFIG_UNSPECIFIED=0 ARRAY_CONFIG_UNSPECIFIED value + * @property {number} CONTAINS=1 CONTAINS value + */ + IndexField.ArrayConfig = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ARRAY_CONFIG_UNSPECIFIED"] = 0; + values[valuesById[1] = "CONTAINS"] = 1; + return values; + })(); + + IndexField.VectorConfig = (function() { + + /** + * Properties of a VectorConfig. + * @memberof google.firestore.admin.v1.Index.IndexField + * @interface IVectorConfig + * @property {number|null} [dimension] VectorConfig dimension + * @property {google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex|null} [flat] VectorConfig flat + */ + + /** + * Constructs a new VectorConfig. + * @memberof google.firestore.admin.v1.Index.IndexField + * @classdesc Represents a VectorConfig. + * @implements IVectorConfig + * @constructor + * @param {google.firestore.admin.v1.Index.IndexField.IVectorConfig=} [properties] Properties to set + */ + function VectorConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * VectorConfig dimension. + * @member {number} dimension + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @instance + */ + VectorConfig.prototype.dimension = 0; + + /** + * VectorConfig flat. + * @member {google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex|null|undefined} flat + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @instance + */ + VectorConfig.prototype.flat = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * VectorConfig type. + * @member {"flat"|undefined} type + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @instance + */ + Object.defineProperty(VectorConfig.prototype, "type", { + get: $util.oneOfGetter($oneOfFields = ["flat"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new VectorConfig instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @static + * @param {google.firestore.admin.v1.Index.IndexField.IVectorConfig=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Index.IndexField.VectorConfig} VectorConfig instance + */ + VectorConfig.create = function create(properties) { + return new VectorConfig(properties); + }; + + /** + * Encodes the specified VectorConfig message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.VectorConfig.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @static + * @param {google.firestore.admin.v1.Index.IndexField.IVectorConfig} message VectorConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VectorConfig.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.dimension != null && Object.hasOwnProperty.call(message, "dimension")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.dimension); + if (message.flat != null && Object.hasOwnProperty.call(message, "flat")) + $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex.encode(message.flat, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified VectorConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.VectorConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @static + * @param {google.firestore.admin.v1.Index.IndexField.IVectorConfig} message VectorConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VectorConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a VectorConfig message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Index.IndexField.VectorConfig} VectorConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VectorConfig.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Index.IndexField.VectorConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.dimension = reader.int32(); + break; + } + case 2: { + message.flat = $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a VectorConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Index.IndexField.VectorConfig} VectorConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VectorConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VectorConfig message. + * @function verify + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VectorConfig.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.dimension != null && Object.hasOwnProperty.call(message, "dimension")) + if (!$util.isInteger(message.dimension)) + return "dimension: integer expected"; + if (message.flat != null && Object.hasOwnProperty.call(message, "flat")) { + properties.type = 1; + { + var error = $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex.verify(message.flat, long + 1); + if (error) + return "flat." + error; + } + } + return null; + }; + + /** + * Creates a VectorConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Index.IndexField.VectorConfig} VectorConfig + */ + VectorConfig.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Index.IndexField.VectorConfig) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.VectorConfig: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Index.IndexField.VectorConfig(); + if (object.dimension != null) + message.dimension = object.dimension | 0; + if (object.flat != null) { + if (!$util.isObject(object.flat)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.VectorConfig.flat: object expected"); + message.flat = $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex.fromObject(object.flat, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a VectorConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @static + * @param {google.firestore.admin.v1.Index.IndexField.VectorConfig} message VectorConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VectorConfig.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.dimension = 0; + if (message.dimension != null && Object.hasOwnProperty.call(message, "dimension")) + object.dimension = message.dimension; + if (message.flat != null && Object.hasOwnProperty.call(message, "flat")) { + object.flat = $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex.toObject(message.flat, options, q + 1); + if (options.oneofs) + object.type = "flat"; + } + return object; + }; + + /** + * Converts this VectorConfig to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @instance + * @returns {Object.} JSON object + */ + VectorConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VectorConfig + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VectorConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Index.IndexField.VectorConfig"; + }; + + VectorConfig.FlatIndex = (function() { + + /** + * Properties of a FlatIndex. + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @interface IFlatIndex + */ + + /** + * Constructs a new FlatIndex. + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig + * @classdesc Represents a FlatIndex. + * @implements IFlatIndex + * @constructor + * @param {google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex=} [properties] Properties to set + */ + function FlatIndex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new FlatIndex instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @static + * @param {google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex} FlatIndex instance + */ + FlatIndex.create = function create(properties) { + return new FlatIndex(properties); + }; + + /** + * Encodes the specified FlatIndex message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @static + * @param {google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex} message FlatIndex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FlatIndex.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified FlatIndex message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @static + * @param {google.firestore.admin.v1.Index.IndexField.VectorConfig.IFlatIndex} message FlatIndex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FlatIndex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FlatIndex message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex} FlatIndex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FlatIndex.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FlatIndex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex} FlatIndex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FlatIndex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FlatIndex message. + * @function verify + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FlatIndex.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates a FlatIndex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex} FlatIndex + */ + FlatIndex.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex) + return object; + return new $root.google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex(); + }; + + /** + * Creates a plain object from a FlatIndex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @static + * @param {google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex} message FlatIndex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FlatIndex.toObject = function toObject() { + return {}; + }; + + /** + * Converts this FlatIndex to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @instance + * @returns {Object.} JSON object + */ + FlatIndex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FlatIndex + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FlatIndex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex"; + }; + + return FlatIndex; + })(); + + return VectorConfig; + })(); + + IndexField.SearchConfig = (function() { + + /** + * Properties of a SearchConfig. + * @memberof google.firestore.admin.v1.Index.IndexField + * @interface ISearchConfig + * @property {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec|null} [textSpec] SearchConfig textSpec + * @property {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec|null} [geoSpec] SearchConfig geoSpec + */ + + /** + * Constructs a new SearchConfig. + * @memberof google.firestore.admin.v1.Index.IndexField + * @classdesc Represents a SearchConfig. + * @implements ISearchConfig + * @constructor + * @param {google.firestore.admin.v1.Index.IndexField.ISearchConfig=} [properties] Properties to set + */ + function SearchConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchConfig textSpec. + * @member {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec|null|undefined} textSpec + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @instance + */ + SearchConfig.prototype.textSpec = null; + + /** + * SearchConfig geoSpec. + * @member {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec|null|undefined} geoSpec + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @instance + */ + SearchConfig.prototype.geoSpec = null; + + /** + * Creates a new SearchConfig instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @static + * @param {google.firestore.admin.v1.Index.IndexField.ISearchConfig=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig} SearchConfig instance + */ + SearchConfig.create = function create(properties) { + return new SearchConfig(properties); + }; + + /** + * Encodes the specified SearchConfig message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @static + * @param {google.firestore.admin.v1.Index.IndexField.ISearchConfig} message SearchConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchConfig.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.textSpec != null && Object.hasOwnProperty.call(message, "textSpec")) + $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.encode(message.textSpec, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.geoSpec != null && Object.hasOwnProperty.call(message, "geoSpec")) + $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec.encode(message.geoSpec, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified SearchConfig message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @static + * @param {google.firestore.admin.v1.Index.IndexField.ISearchConfig} message SearchConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a SearchConfig message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig} SearchConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchConfig.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Index.IndexField.SearchConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.textSpec = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.geoSpec = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a SearchConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig} SearchConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchConfig message. + * @function verify + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchConfig.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.textSpec != null && Object.hasOwnProperty.call(message, "textSpec")) { + var error = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.verify(message.textSpec, long + 1); + if (error) + return "textSpec." + error; + } + if (message.geoSpec != null && Object.hasOwnProperty.call(message, "geoSpec")) { + var error = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec.verify(message.geoSpec, long + 1); + if (error) + return "geoSpec." + error; + } + return null; + }; + + /** + * Creates a SearchConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig} SearchConfig + */ + SearchConfig.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Index.IndexField.SearchConfig) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.SearchConfig: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Index.IndexField.SearchConfig(); + if (object.textSpec != null) { + if (!$util.isObject(object.textSpec)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.SearchConfig.textSpec: object expected"); + message.textSpec = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.fromObject(object.textSpec, long + 1); + } + if (object.geoSpec != null) { + if (!$util.isObject(object.geoSpec)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.SearchConfig.geoSpec: object expected"); + message.geoSpec = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec.fromObject(object.geoSpec, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a SearchConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig} message SearchConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchConfig.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.textSpec = null; + object.geoSpec = null; + } + if (message.textSpec != null && Object.hasOwnProperty.call(message, "textSpec")) + object.textSpec = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.toObject(message.textSpec, options, q + 1); + if (message.geoSpec != null && Object.hasOwnProperty.call(message, "geoSpec")) + object.geoSpec = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec.toObject(message.geoSpec, options, q + 1); + return object; + }; + + /** + * Converts this SearchConfig to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @instance + * @returns {Object.} JSON object + */ + SearchConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchConfig + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Index.IndexField.SearchConfig"; + }; + + /** + * TextIndexType enum. + * @name google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType + * @enum {number} + * @property {number} TEXT_INDEX_TYPE_UNSPECIFIED=0 TEXT_INDEX_TYPE_UNSPECIFIED value + * @property {number} TOKENIZED=1 TOKENIZED value + */ + SearchConfig.TextIndexType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TEXT_INDEX_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "TOKENIZED"] = 1; + return values; + })(); + + /** + * TextMatchType enum. + * @name google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType + * @enum {number} + * @property {number} TEXT_MATCH_TYPE_UNSPECIFIED=0 TEXT_MATCH_TYPE_UNSPECIFIED value + * @property {number} MATCH_GLOBALLY=1 MATCH_GLOBALLY value + */ + SearchConfig.TextMatchType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TEXT_MATCH_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "MATCH_GLOBALLY"] = 1; + return values; + })(); + + SearchConfig.SearchTextIndexSpec = (function() { + + /** + * Properties of a SearchTextIndexSpec. + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @interface ISearchTextIndexSpec + * @property {google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType|null} [indexType] SearchTextIndexSpec indexType + * @property {google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType|null} [matchType] SearchTextIndexSpec matchType + */ + + /** + * Constructs a new SearchTextIndexSpec. + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @classdesc Represents a SearchTextIndexSpec. + * @implements ISearchTextIndexSpec + * @constructor + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec=} [properties] Properties to set + */ + function SearchTextIndexSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchTextIndexSpec indexType. + * @member {google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType} indexType + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @instance + */ + SearchTextIndexSpec.prototype.indexType = 0; + + /** + * SearchTextIndexSpec matchType. + * @member {google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType} matchType + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @instance + */ + SearchTextIndexSpec.prototype.matchType = 0; + + /** + * Creates a new SearchTextIndexSpec instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec} SearchTextIndexSpec instance + */ + SearchTextIndexSpec.create = function create(properties) { + return new SearchTextIndexSpec(properties); + }; + + /** + * Encodes the specified SearchTextIndexSpec message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec} message SearchTextIndexSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchTextIndexSpec.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.indexType != null && Object.hasOwnProperty.call(message, "indexType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.indexType); + if (message.matchType != null && Object.hasOwnProperty.call(message, "matchType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.matchType); + return writer; + }; + + /** + * Encodes the specified SearchTextIndexSpec message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextIndexSpec} message SearchTextIndexSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchTextIndexSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a SearchTextIndexSpec message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec} SearchTextIndexSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchTextIndexSpec.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.indexType = reader.int32(); + break; + } + case 2: { + message.matchType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a SearchTextIndexSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec} SearchTextIndexSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchTextIndexSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchTextIndexSpec message. + * @function verify + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchTextIndexSpec.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.indexType != null && Object.hasOwnProperty.call(message, "indexType")) + switch (message.indexType) { + default: + return "indexType: enum value expected"; + case 0: + case 1: + break; + } + if (message.matchType != null && Object.hasOwnProperty.call(message, "matchType")) + switch (message.matchType) { + default: + return "matchType: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a SearchTextIndexSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec} SearchTextIndexSpec + */ + SearchTextIndexSpec.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec(); + switch (object.indexType) { + default: + if (typeof object.indexType === "number") { + message.indexType = object.indexType; + break; + } + break; + case "TEXT_INDEX_TYPE_UNSPECIFIED": + case 0: + message.indexType = 0; + break; + case "TOKENIZED": + case 1: + message.indexType = 1; + break; + } + switch (object.matchType) { + default: + if (typeof object.matchType === "number") { + message.matchType = object.matchType; + break; + } + break; + case "TEXT_MATCH_TYPE_UNSPECIFIED": + case 0: + message.matchType = 0; + break; + case "MATCH_GLOBALLY": + case 1: + message.matchType = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a SearchTextIndexSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec} message SearchTextIndexSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchTextIndexSpec.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.indexType = options.enums === String ? "TEXT_INDEX_TYPE_UNSPECIFIED" : 0; + object.matchType = options.enums === String ? "TEXT_MATCH_TYPE_UNSPECIFIED" : 0; + } + if (message.indexType != null && Object.hasOwnProperty.call(message, "indexType")) + object.indexType = options.enums === String ? $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType[message.indexType] === undefined ? message.indexType : $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType[message.indexType] : message.indexType; + if (message.matchType != null && Object.hasOwnProperty.call(message, "matchType")) + object.matchType = options.enums === String ? $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType[message.matchType] === undefined ? message.matchType : $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType[message.matchType] : message.matchType; + return object; + }; + + /** + * Converts this SearchTextIndexSpec to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @instance + * @returns {Object.} JSON object + */ + SearchTextIndexSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchTextIndexSpec + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchTextIndexSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec"; + }; + + return SearchTextIndexSpec; + })(); + + SearchConfig.SearchTextSpec = (function() { + + /** + * Properties of a SearchTextSpec. + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @interface ISearchTextSpec + * @property {Array.|null} [indexSpecs] SearchTextSpec indexSpecs + */ + + /** + * Constructs a new SearchTextSpec. + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @classdesc Represents a SearchTextSpec. + * @implements ISearchTextSpec + * @constructor + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec=} [properties] Properties to set + */ + function SearchTextSpec(properties) { + this.indexSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchTextSpec indexSpecs. + * @member {Array.} indexSpecs + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @instance + */ + SearchTextSpec.prototype.indexSpecs = $util.emptyArray; + + /** + * Creates a new SearchTextSpec instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec} SearchTextSpec instance + */ + SearchTextSpec.create = function create(properties) { + return new SearchTextSpec(properties); + }; + + /** + * Encodes the specified SearchTextSpec message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec} message SearchTextSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchTextSpec.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.indexSpecs != null && message.indexSpecs.length) + for (var i = 0; i < message.indexSpecs.length; ++i) + $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec.encode(message.indexSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified SearchTextSpec message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchTextSpec} message SearchTextSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchTextSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a SearchTextSpec message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec} SearchTextSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchTextSpec.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.indexSpecs && message.indexSpecs.length)) + message.indexSpecs = []; + message.indexSpecs.push($root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a SearchTextSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec} SearchTextSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchTextSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchTextSpec message. + * @function verify + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchTextSpec.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.indexSpecs != null && Object.hasOwnProperty.call(message, "indexSpecs")) { + if (!Array.isArray(message.indexSpecs)) + return "indexSpecs: array expected"; + for (var i = 0; i < message.indexSpecs.length; ++i) { + var error = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec.verify(message.indexSpecs[i], long + 1); + if (error) + return "indexSpecs." + error; + } + } + return null; + }; + + /** + * Creates a SearchTextSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec} SearchTextSpec + */ + SearchTextSpec.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec(); + if (object.indexSpecs) { + if (!Array.isArray(object.indexSpecs)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.indexSpecs: array expected"); + message.indexSpecs = []; + for (var i = 0; i < object.indexSpecs.length; ++i) { + if (!$util.isObject(object.indexSpecs[i])) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec.indexSpecs: object expected"); + message.indexSpecs[i] = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec.fromObject(object.indexSpecs[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a SearchTextSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec} message SearchTextSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchTextSpec.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.indexSpecs = []; + if (message.indexSpecs && message.indexSpecs.length) { + object.indexSpecs = []; + for (var j = 0; j < message.indexSpecs.length; ++j) + object.indexSpecs[j] = $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec.toObject(message.indexSpecs[j], options, q + 1); + } + return object; + }; + + /** + * Converts this SearchTextSpec to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @instance + * @returns {Object.} JSON object + */ + SearchTextSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchTextSpec + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchTextSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec"; + }; + + return SearchTextSpec; + })(); + + SearchConfig.SearchGeoSpec = (function() { + + /** + * Properties of a SearchGeoSpec. + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @interface ISearchGeoSpec + * @property {boolean|null} [geoJsonIndexingDisabled] SearchGeoSpec geoJsonIndexingDisabled + */ + + /** + * Constructs a new SearchGeoSpec. + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig + * @classdesc Represents a SearchGeoSpec. + * @implements ISearchGeoSpec + * @constructor + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec=} [properties] Properties to set + */ + function SearchGeoSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchGeoSpec geoJsonIndexingDisabled. + * @member {boolean} geoJsonIndexingDisabled + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @instance + */ + SearchGeoSpec.prototype.geoJsonIndexingDisabled = false; + + /** + * Creates a new SearchGeoSpec instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec} SearchGeoSpec instance + */ + SearchGeoSpec.create = function create(properties) { + return new SearchGeoSpec(properties); + }; + + /** + * Encodes the specified SearchGeoSpec message. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec} message SearchGeoSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchGeoSpec.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.geoJsonIndexingDisabled != null && Object.hasOwnProperty.call(message, "geoJsonIndexingDisabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.geoJsonIndexingDisabled); + return writer; + }; + + /** + * Encodes the specified SearchGeoSpec message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.ISearchGeoSpec} message SearchGeoSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchGeoSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a SearchGeoSpec message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec} SearchGeoSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchGeoSpec.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.geoJsonIndexingDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a SearchGeoSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec} SearchGeoSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchGeoSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchGeoSpec message. + * @function verify + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchGeoSpec.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.geoJsonIndexingDisabled != null && Object.hasOwnProperty.call(message, "geoJsonIndexingDisabled")) + if (typeof message.geoJsonIndexingDisabled !== "boolean") + return "geoJsonIndexingDisabled: boolean expected"; + return null; + }; + + /** + * Creates a SearchGeoSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec} SearchGeoSpec + */ + SearchGeoSpec.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec(); + if (object.geoJsonIndexingDisabled != null) + message.geoJsonIndexingDisabled = Boolean(object.geoJsonIndexingDisabled); + return message; + }; + + /** + * Creates a plain object from a SearchGeoSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @static + * @param {google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec} message SearchGeoSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchGeoSpec.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.geoJsonIndexingDisabled = false; + if (message.geoJsonIndexingDisabled != null && Object.hasOwnProperty.call(message, "geoJsonIndexingDisabled")) + object.geoJsonIndexingDisabled = message.geoJsonIndexingDisabled; + return object; + }; + + /** + * Converts this SearchGeoSpec to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @instance + * @returns {Object.} JSON object + */ + SearchGeoSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchGeoSpec + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchGeoSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec"; + }; + + return SearchGeoSpec; + })(); + + return SearchConfig; + })(); + + return IndexField; + })(); + + /** + * State enum. + * @name google.firestore.admin.v1.Index.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} READY=2 READY value + * @property {number} NEEDS_REPAIR=3 NEEDS_REPAIR value + */ + Index.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "READY"] = 2; + values[valuesById[3] = "NEEDS_REPAIR"] = 3; + return values; + })(); + + /** + * Density enum. + * @name google.firestore.admin.v1.Index.Density + * @enum {number} + * @property {number} DENSITY_UNSPECIFIED=0 DENSITY_UNSPECIFIED value + * @property {number} SPARSE_ALL=1 SPARSE_ALL value + * @property {number} SPARSE_ANY=2 SPARSE_ANY value + * @property {number} DENSE=3 DENSE value + */ + Index.Density = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DENSITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "SPARSE_ALL"] = 1; + values[valuesById[2] = "SPARSE_ANY"] = 2; + values[valuesById[3] = "DENSE"] = 3; + return values; + })(); + + Index.SearchIndexOptions = (function() { + + /** + * Properties of a SearchIndexOptions. + * @memberof google.firestore.admin.v1.Index + * @interface ISearchIndexOptions + * @property {string|null} [textLanguage] SearchIndexOptions textLanguage + * @property {string|null} [textLanguageOverrideFieldPath] SearchIndexOptions textLanguageOverrideFieldPath + */ + + /** + * Constructs a new SearchIndexOptions. + * @memberof google.firestore.admin.v1.Index + * @classdesc Represents a SearchIndexOptions. + * @implements ISearchIndexOptions + * @constructor + * @param {google.firestore.admin.v1.Index.ISearchIndexOptions=} [properties] Properties to set + */ + function SearchIndexOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchIndexOptions textLanguage. + * @member {string} textLanguage + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @instance + */ + SearchIndexOptions.prototype.textLanguage = ""; + + /** + * SearchIndexOptions textLanguageOverrideFieldPath. + * @member {string} textLanguageOverrideFieldPath + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @instance + */ + SearchIndexOptions.prototype.textLanguageOverrideFieldPath = ""; + + /** + * Creates a new SearchIndexOptions instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @static + * @param {google.firestore.admin.v1.Index.ISearchIndexOptions=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Index.SearchIndexOptions} SearchIndexOptions instance + */ + SearchIndexOptions.create = function create(properties) { + return new SearchIndexOptions(properties); + }; + + /** + * Encodes the specified SearchIndexOptions message. Does not implicitly {@link google.firestore.admin.v1.Index.SearchIndexOptions.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @static + * @param {google.firestore.admin.v1.Index.ISearchIndexOptions} message SearchIndexOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchIndexOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.textLanguage != null && Object.hasOwnProperty.call(message, "textLanguage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.textLanguage); + if (message.textLanguageOverrideFieldPath != null && Object.hasOwnProperty.call(message, "textLanguageOverrideFieldPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.textLanguageOverrideFieldPath); + return writer; + }; + + /** + * Encodes the specified SearchIndexOptions message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Index.SearchIndexOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @static + * @param {google.firestore.admin.v1.Index.ISearchIndexOptions} message SearchIndexOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchIndexOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a SearchIndexOptions message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Index.SearchIndexOptions} SearchIndexOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchIndexOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Index.SearchIndexOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.textLanguage = reader.string(); + break; + } + case 2: { + message.textLanguageOverrideFieldPath = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a SearchIndexOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Index.SearchIndexOptions} SearchIndexOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchIndexOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchIndexOptions message. + * @function verify + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchIndexOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.textLanguage != null && Object.hasOwnProperty.call(message, "textLanguage")) + if (!$util.isString(message.textLanguage)) + return "textLanguage: string expected"; + if (message.textLanguageOverrideFieldPath != null && Object.hasOwnProperty.call(message, "textLanguageOverrideFieldPath")) + if (!$util.isString(message.textLanguageOverrideFieldPath)) + return "textLanguageOverrideFieldPath: string expected"; + return null; + }; + + /** + * Creates a SearchIndexOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Index.SearchIndexOptions} SearchIndexOptions + */ + SearchIndexOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Index.SearchIndexOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Index.SearchIndexOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Index.SearchIndexOptions(); + if (object.textLanguage != null) + message.textLanguage = String(object.textLanguage); + if (object.textLanguageOverrideFieldPath != null) + message.textLanguageOverrideFieldPath = String(object.textLanguageOverrideFieldPath); + return message; + }; + + /** + * Creates a plain object from a SearchIndexOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @static + * @param {google.firestore.admin.v1.Index.SearchIndexOptions} message SearchIndexOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchIndexOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.textLanguage = ""; + object.textLanguageOverrideFieldPath = ""; + } + if (message.textLanguage != null && Object.hasOwnProperty.call(message, "textLanguage")) + object.textLanguage = message.textLanguage; + if (message.textLanguageOverrideFieldPath != null && Object.hasOwnProperty.call(message, "textLanguageOverrideFieldPath")) + object.textLanguageOverrideFieldPath = message.textLanguageOverrideFieldPath; + return object; + }; + + /** + * Converts this SearchIndexOptions to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @instance + * @returns {Object.} JSON object + */ + SearchIndexOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchIndexOptions + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Index.SearchIndexOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchIndexOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Index.SearchIndexOptions"; + }; + + return SearchIndexOptions; + })(); + + return Index; + })(); + + v1.FirestoreAdmin = (function() { + + /** + * Constructs a new FirestoreAdmin service. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a FirestoreAdmin + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function FirestoreAdmin(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (FirestoreAdmin.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = FirestoreAdmin; + + /** + * Creates new FirestoreAdmin service using the specified rpc implementation. + * @function create + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {FirestoreAdmin} RPC service. Useful where requests and/or responses are streamed. + */ + FirestoreAdmin.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|createIndex}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef CreateIndexCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateIndex. + * @function createIndex + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICreateIndexRequest} request CreateIndexRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.CreateIndexCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.createIndex = function createIndex(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createIndex, $root.google.firestore.admin.v1.CreateIndexRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateIndex" }); + + /** + * Calls CreateIndex. + * @function createIndex + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICreateIndexRequest} request CreateIndexRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listIndexes}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef ListIndexesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.ListIndexesResponse} [response] ListIndexesResponse + */ + + /** + * Calls ListIndexes. + * @function listIndexes + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListIndexesRequest} request ListIndexesRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.ListIndexesCallback} callback Node-style callback called with the error, if any, and ListIndexesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.listIndexes = function listIndexes(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listIndexes, $root.google.firestore.admin.v1.ListIndexesRequest, $root.google.firestore.admin.v1.ListIndexesResponse, request, callback); + }, "name", { value: "ListIndexes" }); + + /** + * Calls ListIndexes. + * @function listIndexes + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListIndexesRequest} request ListIndexesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getIndex}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef GetIndexCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.Index} [response] Index + */ + + /** + * Calls GetIndex. + * @function getIndex + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetIndexRequest} request GetIndexRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.GetIndexCallback} callback Node-style callback called with the error, if any, and Index + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.getIndex = function getIndex(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getIndex, $root.google.firestore.admin.v1.GetIndexRequest, $root.google.firestore.admin.v1.Index, request, callback); + }, "name", { value: "GetIndex" }); + + /** + * Calls GetIndex. + * @function getIndex + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetIndexRequest} request GetIndexRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteIndex}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef DeleteIndexCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteIndex. + * @function deleteIndex + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteIndexRequest} request DeleteIndexRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.DeleteIndexCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.deleteIndex = function deleteIndex(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteIndex, $root.google.firestore.admin.v1.DeleteIndexRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteIndex" }); + + /** + * Calls DeleteIndex. + * @function deleteIndex + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteIndexRequest} request DeleteIndexRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getField}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef GetFieldCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.Field} [response] Field + */ + + /** + * Calls GetField. + * @function getField + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetFieldRequest} request GetFieldRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.GetFieldCallback} callback Node-style callback called with the error, if any, and Field + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.getField = function getField(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getField, $root.google.firestore.admin.v1.GetFieldRequest, $root.google.firestore.admin.v1.Field, request, callback); + }, "name", { value: "GetField" }); + + /** + * Calls GetField. + * @function getField + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetFieldRequest} request GetFieldRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|updateField}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef UpdateFieldCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateField. + * @function updateField + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IUpdateFieldRequest} request UpdateFieldRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.UpdateFieldCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.updateField = function updateField(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, updateField, $root.google.firestore.admin.v1.UpdateFieldRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateField" }); + + /** + * Calls UpdateField. + * @function updateField + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IUpdateFieldRequest} request UpdateFieldRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listFields}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef ListFieldsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.ListFieldsResponse} [response] ListFieldsResponse + */ + + /** + * Calls ListFields. + * @function listFields + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListFieldsRequest} request ListFieldsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.ListFieldsCallback} callback Node-style callback called with the error, if any, and ListFieldsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.listFields = function listFields(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listFields, $root.google.firestore.admin.v1.ListFieldsRequest, $root.google.firestore.admin.v1.ListFieldsResponse, request, callback); + }, "name", { value: "ListFields" }); + + /** + * Calls ListFields. + * @function listFields + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListFieldsRequest} request ListFieldsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|exportDocuments}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef ExportDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ExportDocuments. + * @function exportDocuments + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IExportDocumentsRequest} request ExportDocumentsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.ExportDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.exportDocuments = function exportDocuments(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, exportDocuments, $root.google.firestore.admin.v1.ExportDocumentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ExportDocuments" }); + + /** + * Calls ExportDocuments. + * @function exportDocuments + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IExportDocumentsRequest} request ExportDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|importDocuments}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef ImportDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportDocuments. + * @function importDocuments + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IImportDocumentsRequest} request ImportDocumentsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.ImportDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.importDocuments = function importDocuments(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, importDocuments, $root.google.firestore.admin.v1.ImportDocumentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportDocuments" }); + + /** + * Calls ImportDocuments. + * @function importDocuments + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IImportDocumentsRequest} request ImportDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|bulkDeleteDocuments}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef BulkDeleteDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BulkDeleteDocuments. + * @function bulkDeleteDocuments + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsRequest} request BulkDeleteDocumentsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.bulkDeleteDocuments = function bulkDeleteDocuments(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, bulkDeleteDocuments, $root.google.firestore.admin.v1.BulkDeleteDocumentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BulkDeleteDocuments" }); + + /** + * Calls BulkDeleteDocuments. + * @function bulkDeleteDocuments + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsRequest} request BulkDeleteDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|createDatabase}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef CreateDatabaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateDatabase. + * @function createDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICreateDatabaseRequest} request CreateDatabaseRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.CreateDatabaseCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.createDatabase = function createDatabase(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createDatabase, $root.google.firestore.admin.v1.CreateDatabaseRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateDatabase" }); + + /** + * Calls CreateDatabase. + * @function createDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICreateDatabaseRequest} request CreateDatabaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getDatabase}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef GetDatabaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.Database} [response] Database + */ + + /** + * Calls GetDatabase. + * @function getDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetDatabaseRequest} request GetDatabaseRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.GetDatabaseCallback} callback Node-style callback called with the error, if any, and Database + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.getDatabase = function getDatabase(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getDatabase, $root.google.firestore.admin.v1.GetDatabaseRequest, $root.google.firestore.admin.v1.Database, request, callback); + }, "name", { value: "GetDatabase" }); + + /** + * Calls GetDatabase. + * @function getDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetDatabaseRequest} request GetDatabaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listDatabases}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef ListDatabasesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.ListDatabasesResponse} [response] ListDatabasesResponse + */ + + /** + * Calls ListDatabases. + * @function listDatabases + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListDatabasesRequest} request ListDatabasesRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.ListDatabasesCallback} callback Node-style callback called with the error, if any, and ListDatabasesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.listDatabases = function listDatabases(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listDatabases, $root.google.firestore.admin.v1.ListDatabasesRequest, $root.google.firestore.admin.v1.ListDatabasesResponse, request, callback); + }, "name", { value: "ListDatabases" }); + + /** + * Calls ListDatabases. + * @function listDatabases + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListDatabasesRequest} request ListDatabasesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|updateDatabase}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef UpdateDatabaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateDatabase. + * @function updateDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IUpdateDatabaseRequest} request UpdateDatabaseRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.UpdateDatabaseCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.updateDatabase = function updateDatabase(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, updateDatabase, $root.google.firestore.admin.v1.UpdateDatabaseRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateDatabase" }); + + /** + * Calls UpdateDatabase. + * @function updateDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IUpdateDatabaseRequest} request UpdateDatabaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteDatabase}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef DeleteDatabaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteDatabase. + * @function deleteDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteDatabaseRequest} request DeleteDatabaseRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.DeleteDatabaseCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.deleteDatabase = function deleteDatabase(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteDatabase, $root.google.firestore.admin.v1.DeleteDatabaseRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteDatabase" }); + + /** + * Calls DeleteDatabase. + * @function deleteDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteDatabaseRequest} request DeleteDatabaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|createUserCreds}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef CreateUserCredsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.UserCreds} [response] UserCreds + */ + + /** + * Calls CreateUserCreds. + * @function createUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICreateUserCredsRequest} request CreateUserCredsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.CreateUserCredsCallback} callback Node-style callback called with the error, if any, and UserCreds + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.createUserCreds = function createUserCreds(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createUserCreds, $root.google.firestore.admin.v1.CreateUserCredsRequest, $root.google.firestore.admin.v1.UserCreds, request, callback); + }, "name", { value: "CreateUserCreds" }); + + /** + * Calls CreateUserCreds. + * @function createUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICreateUserCredsRequest} request CreateUserCredsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getUserCreds}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef GetUserCredsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.UserCreds} [response] UserCreds + */ + + /** + * Calls GetUserCreds. + * @function getUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetUserCredsRequest} request GetUserCredsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.GetUserCredsCallback} callback Node-style callback called with the error, if any, and UserCreds + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.getUserCreds = function getUserCreds(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getUserCreds, $root.google.firestore.admin.v1.GetUserCredsRequest, $root.google.firestore.admin.v1.UserCreds, request, callback); + }, "name", { value: "GetUserCreds" }); + + /** + * Calls GetUserCreds. + * @function getUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetUserCredsRequest} request GetUserCredsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listUserCreds}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef ListUserCredsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.ListUserCredsResponse} [response] ListUserCredsResponse + */ + + /** + * Calls ListUserCreds. + * @function listUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListUserCredsRequest} request ListUserCredsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.ListUserCredsCallback} callback Node-style callback called with the error, if any, and ListUserCredsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.listUserCreds = function listUserCreds(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listUserCreds, $root.google.firestore.admin.v1.ListUserCredsRequest, $root.google.firestore.admin.v1.ListUserCredsResponse, request, callback); + }, "name", { value: "ListUserCreds" }); + + /** + * Calls ListUserCreds. + * @function listUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListUserCredsRequest} request ListUserCredsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|enableUserCreds}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef EnableUserCredsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.UserCreds} [response] UserCreds + */ + + /** + * Calls EnableUserCreds. + * @function enableUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IEnableUserCredsRequest} request EnableUserCredsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.EnableUserCredsCallback} callback Node-style callback called with the error, if any, and UserCreds + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.enableUserCreds = function enableUserCreds(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, enableUserCreds, $root.google.firestore.admin.v1.EnableUserCredsRequest, $root.google.firestore.admin.v1.UserCreds, request, callback); + }, "name", { value: "EnableUserCreds" }); + + /** + * Calls EnableUserCreds. + * @function enableUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IEnableUserCredsRequest} request EnableUserCredsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|disableUserCreds}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef DisableUserCredsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.UserCreds} [response] UserCreds + */ + + /** + * Calls DisableUserCreds. + * @function disableUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDisableUserCredsRequest} request DisableUserCredsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.DisableUserCredsCallback} callback Node-style callback called with the error, if any, and UserCreds + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.disableUserCreds = function disableUserCreds(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, disableUserCreds, $root.google.firestore.admin.v1.DisableUserCredsRequest, $root.google.firestore.admin.v1.UserCreds, request, callback); + }, "name", { value: "DisableUserCreds" }); + + /** + * Calls DisableUserCreds. + * @function disableUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDisableUserCredsRequest} request DisableUserCredsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|resetUserPassword}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef ResetUserPasswordCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.UserCreds} [response] UserCreds + */ + + /** + * Calls ResetUserPassword. + * @function resetUserPassword + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IResetUserPasswordRequest} request ResetUserPasswordRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.ResetUserPasswordCallback} callback Node-style callback called with the error, if any, and UserCreds + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.resetUserPassword = function resetUserPassword(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, resetUserPassword, $root.google.firestore.admin.v1.ResetUserPasswordRequest, $root.google.firestore.admin.v1.UserCreds, request, callback); + }, "name", { value: "ResetUserPassword" }); + + /** + * Calls ResetUserPassword. + * @function resetUserPassword + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IResetUserPasswordRequest} request ResetUserPasswordRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteUserCreds}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef DeleteUserCredsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteUserCreds. + * @function deleteUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteUserCredsRequest} request DeleteUserCredsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.DeleteUserCredsCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.deleteUserCreds = function deleteUserCreds(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteUserCreds, $root.google.firestore.admin.v1.DeleteUserCredsRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteUserCreds" }); + + /** + * Calls DeleteUserCreds. + * @function deleteUserCreds + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteUserCredsRequest} request DeleteUserCredsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getBackup}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef GetBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.Backup} [response] Backup + */ + + /** + * Calls GetBackup. + * @function getBackup + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetBackupRequest} request GetBackupRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.GetBackupCallback} callback Node-style callback called with the error, if any, and Backup + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.getBackup = function getBackup(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getBackup, $root.google.firestore.admin.v1.GetBackupRequest, $root.google.firestore.admin.v1.Backup, request, callback); + }, "name", { value: "GetBackup" }); + + /** + * Calls GetBackup. + * @function getBackup + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetBackupRequest} request GetBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listBackups}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef ListBackupsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.ListBackupsResponse} [response] ListBackupsResponse + */ + + /** + * Calls ListBackups. + * @function listBackups + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListBackupsRequest} request ListBackupsRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.ListBackupsCallback} callback Node-style callback called with the error, if any, and ListBackupsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.listBackups = function listBackups(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listBackups, $root.google.firestore.admin.v1.ListBackupsRequest, $root.google.firestore.admin.v1.ListBackupsResponse, request, callback); + }, "name", { value: "ListBackups" }); + + /** + * Calls ListBackups. + * @function listBackups + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListBackupsRequest} request ListBackupsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteBackup}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef DeleteBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteBackup. + * @function deleteBackup + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteBackupRequest} request DeleteBackupRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.DeleteBackupCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.deleteBackup = function deleteBackup(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteBackup, $root.google.firestore.admin.v1.DeleteBackupRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteBackup" }); + + /** + * Calls DeleteBackup. + * @function deleteBackup + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteBackupRequest} request DeleteBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|restoreDatabase}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef RestoreDatabaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RestoreDatabase. + * @function restoreDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IRestoreDatabaseRequest} request RestoreDatabaseRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.RestoreDatabaseCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.restoreDatabase = function restoreDatabase(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, restoreDatabase, $root.google.firestore.admin.v1.RestoreDatabaseRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RestoreDatabase" }); + + /** + * Calls RestoreDatabase. + * @function restoreDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IRestoreDatabaseRequest} request RestoreDatabaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|createBackupSchedule}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef CreateBackupScheduleCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.BackupSchedule} [response] BackupSchedule + */ + + /** + * Calls CreateBackupSchedule. + * @function createBackupSchedule + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICreateBackupScheduleRequest} request CreateBackupScheduleRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.CreateBackupScheduleCallback} callback Node-style callback called with the error, if any, and BackupSchedule + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.createBackupSchedule = function createBackupSchedule(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createBackupSchedule, $root.google.firestore.admin.v1.CreateBackupScheduleRequest, $root.google.firestore.admin.v1.BackupSchedule, request, callback); + }, "name", { value: "CreateBackupSchedule" }); + + /** + * Calls CreateBackupSchedule. + * @function createBackupSchedule + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICreateBackupScheduleRequest} request CreateBackupScheduleRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|getBackupSchedule}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef GetBackupScheduleCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.BackupSchedule} [response] BackupSchedule + */ + + /** + * Calls GetBackupSchedule. + * @function getBackupSchedule + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetBackupScheduleRequest} request GetBackupScheduleRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.GetBackupScheduleCallback} callback Node-style callback called with the error, if any, and BackupSchedule + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.getBackupSchedule = function getBackupSchedule(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getBackupSchedule, $root.google.firestore.admin.v1.GetBackupScheduleRequest, $root.google.firestore.admin.v1.BackupSchedule, request, callback); + }, "name", { value: "GetBackupSchedule" }); + + /** + * Calls GetBackupSchedule. + * @function getBackupSchedule + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IGetBackupScheduleRequest} request GetBackupScheduleRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|listBackupSchedules}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef ListBackupSchedulesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.ListBackupSchedulesResponse} [response] ListBackupSchedulesResponse + */ + + /** + * Calls ListBackupSchedules. + * @function listBackupSchedules + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListBackupSchedulesRequest} request ListBackupSchedulesRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedulesCallback} callback Node-style callback called with the error, if any, and ListBackupSchedulesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.listBackupSchedules = function listBackupSchedules(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listBackupSchedules, $root.google.firestore.admin.v1.ListBackupSchedulesRequest, $root.google.firestore.admin.v1.ListBackupSchedulesResponse, request, callback); + }, "name", { value: "ListBackupSchedules" }); + + /** + * Calls ListBackupSchedules. + * @function listBackupSchedules + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IListBackupSchedulesRequest} request ListBackupSchedulesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|updateBackupSchedule}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef UpdateBackupScheduleCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.admin.v1.BackupSchedule} [response] BackupSchedule + */ + + /** + * Calls UpdateBackupSchedule. + * @function updateBackupSchedule + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IUpdateBackupScheduleRequest} request UpdateBackupScheduleRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.UpdateBackupScheduleCallback} callback Node-style callback called with the error, if any, and BackupSchedule + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.updateBackupSchedule = function updateBackupSchedule(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, updateBackupSchedule, $root.google.firestore.admin.v1.UpdateBackupScheduleRequest, $root.google.firestore.admin.v1.BackupSchedule, request, callback); + }, "name", { value: "UpdateBackupSchedule" }); + + /** + * Calls UpdateBackupSchedule. + * @function updateBackupSchedule + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IUpdateBackupScheduleRequest} request UpdateBackupScheduleRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|deleteBackupSchedule}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef DeleteBackupScheduleCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteBackupSchedule. + * @function deleteBackupSchedule + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteBackupScheduleRequest} request DeleteBackupScheduleRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.DeleteBackupScheduleCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.deleteBackupSchedule = function deleteBackupSchedule(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteBackupSchedule, $root.google.firestore.admin.v1.DeleteBackupScheduleRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteBackupSchedule" }); + + /** + * Calls DeleteBackupSchedule. + * @function deleteBackupSchedule + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.IDeleteBackupScheduleRequest} request DeleteBackupScheduleRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.admin.v1.FirestoreAdmin|cloneDatabase}. + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @typedef CloneDatabaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CloneDatabase. + * @function cloneDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICloneDatabaseRequest} request CloneDatabaseRequest message or plain object + * @param {google.firestore.admin.v1.FirestoreAdmin.CloneDatabaseCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirestoreAdmin.prototype.cloneDatabase = function cloneDatabase(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, cloneDatabase, $root.google.firestore.admin.v1.CloneDatabaseRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CloneDatabase" }); + + /** + * Calls CloneDatabase. + * @function cloneDatabase + * @memberof google.firestore.admin.v1.FirestoreAdmin + * @instance + * @param {google.firestore.admin.v1.ICloneDatabaseRequest} request CloneDatabaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return FirestoreAdmin; + })(); + + v1.ListDatabasesRequest = (function() { + + /** + * Properties of a ListDatabasesRequest. + * @memberof google.firestore.admin.v1 + * @interface IListDatabasesRequest + * @property {string|null} [parent] ListDatabasesRequest parent + * @property {boolean|null} [showDeleted] ListDatabasesRequest showDeleted + */ + + /** + * Constructs a new ListDatabasesRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListDatabasesRequest. + * @implements IListDatabasesRequest + * @constructor + * @param {google.firestore.admin.v1.IListDatabasesRequest=} [properties] Properties to set + */ + function ListDatabasesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDatabasesRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @instance + */ + ListDatabasesRequest.prototype.parent = ""; + + /** + * ListDatabasesRequest showDeleted. + * @member {boolean} showDeleted + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @instance + */ + ListDatabasesRequest.prototype.showDeleted = false; + + /** + * Creates a new ListDatabasesRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @static + * @param {google.firestore.admin.v1.IListDatabasesRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListDatabasesRequest} ListDatabasesRequest instance + */ + ListDatabasesRequest.create = function create(properties) { + return new ListDatabasesRequest(properties); + }; + + /** + * Encodes the specified ListDatabasesRequest message. Does not implicitly {@link google.firestore.admin.v1.ListDatabasesRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @static + * @param {google.firestore.admin.v1.IListDatabasesRequest} message ListDatabasesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDatabasesRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.showDeleted != null && Object.hasOwnProperty.call(message, "showDeleted")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.showDeleted); + return writer; + }; + + /** + * Encodes the specified ListDatabasesRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListDatabasesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @static + * @param {google.firestore.admin.v1.IListDatabasesRequest} message ListDatabasesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDatabasesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListDatabasesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListDatabasesRequest} ListDatabasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDatabasesRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListDatabasesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 4: { + message.showDeleted = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListDatabasesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListDatabasesRequest} ListDatabasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDatabasesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDatabasesRequest message. + * @function verify + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDatabasesRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.showDeleted != null && Object.hasOwnProperty.call(message, "showDeleted")) + if (typeof message.showDeleted !== "boolean") + return "showDeleted: boolean expected"; + return null; + }; + + /** + * Creates a ListDatabasesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListDatabasesRequest} ListDatabasesRequest + */ + ListDatabasesRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListDatabasesRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListDatabasesRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListDatabasesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.showDeleted != null) + message.showDeleted = Boolean(object.showDeleted); + return message; + }; + + /** + * Creates a plain object from a ListDatabasesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @static + * @param {google.firestore.admin.v1.ListDatabasesRequest} message ListDatabasesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDatabasesRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.showDeleted = false; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.showDeleted != null && Object.hasOwnProperty.call(message, "showDeleted")) + object.showDeleted = message.showDeleted; + return object; + }; + + /** + * Converts this ListDatabasesRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @instance + * @returns {Object.} JSON object + */ + ListDatabasesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDatabasesRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListDatabasesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDatabasesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListDatabasesRequest"; + }; + + return ListDatabasesRequest; + })(); + + v1.CreateDatabaseRequest = (function() { + + /** + * Properties of a CreateDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @interface ICreateDatabaseRequest + * @property {string|null} [parent] CreateDatabaseRequest parent + * @property {google.firestore.admin.v1.IDatabase|null} [database] CreateDatabaseRequest database + * @property {string|null} [databaseId] CreateDatabaseRequest databaseId + */ + + /** + * Constructs a new CreateDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a CreateDatabaseRequest. + * @implements ICreateDatabaseRequest + * @constructor + * @param {google.firestore.admin.v1.ICreateDatabaseRequest=} [properties] Properties to set + */ + function CreateDatabaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateDatabaseRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @instance + */ + CreateDatabaseRequest.prototype.parent = ""; + + /** + * CreateDatabaseRequest database. + * @member {google.firestore.admin.v1.IDatabase|null|undefined} database + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @instance + */ + CreateDatabaseRequest.prototype.database = null; + + /** + * CreateDatabaseRequest databaseId. + * @member {string} databaseId + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @instance + */ + CreateDatabaseRequest.prototype.databaseId = ""; + + /** + * Creates a new CreateDatabaseRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @static + * @param {google.firestore.admin.v1.ICreateDatabaseRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.CreateDatabaseRequest} CreateDatabaseRequest instance + */ + CreateDatabaseRequest.create = function create(properties) { + return new CreateDatabaseRequest(properties); + }; + + /** + * Encodes the specified CreateDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.CreateDatabaseRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @static + * @param {google.firestore.admin.v1.ICreateDatabaseRequest} message CreateDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDatabaseRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + $root.google.firestore.admin.v1.Database.encode(message.database, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.databaseId != null && Object.hasOwnProperty.call(message, "databaseId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.databaseId); + return writer; + }; + + /** + * Encodes the specified CreateDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateDatabaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @static + * @param {google.firestore.admin.v1.ICreateDatabaseRequest} message CreateDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDatabaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CreateDatabaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.CreateDatabaseRequest} CreateDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDatabaseRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.CreateDatabaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.database = $root.google.firestore.admin.v1.Database.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.databaseId = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CreateDatabaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.CreateDatabaseRequest} CreateDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDatabaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateDatabaseRequest message. + * @function verify + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateDatabaseRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) { + var error = $root.google.firestore.admin.v1.Database.verify(message.database, long + 1); + if (error) + return "database." + error; + } + if (message.databaseId != null && Object.hasOwnProperty.call(message, "databaseId")) + if (!$util.isString(message.databaseId)) + return "databaseId: string expected"; + return null; + }; + + /** + * Creates a CreateDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.CreateDatabaseRequest} CreateDatabaseRequest + */ + CreateDatabaseRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.CreateDatabaseRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.CreateDatabaseRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.CreateDatabaseRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.database != null) { + if (!$util.isObject(object.database)) + throw TypeError(".google.firestore.admin.v1.CreateDatabaseRequest.database: object expected"); + message.database = $root.google.firestore.admin.v1.Database.fromObject(object.database, long + 1); + } + if (object.databaseId != null) + message.databaseId = String(object.databaseId); + return message; + }; + + /** + * Creates a plain object from a CreateDatabaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @static + * @param {google.firestore.admin.v1.CreateDatabaseRequest} message CreateDatabaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateDatabaseRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.database = null; + object.databaseId = ""; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = $root.google.firestore.admin.v1.Database.toObject(message.database, options, q + 1); + if (message.databaseId != null && Object.hasOwnProperty.call(message, "databaseId")) + object.databaseId = message.databaseId; + return object; + }; + + /** + * Converts this CreateDatabaseRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @instance + * @returns {Object.} JSON object + */ + CreateDatabaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateDatabaseRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.CreateDatabaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateDatabaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.CreateDatabaseRequest"; + }; + + return CreateDatabaseRequest; + })(); + + v1.CreateDatabaseMetadata = (function() { + + /** + * Properties of a CreateDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @interface ICreateDatabaseMetadata + */ + + /** + * Constructs a new CreateDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a CreateDatabaseMetadata. + * @implements ICreateDatabaseMetadata + * @constructor + * @param {google.firestore.admin.v1.ICreateDatabaseMetadata=} [properties] Properties to set + */ + function CreateDatabaseMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new CreateDatabaseMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.ICreateDatabaseMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.CreateDatabaseMetadata} CreateDatabaseMetadata instance + */ + CreateDatabaseMetadata.create = function create(properties) { + return new CreateDatabaseMetadata(properties); + }; + + /** + * Encodes the specified CreateDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.CreateDatabaseMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.ICreateDatabaseMetadata} message CreateDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDatabaseMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified CreateDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateDatabaseMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.ICreateDatabaseMetadata} message CreateDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDatabaseMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CreateDatabaseMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.CreateDatabaseMetadata} CreateDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDatabaseMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.CreateDatabaseMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CreateDatabaseMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.CreateDatabaseMetadata} CreateDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDatabaseMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateDatabaseMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateDatabaseMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates a CreateDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.CreateDatabaseMetadata} CreateDatabaseMetadata + */ + CreateDatabaseMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.CreateDatabaseMetadata) + return object; + return new $root.google.firestore.admin.v1.CreateDatabaseMetadata(); + }; + + /** + * Creates a plain object from a CreateDatabaseMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.CreateDatabaseMetadata} message CreateDatabaseMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateDatabaseMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this CreateDatabaseMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateDatabaseMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateDatabaseMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.CreateDatabaseMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateDatabaseMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.CreateDatabaseMetadata"; + }; + + return CreateDatabaseMetadata; + })(); + + v1.ListDatabasesResponse = (function() { + + /** + * Properties of a ListDatabasesResponse. + * @memberof google.firestore.admin.v1 + * @interface IListDatabasesResponse + * @property {Array.|null} [databases] ListDatabasesResponse databases + * @property {Array.|null} [unreachable] ListDatabasesResponse unreachable + */ + + /** + * Constructs a new ListDatabasesResponse. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListDatabasesResponse. + * @implements IListDatabasesResponse + * @constructor + * @param {google.firestore.admin.v1.IListDatabasesResponse=} [properties] Properties to set + */ + function ListDatabasesResponse(properties) { + this.databases = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDatabasesResponse databases. + * @member {Array.} databases + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @instance + */ + ListDatabasesResponse.prototype.databases = $util.emptyArray; + + /** + * ListDatabasesResponse unreachable. + * @member {Array.} unreachable + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @instance + */ + ListDatabasesResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListDatabasesResponse instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @static + * @param {google.firestore.admin.v1.IListDatabasesResponse=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListDatabasesResponse} ListDatabasesResponse instance + */ + ListDatabasesResponse.create = function create(properties) { + return new ListDatabasesResponse(properties); + }; + + /** + * Encodes the specified ListDatabasesResponse message. Does not implicitly {@link google.firestore.admin.v1.ListDatabasesResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @static + * @param {google.firestore.admin.v1.IListDatabasesResponse} message ListDatabasesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDatabasesResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.databases != null && message.databases.length) + for (var i = 0; i < message.databases.length; ++i) + $root.google.firestore.admin.v1.Database.encode(message.databases[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListDatabasesResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListDatabasesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @static + * @param {google.firestore.admin.v1.IListDatabasesResponse} message ListDatabasesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDatabasesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListDatabasesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListDatabasesResponse} ListDatabasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDatabasesResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListDatabasesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.databases && message.databases.length)) + message.databases = []; + message.databases.push($root.google.firestore.admin.v1.Database.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListDatabasesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListDatabasesResponse} ListDatabasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDatabasesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDatabasesResponse message. + * @function verify + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDatabasesResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.databases != null && Object.hasOwnProperty.call(message, "databases")) { + if (!Array.isArray(message.databases)) + return "databases: array expected"; + for (var i = 0; i < message.databases.length; ++i) { + var error = $root.google.firestore.admin.v1.Database.verify(message.databases[i], long + 1); + if (error) + return "databases." + error; + } + } + if (message.unreachable != null && Object.hasOwnProperty.call(message, "unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListDatabasesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListDatabasesResponse} ListDatabasesResponse + */ + ListDatabasesResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListDatabasesResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListDatabasesResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListDatabasesResponse(); + if (object.databases) { + if (!Array.isArray(object.databases)) + throw TypeError(".google.firestore.admin.v1.ListDatabasesResponse.databases: array expected"); + message.databases = []; + for (var i = 0; i < object.databases.length; ++i) { + if (!$util.isObject(object.databases[i])) + throw TypeError(".google.firestore.admin.v1.ListDatabasesResponse.databases: object expected"); + message.databases[i] = $root.google.firestore.admin.v1.Database.fromObject(object.databases[i], long + 1); + } + } + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.firestore.admin.v1.ListDatabasesResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListDatabasesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @static + * @param {google.firestore.admin.v1.ListDatabasesResponse} message ListDatabasesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDatabasesResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.databases = []; + object.unreachable = []; + } + if (message.databases && message.databases.length) { + object.databases = []; + for (var j = 0; j < message.databases.length; ++j) + object.databases[j] = $root.google.firestore.admin.v1.Database.toObject(message.databases[j], options, q + 1); + } + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListDatabasesResponse to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @instance + * @returns {Object.} JSON object + */ + ListDatabasesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDatabasesResponse + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListDatabasesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDatabasesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListDatabasesResponse"; + }; + + return ListDatabasesResponse; + })(); + + v1.GetDatabaseRequest = (function() { + + /** + * Properties of a GetDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @interface IGetDatabaseRequest + * @property {string|null} [name] GetDatabaseRequest name + */ + + /** + * Constructs a new GetDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a GetDatabaseRequest. + * @implements IGetDatabaseRequest + * @constructor + * @param {google.firestore.admin.v1.IGetDatabaseRequest=} [properties] Properties to set + */ + function GetDatabaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDatabaseRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @instance + */ + GetDatabaseRequest.prototype.name = ""; + + /** + * Creates a new GetDatabaseRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IGetDatabaseRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.GetDatabaseRequest} GetDatabaseRequest instance + */ + GetDatabaseRequest.create = function create(properties) { + return new GetDatabaseRequest(properties); + }; + + /** + * Encodes the specified GetDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.GetDatabaseRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IGetDatabaseRequest} message GetDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDatabaseRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetDatabaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IGetDatabaseRequest} message GetDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDatabaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GetDatabaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.GetDatabaseRequest} GetDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDatabaseRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.GetDatabaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GetDatabaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.GetDatabaseRequest} GetDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDatabaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDatabaseRequest message. + * @function verify + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDatabaseRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.GetDatabaseRequest} GetDatabaseRequest + */ + GetDatabaseRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.GetDatabaseRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.GetDatabaseRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.GetDatabaseRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetDatabaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @static + * @param {google.firestore.admin.v1.GetDatabaseRequest} message GetDatabaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDatabaseRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetDatabaseRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @instance + * @returns {Object.} JSON object + */ + GetDatabaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetDatabaseRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.GetDatabaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDatabaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.GetDatabaseRequest"; + }; + + return GetDatabaseRequest; + })(); + + v1.UpdateDatabaseRequest = (function() { + + /** + * Properties of an UpdateDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @interface IUpdateDatabaseRequest + * @property {google.firestore.admin.v1.IDatabase|null} [database] UpdateDatabaseRequest database + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateDatabaseRequest updateMask + */ + + /** + * Constructs a new UpdateDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an UpdateDatabaseRequest. + * @implements IUpdateDatabaseRequest + * @constructor + * @param {google.firestore.admin.v1.IUpdateDatabaseRequest=} [properties] Properties to set + */ + function UpdateDatabaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateDatabaseRequest database. + * @member {google.firestore.admin.v1.IDatabase|null|undefined} database + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @instance + */ + UpdateDatabaseRequest.prototype.database = null; + + /** + * UpdateDatabaseRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @instance + */ + UpdateDatabaseRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateDatabaseRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IUpdateDatabaseRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.UpdateDatabaseRequest} UpdateDatabaseRequest instance + */ + UpdateDatabaseRequest.create = function create(properties) { + return new UpdateDatabaseRequest(properties); + }; + + /** + * Encodes the specified UpdateDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.UpdateDatabaseRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IUpdateDatabaseRequest} message UpdateDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDatabaseRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + $root.google.firestore.admin.v1.Database.encode(message.database, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UpdateDatabaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IUpdateDatabaseRequest} message UpdateDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDatabaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UpdateDatabaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.UpdateDatabaseRequest} UpdateDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDatabaseRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.UpdateDatabaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = $root.google.firestore.admin.v1.Database.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateDatabaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.UpdateDatabaseRequest} UpdateDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDatabaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateDatabaseRequest message. + * @function verify + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateDatabaseRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) { + var error = $root.google.firestore.admin.v1.Database.verify(message.database, long + 1); + if (error) + return "database." + error; + } + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.UpdateDatabaseRequest} UpdateDatabaseRequest + */ + UpdateDatabaseRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.UpdateDatabaseRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.UpdateDatabaseRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.UpdateDatabaseRequest(); + if (object.database != null) { + if (!$util.isObject(object.database)) + throw TypeError(".google.firestore.admin.v1.UpdateDatabaseRequest.database: object expected"); + message.database = $root.google.firestore.admin.v1.Database.fromObject(object.database, long + 1); + } + if (object.updateMask != null) { + if (!$util.isObject(object.updateMask)) + throw TypeError(".google.firestore.admin.v1.UpdateDatabaseRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an UpdateDatabaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @static + * @param {google.firestore.admin.v1.UpdateDatabaseRequest} message UpdateDatabaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateDatabaseRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.database = null; + object.updateMask = null; + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = $root.google.firestore.admin.v1.Database.toObject(message.database, options, q + 1); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options, q + 1); + return object; + }; + + /** + * Converts this UpdateDatabaseRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateDatabaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateDatabaseRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.UpdateDatabaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateDatabaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.UpdateDatabaseRequest"; + }; + + return UpdateDatabaseRequest; + })(); + + v1.UpdateDatabaseMetadata = (function() { + + /** + * Properties of an UpdateDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @interface IUpdateDatabaseMetadata + */ + + /** + * Constructs a new UpdateDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an UpdateDatabaseMetadata. + * @implements IUpdateDatabaseMetadata + * @constructor + * @param {google.firestore.admin.v1.IUpdateDatabaseMetadata=} [properties] Properties to set + */ + function UpdateDatabaseMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new UpdateDatabaseMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.IUpdateDatabaseMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.UpdateDatabaseMetadata} UpdateDatabaseMetadata instance + */ + UpdateDatabaseMetadata.create = function create(properties) { + return new UpdateDatabaseMetadata(properties); + }; + + /** + * Encodes the specified UpdateDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.UpdateDatabaseMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.IUpdateDatabaseMetadata} message UpdateDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDatabaseMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified UpdateDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UpdateDatabaseMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.IUpdateDatabaseMetadata} message UpdateDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDatabaseMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UpdateDatabaseMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.UpdateDatabaseMetadata} UpdateDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDatabaseMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.UpdateDatabaseMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateDatabaseMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.UpdateDatabaseMetadata} UpdateDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDatabaseMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateDatabaseMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateDatabaseMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates an UpdateDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.UpdateDatabaseMetadata} UpdateDatabaseMetadata + */ + UpdateDatabaseMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.UpdateDatabaseMetadata) + return object; + return new $root.google.firestore.admin.v1.UpdateDatabaseMetadata(); + }; + + /** + * Creates a plain object from an UpdateDatabaseMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.UpdateDatabaseMetadata} message UpdateDatabaseMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateDatabaseMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this UpdateDatabaseMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @instance + * @returns {Object.} JSON object + */ + UpdateDatabaseMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateDatabaseMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.UpdateDatabaseMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateDatabaseMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.UpdateDatabaseMetadata"; + }; + + return UpdateDatabaseMetadata; + })(); + + v1.DeleteDatabaseRequest = (function() { + + /** + * Properties of a DeleteDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @interface IDeleteDatabaseRequest + * @property {string|null} [name] DeleteDatabaseRequest name + * @property {string|null} [etag] DeleteDatabaseRequest etag + */ + + /** + * Constructs a new DeleteDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a DeleteDatabaseRequest. + * @implements IDeleteDatabaseRequest + * @constructor + * @param {google.firestore.admin.v1.IDeleteDatabaseRequest=} [properties] Properties to set + */ + function DeleteDatabaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteDatabaseRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @instance + */ + DeleteDatabaseRequest.prototype.name = ""; + + /** + * DeleteDatabaseRequest etag. + * @member {string} etag + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @instance + */ + DeleteDatabaseRequest.prototype.etag = ""; + + /** + * Creates a new DeleteDatabaseRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IDeleteDatabaseRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.DeleteDatabaseRequest} DeleteDatabaseRequest instance + */ + DeleteDatabaseRequest.create = function create(properties) { + return new DeleteDatabaseRequest(properties); + }; + + /** + * Encodes the specified DeleteDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteDatabaseRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IDeleteDatabaseRequest} message DeleteDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDatabaseRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.etag); + return writer; + }; + + /** + * Encodes the specified DeleteDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteDatabaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IDeleteDatabaseRequest} message DeleteDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDatabaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DeleteDatabaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.DeleteDatabaseRequest} DeleteDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDatabaseRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.DeleteDatabaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.etag = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteDatabaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.DeleteDatabaseRequest} DeleteDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDatabaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteDatabaseRequest message. + * @function verify + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteDatabaseRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + return null; + }; + + /** + * Creates a DeleteDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.DeleteDatabaseRequest} DeleteDatabaseRequest + */ + DeleteDatabaseRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.DeleteDatabaseRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.DeleteDatabaseRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.DeleteDatabaseRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.etag != null) + message.etag = String(object.etag); + return message; + }; + + /** + * Creates a plain object from a DeleteDatabaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @static + * @param {google.firestore.admin.v1.DeleteDatabaseRequest} message DeleteDatabaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteDatabaseRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.etag = ""; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + object.etag = message.etag; + return object; + }; + + /** + * Converts this DeleteDatabaseRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteDatabaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteDatabaseRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.DeleteDatabaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteDatabaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.DeleteDatabaseRequest"; + }; + + return DeleteDatabaseRequest; + })(); + + v1.DeleteDatabaseMetadata = (function() { + + /** + * Properties of a DeleteDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @interface IDeleteDatabaseMetadata + */ + + /** + * Constructs a new DeleteDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a DeleteDatabaseMetadata. + * @implements IDeleteDatabaseMetadata + * @constructor + * @param {google.firestore.admin.v1.IDeleteDatabaseMetadata=} [properties] Properties to set + */ + function DeleteDatabaseMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new DeleteDatabaseMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.IDeleteDatabaseMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.DeleteDatabaseMetadata} DeleteDatabaseMetadata instance + */ + DeleteDatabaseMetadata.create = function create(properties) { + return new DeleteDatabaseMetadata(properties); + }; + + /** + * Encodes the specified DeleteDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.DeleteDatabaseMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.IDeleteDatabaseMetadata} message DeleteDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDatabaseMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified DeleteDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteDatabaseMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.IDeleteDatabaseMetadata} message DeleteDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDatabaseMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DeleteDatabaseMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.DeleteDatabaseMetadata} DeleteDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDatabaseMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.DeleteDatabaseMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteDatabaseMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.DeleteDatabaseMetadata} DeleteDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDatabaseMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteDatabaseMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteDatabaseMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates a DeleteDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.DeleteDatabaseMetadata} DeleteDatabaseMetadata + */ + DeleteDatabaseMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.DeleteDatabaseMetadata) + return object; + return new $root.google.firestore.admin.v1.DeleteDatabaseMetadata(); + }; + + /** + * Creates a plain object from a DeleteDatabaseMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.DeleteDatabaseMetadata} message DeleteDatabaseMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteDatabaseMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DeleteDatabaseMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteDatabaseMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteDatabaseMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.DeleteDatabaseMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteDatabaseMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.DeleteDatabaseMetadata"; + }; + + return DeleteDatabaseMetadata; + })(); + + v1.CreateUserCredsRequest = (function() { + + /** + * Properties of a CreateUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @interface ICreateUserCredsRequest + * @property {string|null} [parent] CreateUserCredsRequest parent + * @property {google.firestore.admin.v1.IUserCreds|null} [userCreds] CreateUserCredsRequest userCreds + * @property {string|null} [userCredsId] CreateUserCredsRequest userCredsId + */ + + /** + * Constructs a new CreateUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a CreateUserCredsRequest. + * @implements ICreateUserCredsRequest + * @constructor + * @param {google.firestore.admin.v1.ICreateUserCredsRequest=} [properties] Properties to set + */ + function CreateUserCredsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateUserCredsRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @instance + */ + CreateUserCredsRequest.prototype.parent = ""; + + /** + * CreateUserCredsRequest userCreds. + * @member {google.firestore.admin.v1.IUserCreds|null|undefined} userCreds + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @instance + */ + CreateUserCredsRequest.prototype.userCreds = null; + + /** + * CreateUserCredsRequest userCredsId. + * @member {string} userCredsId + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @instance + */ + CreateUserCredsRequest.prototype.userCredsId = ""; + + /** + * Creates a new CreateUserCredsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @static + * @param {google.firestore.admin.v1.ICreateUserCredsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.CreateUserCredsRequest} CreateUserCredsRequest instance + */ + CreateUserCredsRequest.create = function create(properties) { + return new CreateUserCredsRequest(properties); + }; + + /** + * Encodes the specified CreateUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.CreateUserCredsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @static + * @param {google.firestore.admin.v1.ICreateUserCredsRequest} message CreateUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateUserCredsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userCreds != null && Object.hasOwnProperty.call(message, "userCreds")) + $root.google.firestore.admin.v1.UserCreds.encode(message.userCreds, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.userCredsId != null && Object.hasOwnProperty.call(message, "userCredsId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userCredsId); + return writer; + }; + + /** + * Encodes the specified CreateUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateUserCredsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @static + * @param {google.firestore.admin.v1.ICreateUserCredsRequest} message CreateUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateUserCredsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CreateUserCredsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.CreateUserCredsRequest} CreateUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateUserCredsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.CreateUserCredsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userCreds = $root.google.firestore.admin.v1.UserCreds.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.userCredsId = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CreateUserCredsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.CreateUserCredsRequest} CreateUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateUserCredsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateUserCredsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateUserCredsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userCreds != null && Object.hasOwnProperty.call(message, "userCreds")) { + var error = $root.google.firestore.admin.v1.UserCreds.verify(message.userCreds, long + 1); + if (error) + return "userCreds." + error; + } + if (message.userCredsId != null && Object.hasOwnProperty.call(message, "userCredsId")) + if (!$util.isString(message.userCredsId)) + return "userCredsId: string expected"; + return null; + }; + + /** + * Creates a CreateUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.CreateUserCredsRequest} CreateUserCredsRequest + */ + CreateUserCredsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.CreateUserCredsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.CreateUserCredsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.CreateUserCredsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userCreds != null) { + if (!$util.isObject(object.userCreds)) + throw TypeError(".google.firestore.admin.v1.CreateUserCredsRequest.userCreds: object expected"); + message.userCreds = $root.google.firestore.admin.v1.UserCreds.fromObject(object.userCreds, long + 1); + } + if (object.userCredsId != null) + message.userCredsId = String(object.userCredsId); + return message; + }; + + /** + * Creates a plain object from a CreateUserCredsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @static + * @param {google.firestore.admin.v1.CreateUserCredsRequest} message CreateUserCredsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateUserCredsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userCreds = null; + object.userCredsId = ""; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.userCreds != null && Object.hasOwnProperty.call(message, "userCreds")) + object.userCreds = $root.google.firestore.admin.v1.UserCreds.toObject(message.userCreds, options, q + 1); + if (message.userCredsId != null && Object.hasOwnProperty.call(message, "userCredsId")) + object.userCredsId = message.userCredsId; + return object; + }; + + /** + * Converts this CreateUserCredsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @instance + * @returns {Object.} JSON object + */ + CreateUserCredsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateUserCredsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.CreateUserCredsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateUserCredsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.CreateUserCredsRequest"; + }; + + return CreateUserCredsRequest; + })(); + + v1.GetUserCredsRequest = (function() { + + /** + * Properties of a GetUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @interface IGetUserCredsRequest + * @property {string|null} [name] GetUserCredsRequest name + */ + + /** + * Constructs a new GetUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a GetUserCredsRequest. + * @implements IGetUserCredsRequest + * @constructor + * @param {google.firestore.admin.v1.IGetUserCredsRequest=} [properties] Properties to set + */ + function GetUserCredsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetUserCredsRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @instance + */ + GetUserCredsRequest.prototype.name = ""; + + /** + * Creates a new GetUserCredsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IGetUserCredsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.GetUserCredsRequest} GetUserCredsRequest instance + */ + GetUserCredsRequest.create = function create(properties) { + return new GetUserCredsRequest(properties); + }; + + /** + * Encodes the specified GetUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.GetUserCredsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IGetUserCredsRequest} message GetUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetUserCredsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetUserCredsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IGetUserCredsRequest} message GetUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetUserCredsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GetUserCredsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.GetUserCredsRequest} GetUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetUserCredsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.GetUserCredsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GetUserCredsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.GetUserCredsRequest} GetUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetUserCredsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetUserCredsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetUserCredsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.GetUserCredsRequest} GetUserCredsRequest + */ + GetUserCredsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.GetUserCredsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.GetUserCredsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.GetUserCredsRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetUserCredsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @static + * @param {google.firestore.admin.v1.GetUserCredsRequest} message GetUserCredsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetUserCredsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetUserCredsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @instance + * @returns {Object.} JSON object + */ + GetUserCredsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetUserCredsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.GetUserCredsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetUserCredsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.GetUserCredsRequest"; + }; + + return GetUserCredsRequest; + })(); + + v1.ListUserCredsRequest = (function() { + + /** + * Properties of a ListUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @interface IListUserCredsRequest + * @property {string|null} [parent] ListUserCredsRequest parent + */ + + /** + * Constructs a new ListUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListUserCredsRequest. + * @implements IListUserCredsRequest + * @constructor + * @param {google.firestore.admin.v1.IListUserCredsRequest=} [properties] Properties to set + */ + function ListUserCredsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListUserCredsRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @instance + */ + ListUserCredsRequest.prototype.parent = ""; + + /** + * Creates a new ListUserCredsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IListUserCredsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListUserCredsRequest} ListUserCredsRequest instance + */ + ListUserCredsRequest.create = function create(properties) { + return new ListUserCredsRequest(properties); + }; + + /** + * Encodes the specified ListUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.ListUserCredsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IListUserCredsRequest} message ListUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUserCredsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + return writer; + }; + + /** + * Encodes the specified ListUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListUserCredsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IListUserCredsRequest} message ListUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUserCredsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListUserCredsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListUserCredsRequest} ListUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUserCredsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListUserCredsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListUserCredsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListUserCredsRequest} ListUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUserCredsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListUserCredsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListUserCredsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a ListUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListUserCredsRequest} ListUserCredsRequest + */ + ListUserCredsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListUserCredsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListUserCredsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListUserCredsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a ListUserCredsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @static + * @param {google.firestore.admin.v1.ListUserCredsRequest} message ListUserCredsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListUserCredsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this ListUserCredsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @instance + * @returns {Object.} JSON object + */ + ListUserCredsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListUserCredsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListUserCredsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListUserCredsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListUserCredsRequest"; + }; + + return ListUserCredsRequest; + })(); + + v1.ListUserCredsResponse = (function() { + + /** + * Properties of a ListUserCredsResponse. + * @memberof google.firestore.admin.v1 + * @interface IListUserCredsResponse + * @property {Array.|null} [userCreds] ListUserCredsResponse userCreds + */ + + /** + * Constructs a new ListUserCredsResponse. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListUserCredsResponse. + * @implements IListUserCredsResponse + * @constructor + * @param {google.firestore.admin.v1.IListUserCredsResponse=} [properties] Properties to set + */ + function ListUserCredsResponse(properties) { + this.userCreds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListUserCredsResponse userCreds. + * @member {Array.} userCreds + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @instance + */ + ListUserCredsResponse.prototype.userCreds = $util.emptyArray; + + /** + * Creates a new ListUserCredsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @static + * @param {google.firestore.admin.v1.IListUserCredsResponse=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListUserCredsResponse} ListUserCredsResponse instance + */ + ListUserCredsResponse.create = function create(properties) { + return new ListUserCredsResponse(properties); + }; + + /** + * Encodes the specified ListUserCredsResponse message. Does not implicitly {@link google.firestore.admin.v1.ListUserCredsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @static + * @param {google.firestore.admin.v1.IListUserCredsResponse} message ListUserCredsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUserCredsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.userCreds != null && message.userCreds.length) + for (var i = 0; i < message.userCreds.length; ++i) + $root.google.firestore.admin.v1.UserCreds.encode(message.userCreds[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListUserCredsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListUserCredsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @static + * @param {google.firestore.admin.v1.IListUserCredsResponse} message ListUserCredsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUserCredsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListUserCredsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListUserCredsResponse} ListUserCredsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUserCredsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListUserCredsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.userCreds && message.userCreds.length)) + message.userCreds = []; + message.userCreds.push($root.google.firestore.admin.v1.UserCreds.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListUserCredsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListUserCredsResponse} ListUserCredsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUserCredsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListUserCredsResponse message. + * @function verify + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListUserCredsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.userCreds != null && Object.hasOwnProperty.call(message, "userCreds")) { + if (!Array.isArray(message.userCreds)) + return "userCreds: array expected"; + for (var i = 0; i < message.userCreds.length; ++i) { + var error = $root.google.firestore.admin.v1.UserCreds.verify(message.userCreds[i], long + 1); + if (error) + return "userCreds." + error; + } + } + return null; + }; + + /** + * Creates a ListUserCredsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListUserCredsResponse} ListUserCredsResponse + */ + ListUserCredsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListUserCredsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListUserCredsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListUserCredsResponse(); + if (object.userCreds) { + if (!Array.isArray(object.userCreds)) + throw TypeError(".google.firestore.admin.v1.ListUserCredsResponse.userCreds: array expected"); + message.userCreds = []; + for (var i = 0; i < object.userCreds.length; ++i) { + if (!$util.isObject(object.userCreds[i])) + throw TypeError(".google.firestore.admin.v1.ListUserCredsResponse.userCreds: object expected"); + message.userCreds[i] = $root.google.firestore.admin.v1.UserCreds.fromObject(object.userCreds[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a ListUserCredsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @static + * @param {google.firestore.admin.v1.ListUserCredsResponse} message ListUserCredsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListUserCredsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.userCreds = []; + if (message.userCreds && message.userCreds.length) { + object.userCreds = []; + for (var j = 0; j < message.userCreds.length; ++j) + object.userCreds[j] = $root.google.firestore.admin.v1.UserCreds.toObject(message.userCreds[j], options, q + 1); + } + return object; + }; + + /** + * Converts this ListUserCredsResponse to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @instance + * @returns {Object.} JSON object + */ + ListUserCredsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListUserCredsResponse + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListUserCredsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListUserCredsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListUserCredsResponse"; + }; + + return ListUserCredsResponse; + })(); + + v1.EnableUserCredsRequest = (function() { + + /** + * Properties of an EnableUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @interface IEnableUserCredsRequest + * @property {string|null} [name] EnableUserCredsRequest name + */ + + /** + * Constructs a new EnableUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an EnableUserCredsRequest. + * @implements IEnableUserCredsRequest + * @constructor + * @param {google.firestore.admin.v1.IEnableUserCredsRequest=} [properties] Properties to set + */ + function EnableUserCredsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnableUserCredsRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @instance + */ + EnableUserCredsRequest.prototype.name = ""; + + /** + * Creates a new EnableUserCredsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IEnableUserCredsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.EnableUserCredsRequest} EnableUserCredsRequest instance + */ + EnableUserCredsRequest.create = function create(properties) { + return new EnableUserCredsRequest(properties); + }; + + /** + * Encodes the specified EnableUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.EnableUserCredsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IEnableUserCredsRequest} message EnableUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableUserCredsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified EnableUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.EnableUserCredsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IEnableUserCredsRequest} message EnableUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableUserCredsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an EnableUserCredsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.EnableUserCredsRequest} EnableUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableUserCredsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.EnableUserCredsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an EnableUserCredsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.EnableUserCredsRequest} EnableUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableUserCredsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableUserCredsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableUserCredsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates an EnableUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.EnableUserCredsRequest} EnableUserCredsRequest + */ + EnableUserCredsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.EnableUserCredsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.EnableUserCredsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.EnableUserCredsRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an EnableUserCredsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @static + * @param {google.firestore.admin.v1.EnableUserCredsRequest} message EnableUserCredsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableUserCredsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this EnableUserCredsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @instance + * @returns {Object.} JSON object + */ + EnableUserCredsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnableUserCredsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.EnableUserCredsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnableUserCredsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.EnableUserCredsRequest"; + }; + + return EnableUserCredsRequest; + })(); + + v1.DisableUserCredsRequest = (function() { + + /** + * Properties of a DisableUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @interface IDisableUserCredsRequest + * @property {string|null} [name] DisableUserCredsRequest name + */ + + /** + * Constructs a new DisableUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a DisableUserCredsRequest. + * @implements IDisableUserCredsRequest + * @constructor + * @param {google.firestore.admin.v1.IDisableUserCredsRequest=} [properties] Properties to set + */ + function DisableUserCredsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DisableUserCredsRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @instance + */ + DisableUserCredsRequest.prototype.name = ""; + + /** + * Creates a new DisableUserCredsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IDisableUserCredsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.DisableUserCredsRequest} DisableUserCredsRequest instance + */ + DisableUserCredsRequest.create = function create(properties) { + return new DisableUserCredsRequest(properties); + }; + + /** + * Encodes the specified DisableUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.DisableUserCredsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IDisableUserCredsRequest} message DisableUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableUserCredsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DisableUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DisableUserCredsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IDisableUserCredsRequest} message DisableUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableUserCredsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DisableUserCredsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.DisableUserCredsRequest} DisableUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableUserCredsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.DisableUserCredsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DisableUserCredsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.DisableUserCredsRequest} DisableUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableUserCredsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableUserCredsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableUserCredsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DisableUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.DisableUserCredsRequest} DisableUserCredsRequest + */ + DisableUserCredsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.DisableUserCredsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.DisableUserCredsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.DisableUserCredsRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DisableUserCredsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @static + * @param {google.firestore.admin.v1.DisableUserCredsRequest} message DisableUserCredsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableUserCredsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DisableUserCredsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @instance + * @returns {Object.} JSON object + */ + DisableUserCredsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DisableUserCredsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.DisableUserCredsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DisableUserCredsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.DisableUserCredsRequest"; + }; + + return DisableUserCredsRequest; + })(); + + v1.ResetUserPasswordRequest = (function() { + + /** + * Properties of a ResetUserPasswordRequest. + * @memberof google.firestore.admin.v1 + * @interface IResetUserPasswordRequest + * @property {string|null} [name] ResetUserPasswordRequest name + */ + + /** + * Constructs a new ResetUserPasswordRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ResetUserPasswordRequest. + * @implements IResetUserPasswordRequest + * @constructor + * @param {google.firestore.admin.v1.IResetUserPasswordRequest=} [properties] Properties to set + */ + function ResetUserPasswordRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResetUserPasswordRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @instance + */ + ResetUserPasswordRequest.prototype.name = ""; + + /** + * Creates a new ResetUserPasswordRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @static + * @param {google.firestore.admin.v1.IResetUserPasswordRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ResetUserPasswordRequest} ResetUserPasswordRequest instance + */ + ResetUserPasswordRequest.create = function create(properties) { + return new ResetUserPasswordRequest(properties); + }; + + /** + * Encodes the specified ResetUserPasswordRequest message. Does not implicitly {@link google.firestore.admin.v1.ResetUserPasswordRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @static + * @param {google.firestore.admin.v1.IResetUserPasswordRequest} message ResetUserPasswordRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResetUserPasswordRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified ResetUserPasswordRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ResetUserPasswordRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @static + * @param {google.firestore.admin.v1.IResetUserPasswordRequest} message ResetUserPasswordRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResetUserPasswordRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ResetUserPasswordRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ResetUserPasswordRequest} ResetUserPasswordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResetUserPasswordRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ResetUserPasswordRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ResetUserPasswordRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ResetUserPasswordRequest} ResetUserPasswordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResetUserPasswordRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResetUserPasswordRequest message. + * @function verify + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResetUserPasswordRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a ResetUserPasswordRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ResetUserPasswordRequest} ResetUserPasswordRequest + */ + ResetUserPasswordRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ResetUserPasswordRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ResetUserPasswordRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ResetUserPasswordRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a ResetUserPasswordRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @static + * @param {google.firestore.admin.v1.ResetUserPasswordRequest} message ResetUserPasswordRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResetUserPasswordRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ResetUserPasswordRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @instance + * @returns {Object.} JSON object + */ + ResetUserPasswordRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResetUserPasswordRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ResetUserPasswordRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResetUserPasswordRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ResetUserPasswordRequest"; + }; + + return ResetUserPasswordRequest; + })(); + + v1.DeleteUserCredsRequest = (function() { + + /** + * Properties of a DeleteUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @interface IDeleteUserCredsRequest + * @property {string|null} [name] DeleteUserCredsRequest name + */ + + /** + * Constructs a new DeleteUserCredsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a DeleteUserCredsRequest. + * @implements IDeleteUserCredsRequest + * @constructor + * @param {google.firestore.admin.v1.IDeleteUserCredsRequest=} [properties] Properties to set + */ + function DeleteUserCredsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteUserCredsRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @instance + */ + DeleteUserCredsRequest.prototype.name = ""; + + /** + * Creates a new DeleteUserCredsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IDeleteUserCredsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.DeleteUserCredsRequest} DeleteUserCredsRequest instance + */ + DeleteUserCredsRequest.create = function create(properties) { + return new DeleteUserCredsRequest(properties); + }; + + /** + * Encodes the specified DeleteUserCredsRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteUserCredsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IDeleteUserCredsRequest} message DeleteUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteUserCredsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteUserCredsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteUserCredsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @static + * @param {google.firestore.admin.v1.IDeleteUserCredsRequest} message DeleteUserCredsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteUserCredsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DeleteUserCredsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.DeleteUserCredsRequest} DeleteUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteUserCredsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.DeleteUserCredsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteUserCredsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.DeleteUserCredsRequest} DeleteUserCredsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteUserCredsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteUserCredsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteUserCredsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteUserCredsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.DeleteUserCredsRequest} DeleteUserCredsRequest + */ + DeleteUserCredsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.DeleteUserCredsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.DeleteUserCredsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.DeleteUserCredsRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteUserCredsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @static + * @param {google.firestore.admin.v1.DeleteUserCredsRequest} message DeleteUserCredsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteUserCredsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteUserCredsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteUserCredsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteUserCredsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.DeleteUserCredsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteUserCredsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.DeleteUserCredsRequest"; + }; + + return DeleteUserCredsRequest; + })(); + + v1.CreateBackupScheduleRequest = (function() { + + /** + * Properties of a CreateBackupScheduleRequest. + * @memberof google.firestore.admin.v1 + * @interface ICreateBackupScheduleRequest + * @property {string|null} [parent] CreateBackupScheduleRequest parent + * @property {google.firestore.admin.v1.IBackupSchedule|null} [backupSchedule] CreateBackupScheduleRequest backupSchedule + */ + + /** + * Constructs a new CreateBackupScheduleRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a CreateBackupScheduleRequest. + * @implements ICreateBackupScheduleRequest + * @constructor + * @param {google.firestore.admin.v1.ICreateBackupScheduleRequest=} [properties] Properties to set + */ + function CreateBackupScheduleRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateBackupScheduleRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @instance + */ + CreateBackupScheduleRequest.prototype.parent = ""; + + /** + * CreateBackupScheduleRequest backupSchedule. + * @member {google.firestore.admin.v1.IBackupSchedule|null|undefined} backupSchedule + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @instance + */ + CreateBackupScheduleRequest.prototype.backupSchedule = null; + + /** + * Creates a new CreateBackupScheduleRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.ICreateBackupScheduleRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.CreateBackupScheduleRequest} CreateBackupScheduleRequest instance + */ + CreateBackupScheduleRequest.create = function create(properties) { + return new CreateBackupScheduleRequest(properties); + }; + + /** + * Encodes the specified CreateBackupScheduleRequest message. Does not implicitly {@link google.firestore.admin.v1.CreateBackupScheduleRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.ICreateBackupScheduleRequest} message CreateBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBackupScheduleRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.backupSchedule != null && Object.hasOwnProperty.call(message, "backupSchedule")) + $root.google.firestore.admin.v1.BackupSchedule.encode(message.backupSchedule, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateBackupScheduleRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateBackupScheduleRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.ICreateBackupScheduleRequest} message CreateBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBackupScheduleRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CreateBackupScheduleRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.CreateBackupScheduleRequest} CreateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBackupScheduleRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.CreateBackupScheduleRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.backupSchedule = $root.google.firestore.admin.v1.BackupSchedule.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CreateBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.CreateBackupScheduleRequest} CreateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBackupScheduleRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateBackupScheduleRequest message. + * @function verify + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateBackupScheduleRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.backupSchedule != null && Object.hasOwnProperty.call(message, "backupSchedule")) { + var error = $root.google.firestore.admin.v1.BackupSchedule.verify(message.backupSchedule, long + 1); + if (error) + return "backupSchedule." + error; + } + return null; + }; + + /** + * Creates a CreateBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.CreateBackupScheduleRequest} CreateBackupScheduleRequest + */ + CreateBackupScheduleRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.CreateBackupScheduleRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.CreateBackupScheduleRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.CreateBackupScheduleRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.backupSchedule != null) { + if (!$util.isObject(object.backupSchedule)) + throw TypeError(".google.firestore.admin.v1.CreateBackupScheduleRequest.backupSchedule: object expected"); + message.backupSchedule = $root.google.firestore.admin.v1.BackupSchedule.fromObject(object.backupSchedule, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a CreateBackupScheduleRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.CreateBackupScheduleRequest} message CreateBackupScheduleRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateBackupScheduleRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.backupSchedule = null; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.backupSchedule != null && Object.hasOwnProperty.call(message, "backupSchedule")) + object.backupSchedule = $root.google.firestore.admin.v1.BackupSchedule.toObject(message.backupSchedule, options, q + 1); + return object; + }; + + /** + * Converts this CreateBackupScheduleRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @instance + * @returns {Object.} JSON object + */ + CreateBackupScheduleRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateBackupScheduleRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.CreateBackupScheduleRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateBackupScheduleRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.CreateBackupScheduleRequest"; + }; + + return CreateBackupScheduleRequest; + })(); + + v1.GetBackupScheduleRequest = (function() { + + /** + * Properties of a GetBackupScheduleRequest. + * @memberof google.firestore.admin.v1 + * @interface IGetBackupScheduleRequest + * @property {string|null} [name] GetBackupScheduleRequest name + */ + + /** + * Constructs a new GetBackupScheduleRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a GetBackupScheduleRequest. + * @implements IGetBackupScheduleRequest + * @constructor + * @param {google.firestore.admin.v1.IGetBackupScheduleRequest=} [properties] Properties to set + */ + function GetBackupScheduleRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBackupScheduleRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @instance + */ + GetBackupScheduleRequest.prototype.name = ""; + + /** + * Creates a new GetBackupScheduleRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.IGetBackupScheduleRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.GetBackupScheduleRequest} GetBackupScheduleRequest instance + */ + GetBackupScheduleRequest.create = function create(properties) { + return new GetBackupScheduleRequest(properties); + }; + + /** + * Encodes the specified GetBackupScheduleRequest message. Does not implicitly {@link google.firestore.admin.v1.GetBackupScheduleRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.IGetBackupScheduleRequest} message GetBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupScheduleRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetBackupScheduleRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetBackupScheduleRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.IGetBackupScheduleRequest} message GetBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupScheduleRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GetBackupScheduleRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.GetBackupScheduleRequest} GetBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupScheduleRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.GetBackupScheduleRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GetBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.GetBackupScheduleRequest} GetBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupScheduleRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBackupScheduleRequest message. + * @function verify + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBackupScheduleRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.GetBackupScheduleRequest} GetBackupScheduleRequest + */ + GetBackupScheduleRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.GetBackupScheduleRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.GetBackupScheduleRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.GetBackupScheduleRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetBackupScheduleRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.GetBackupScheduleRequest} message GetBackupScheduleRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBackupScheduleRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetBackupScheduleRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @instance + * @returns {Object.} JSON object + */ + GetBackupScheduleRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetBackupScheduleRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.GetBackupScheduleRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetBackupScheduleRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.GetBackupScheduleRequest"; + }; + + return GetBackupScheduleRequest; + })(); + + v1.UpdateBackupScheduleRequest = (function() { + + /** + * Properties of an UpdateBackupScheduleRequest. + * @memberof google.firestore.admin.v1 + * @interface IUpdateBackupScheduleRequest + * @property {google.firestore.admin.v1.IBackupSchedule|null} [backupSchedule] UpdateBackupScheduleRequest backupSchedule + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateBackupScheduleRequest updateMask + */ + + /** + * Constructs a new UpdateBackupScheduleRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an UpdateBackupScheduleRequest. + * @implements IUpdateBackupScheduleRequest + * @constructor + * @param {google.firestore.admin.v1.IUpdateBackupScheduleRequest=} [properties] Properties to set + */ + function UpdateBackupScheduleRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateBackupScheduleRequest backupSchedule. + * @member {google.firestore.admin.v1.IBackupSchedule|null|undefined} backupSchedule + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @instance + */ + UpdateBackupScheduleRequest.prototype.backupSchedule = null; + + /** + * UpdateBackupScheduleRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @instance + */ + UpdateBackupScheduleRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateBackupScheduleRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.IUpdateBackupScheduleRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.UpdateBackupScheduleRequest} UpdateBackupScheduleRequest instance + */ + UpdateBackupScheduleRequest.create = function create(properties) { + return new UpdateBackupScheduleRequest(properties); + }; + + /** + * Encodes the specified UpdateBackupScheduleRequest message. Does not implicitly {@link google.firestore.admin.v1.UpdateBackupScheduleRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.IUpdateBackupScheduleRequest} message UpdateBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBackupScheduleRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.backupSchedule != null && Object.hasOwnProperty.call(message, "backupSchedule")) + $root.google.firestore.admin.v1.BackupSchedule.encode(message.backupSchedule, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateBackupScheduleRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UpdateBackupScheduleRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.IUpdateBackupScheduleRequest} message UpdateBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBackupScheduleRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UpdateBackupScheduleRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.UpdateBackupScheduleRequest} UpdateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBackupScheduleRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.UpdateBackupScheduleRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backupSchedule = $root.google.firestore.admin.v1.BackupSchedule.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.UpdateBackupScheduleRequest} UpdateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBackupScheduleRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateBackupScheduleRequest message. + * @function verify + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateBackupScheduleRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.backupSchedule != null && Object.hasOwnProperty.call(message, "backupSchedule")) { + var error = $root.google.firestore.admin.v1.BackupSchedule.verify(message.backupSchedule, long + 1); + if (error) + return "backupSchedule." + error; + } + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.UpdateBackupScheduleRequest} UpdateBackupScheduleRequest + */ + UpdateBackupScheduleRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.UpdateBackupScheduleRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.UpdateBackupScheduleRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.UpdateBackupScheduleRequest(); + if (object.backupSchedule != null) { + if (!$util.isObject(object.backupSchedule)) + throw TypeError(".google.firestore.admin.v1.UpdateBackupScheduleRequest.backupSchedule: object expected"); + message.backupSchedule = $root.google.firestore.admin.v1.BackupSchedule.fromObject(object.backupSchedule, long + 1); + } + if (object.updateMask != null) { + if (!$util.isObject(object.updateMask)) + throw TypeError(".google.firestore.admin.v1.UpdateBackupScheduleRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an UpdateBackupScheduleRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.UpdateBackupScheduleRequest} message UpdateBackupScheduleRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateBackupScheduleRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.backupSchedule = null; + object.updateMask = null; + } + if (message.backupSchedule != null && Object.hasOwnProperty.call(message, "backupSchedule")) + object.backupSchedule = $root.google.firestore.admin.v1.BackupSchedule.toObject(message.backupSchedule, options, q + 1); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options, q + 1); + return object; + }; + + /** + * Converts this UpdateBackupScheduleRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateBackupScheduleRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateBackupScheduleRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.UpdateBackupScheduleRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateBackupScheduleRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.UpdateBackupScheduleRequest"; + }; + + return UpdateBackupScheduleRequest; + })(); + + v1.ListBackupSchedulesRequest = (function() { + + /** + * Properties of a ListBackupSchedulesRequest. + * @memberof google.firestore.admin.v1 + * @interface IListBackupSchedulesRequest + * @property {string|null} [parent] ListBackupSchedulesRequest parent + */ + + /** + * Constructs a new ListBackupSchedulesRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListBackupSchedulesRequest. + * @implements IListBackupSchedulesRequest + * @constructor + * @param {google.firestore.admin.v1.IListBackupSchedulesRequest=} [properties] Properties to set + */ + function ListBackupSchedulesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupSchedulesRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @instance + */ + ListBackupSchedulesRequest.prototype.parent = ""; + + /** + * Creates a new ListBackupSchedulesRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @static + * @param {google.firestore.admin.v1.IListBackupSchedulesRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListBackupSchedulesRequest} ListBackupSchedulesRequest instance + */ + ListBackupSchedulesRequest.create = function create(properties) { + return new ListBackupSchedulesRequest(properties); + }; + + /** + * Encodes the specified ListBackupSchedulesRequest message. Does not implicitly {@link google.firestore.admin.v1.ListBackupSchedulesRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @static + * @param {google.firestore.admin.v1.IListBackupSchedulesRequest} message ListBackupSchedulesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupSchedulesRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + return writer; + }; + + /** + * Encodes the specified ListBackupSchedulesRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListBackupSchedulesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @static + * @param {google.firestore.admin.v1.IListBackupSchedulesRequest} message ListBackupSchedulesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupSchedulesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListBackupSchedulesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListBackupSchedulesRequest} ListBackupSchedulesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupSchedulesRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListBackupSchedulesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupSchedulesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListBackupSchedulesRequest} ListBackupSchedulesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupSchedulesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupSchedulesRequest message. + * @function verify + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupSchedulesRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a ListBackupSchedulesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListBackupSchedulesRequest} ListBackupSchedulesRequest + */ + ListBackupSchedulesRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListBackupSchedulesRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListBackupSchedulesRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListBackupSchedulesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a ListBackupSchedulesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @static + * @param {google.firestore.admin.v1.ListBackupSchedulesRequest} message ListBackupSchedulesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupSchedulesRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this ListBackupSchedulesRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @instance + * @returns {Object.} JSON object + */ + ListBackupSchedulesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupSchedulesRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListBackupSchedulesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupSchedulesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListBackupSchedulesRequest"; + }; + + return ListBackupSchedulesRequest; + })(); + + v1.ListBackupSchedulesResponse = (function() { + + /** + * Properties of a ListBackupSchedulesResponse. + * @memberof google.firestore.admin.v1 + * @interface IListBackupSchedulesResponse + * @property {Array.|null} [backupSchedules] ListBackupSchedulesResponse backupSchedules + */ + + /** + * Constructs a new ListBackupSchedulesResponse. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListBackupSchedulesResponse. + * @implements IListBackupSchedulesResponse + * @constructor + * @param {google.firestore.admin.v1.IListBackupSchedulesResponse=} [properties] Properties to set + */ + function ListBackupSchedulesResponse(properties) { + this.backupSchedules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupSchedulesResponse backupSchedules. + * @member {Array.} backupSchedules + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @instance + */ + ListBackupSchedulesResponse.prototype.backupSchedules = $util.emptyArray; + + /** + * Creates a new ListBackupSchedulesResponse instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @static + * @param {google.firestore.admin.v1.IListBackupSchedulesResponse=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListBackupSchedulesResponse} ListBackupSchedulesResponse instance + */ + ListBackupSchedulesResponse.create = function create(properties) { + return new ListBackupSchedulesResponse(properties); + }; + + /** + * Encodes the specified ListBackupSchedulesResponse message. Does not implicitly {@link google.firestore.admin.v1.ListBackupSchedulesResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @static + * @param {google.firestore.admin.v1.IListBackupSchedulesResponse} message ListBackupSchedulesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupSchedulesResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.backupSchedules != null && message.backupSchedules.length) + for (var i = 0; i < message.backupSchedules.length; ++i) + $root.google.firestore.admin.v1.BackupSchedule.encode(message.backupSchedules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListBackupSchedulesResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListBackupSchedulesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @static + * @param {google.firestore.admin.v1.IListBackupSchedulesResponse} message ListBackupSchedulesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupSchedulesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListBackupSchedulesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListBackupSchedulesResponse} ListBackupSchedulesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupSchedulesResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListBackupSchedulesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.backupSchedules && message.backupSchedules.length)) + message.backupSchedules = []; + message.backupSchedules.push($root.google.firestore.admin.v1.BackupSchedule.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupSchedulesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListBackupSchedulesResponse} ListBackupSchedulesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupSchedulesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupSchedulesResponse message. + * @function verify + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupSchedulesResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.backupSchedules != null && Object.hasOwnProperty.call(message, "backupSchedules")) { + if (!Array.isArray(message.backupSchedules)) + return "backupSchedules: array expected"; + for (var i = 0; i < message.backupSchedules.length; ++i) { + var error = $root.google.firestore.admin.v1.BackupSchedule.verify(message.backupSchedules[i], long + 1); + if (error) + return "backupSchedules." + error; + } + } + return null; + }; + + /** + * Creates a ListBackupSchedulesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListBackupSchedulesResponse} ListBackupSchedulesResponse + */ + ListBackupSchedulesResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListBackupSchedulesResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListBackupSchedulesResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListBackupSchedulesResponse(); + if (object.backupSchedules) { + if (!Array.isArray(object.backupSchedules)) + throw TypeError(".google.firestore.admin.v1.ListBackupSchedulesResponse.backupSchedules: array expected"); + message.backupSchedules = []; + for (var i = 0; i < object.backupSchedules.length; ++i) { + if (!$util.isObject(object.backupSchedules[i])) + throw TypeError(".google.firestore.admin.v1.ListBackupSchedulesResponse.backupSchedules: object expected"); + message.backupSchedules[i] = $root.google.firestore.admin.v1.BackupSchedule.fromObject(object.backupSchedules[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a ListBackupSchedulesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @static + * @param {google.firestore.admin.v1.ListBackupSchedulesResponse} message ListBackupSchedulesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupSchedulesResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.backupSchedules = []; + if (message.backupSchedules && message.backupSchedules.length) { + object.backupSchedules = []; + for (var j = 0; j < message.backupSchedules.length; ++j) + object.backupSchedules[j] = $root.google.firestore.admin.v1.BackupSchedule.toObject(message.backupSchedules[j], options, q + 1); + } + return object; + }; + + /** + * Converts this ListBackupSchedulesResponse to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @instance + * @returns {Object.} JSON object + */ + ListBackupSchedulesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupSchedulesResponse + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListBackupSchedulesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupSchedulesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListBackupSchedulesResponse"; + }; + + return ListBackupSchedulesResponse; + })(); + + v1.DeleteBackupScheduleRequest = (function() { + + /** + * Properties of a DeleteBackupScheduleRequest. + * @memberof google.firestore.admin.v1 + * @interface IDeleteBackupScheduleRequest + * @property {string|null} [name] DeleteBackupScheduleRequest name + */ + + /** + * Constructs a new DeleteBackupScheduleRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a DeleteBackupScheduleRequest. + * @implements IDeleteBackupScheduleRequest + * @constructor + * @param {google.firestore.admin.v1.IDeleteBackupScheduleRequest=} [properties] Properties to set + */ + function DeleteBackupScheduleRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteBackupScheduleRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @instance + */ + DeleteBackupScheduleRequest.prototype.name = ""; + + /** + * Creates a new DeleteBackupScheduleRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.IDeleteBackupScheduleRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.DeleteBackupScheduleRequest} DeleteBackupScheduleRequest instance + */ + DeleteBackupScheduleRequest.create = function create(properties) { + return new DeleteBackupScheduleRequest(properties); + }; + + /** + * Encodes the specified DeleteBackupScheduleRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteBackupScheduleRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.IDeleteBackupScheduleRequest} message DeleteBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupScheduleRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteBackupScheduleRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteBackupScheduleRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.IDeleteBackupScheduleRequest} message DeleteBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupScheduleRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DeleteBackupScheduleRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.DeleteBackupScheduleRequest} DeleteBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupScheduleRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.DeleteBackupScheduleRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.DeleteBackupScheduleRequest} DeleteBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupScheduleRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteBackupScheduleRequest message. + * @function verify + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteBackupScheduleRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.DeleteBackupScheduleRequest} DeleteBackupScheduleRequest + */ + DeleteBackupScheduleRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.DeleteBackupScheduleRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.DeleteBackupScheduleRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.DeleteBackupScheduleRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteBackupScheduleRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @static + * @param {google.firestore.admin.v1.DeleteBackupScheduleRequest} message DeleteBackupScheduleRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteBackupScheduleRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteBackupScheduleRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteBackupScheduleRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteBackupScheduleRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.DeleteBackupScheduleRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteBackupScheduleRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.DeleteBackupScheduleRequest"; + }; + + return DeleteBackupScheduleRequest; + })(); + + v1.CreateIndexRequest = (function() { + + /** + * Properties of a CreateIndexRequest. + * @memberof google.firestore.admin.v1 + * @interface ICreateIndexRequest + * @property {string|null} [parent] CreateIndexRequest parent + * @property {google.firestore.admin.v1.IIndex|null} [index] CreateIndexRequest index + */ + + /** + * Constructs a new CreateIndexRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a CreateIndexRequest. + * @implements ICreateIndexRequest + * @constructor + * @param {google.firestore.admin.v1.ICreateIndexRequest=} [properties] Properties to set + */ + function CreateIndexRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateIndexRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @instance + */ + CreateIndexRequest.prototype.parent = ""; + + /** + * CreateIndexRequest index. + * @member {google.firestore.admin.v1.IIndex|null|undefined} index + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @instance + */ + CreateIndexRequest.prototype.index = null; + + /** + * Creates a new CreateIndexRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @static + * @param {google.firestore.admin.v1.ICreateIndexRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.CreateIndexRequest} CreateIndexRequest instance + */ + CreateIndexRequest.create = function create(properties) { + return new CreateIndexRequest(properties); + }; + + /** + * Encodes the specified CreateIndexRequest message. Does not implicitly {@link google.firestore.admin.v1.CreateIndexRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @static + * @param {google.firestore.admin.v1.ICreateIndexRequest} message CreateIndexRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateIndexRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + $root.google.firestore.admin.v1.Index.encode(message.index, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateIndexRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CreateIndexRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @static + * @param {google.firestore.admin.v1.ICreateIndexRequest} message CreateIndexRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateIndexRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CreateIndexRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.CreateIndexRequest} CreateIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateIndexRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.CreateIndexRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.index = $root.google.firestore.admin.v1.Index.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CreateIndexRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.CreateIndexRequest} CreateIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateIndexRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateIndexRequest message. + * @function verify + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateIndexRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.index != null && Object.hasOwnProperty.call(message, "index")) { + var error = $root.google.firestore.admin.v1.Index.verify(message.index, long + 1); + if (error) + return "index." + error; + } + return null; + }; + + /** + * Creates a CreateIndexRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.CreateIndexRequest} CreateIndexRequest + */ + CreateIndexRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.CreateIndexRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.CreateIndexRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.CreateIndexRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.index != null) { + if (!$util.isObject(object.index)) + throw TypeError(".google.firestore.admin.v1.CreateIndexRequest.index: object expected"); + message.index = $root.google.firestore.admin.v1.Index.fromObject(object.index, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a CreateIndexRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @static + * @param {google.firestore.admin.v1.CreateIndexRequest} message CreateIndexRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateIndexRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.index = null; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + object.index = $root.google.firestore.admin.v1.Index.toObject(message.index, options, q + 1); + return object; + }; + + /** + * Converts this CreateIndexRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @instance + * @returns {Object.} JSON object + */ + CreateIndexRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateIndexRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.CreateIndexRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateIndexRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.CreateIndexRequest"; + }; + + return CreateIndexRequest; + })(); + + v1.ListIndexesRequest = (function() { + + /** + * Properties of a ListIndexesRequest. + * @memberof google.firestore.admin.v1 + * @interface IListIndexesRequest + * @property {string|null} [parent] ListIndexesRequest parent + * @property {string|null} [filter] ListIndexesRequest filter + * @property {number|null} [pageSize] ListIndexesRequest pageSize + * @property {string|null} [pageToken] ListIndexesRequest pageToken + */ + + /** + * Constructs a new ListIndexesRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListIndexesRequest. + * @implements IListIndexesRequest + * @constructor + * @param {google.firestore.admin.v1.IListIndexesRequest=} [properties] Properties to set + */ + function ListIndexesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListIndexesRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @instance + */ + ListIndexesRequest.prototype.parent = ""; + + /** + * ListIndexesRequest filter. + * @member {string} filter + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @instance + */ + ListIndexesRequest.prototype.filter = ""; + + /** + * ListIndexesRequest pageSize. + * @member {number} pageSize + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @instance + */ + ListIndexesRequest.prototype.pageSize = 0; + + /** + * ListIndexesRequest pageToken. + * @member {string} pageToken + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @instance + */ + ListIndexesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListIndexesRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @static + * @param {google.firestore.admin.v1.IListIndexesRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListIndexesRequest} ListIndexesRequest instance + */ + ListIndexesRequest.create = function create(properties) { + return new ListIndexesRequest(properties); + }; + + /** + * Encodes the specified ListIndexesRequest message. Does not implicitly {@link google.firestore.admin.v1.ListIndexesRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @static + * @param {google.firestore.admin.v1.IListIndexesRequest} message ListIndexesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIndexesRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListIndexesRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListIndexesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @static + * @param {google.firestore.admin.v1.IListIndexesRequest} message ListIndexesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIndexesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListIndexesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListIndexesRequest} ListIndexesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIndexesRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListIndexesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListIndexesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListIndexesRequest} ListIndexesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIndexesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListIndexesRequest message. + * @function verify + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListIndexesRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListIndexesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListIndexesRequest} ListIndexesRequest + */ + ListIndexesRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListIndexesRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListIndexesRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListIndexesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListIndexesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @static + * @param {google.firestore.admin.v1.ListIndexesRequest} message ListIndexesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListIndexesRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + object.filter = message.filter; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListIndexesRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @instance + * @returns {Object.} JSON object + */ + ListIndexesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListIndexesRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListIndexesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListIndexesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListIndexesRequest"; + }; + + return ListIndexesRequest; + })(); + + v1.ListIndexesResponse = (function() { + + /** + * Properties of a ListIndexesResponse. + * @memberof google.firestore.admin.v1 + * @interface IListIndexesResponse + * @property {Array.|null} [indexes] ListIndexesResponse indexes + * @property {string|null} [nextPageToken] ListIndexesResponse nextPageToken + */ + + /** + * Constructs a new ListIndexesResponse. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListIndexesResponse. + * @implements IListIndexesResponse + * @constructor + * @param {google.firestore.admin.v1.IListIndexesResponse=} [properties] Properties to set + */ + function ListIndexesResponse(properties) { + this.indexes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListIndexesResponse indexes. + * @member {Array.} indexes + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @instance + */ + ListIndexesResponse.prototype.indexes = $util.emptyArray; + + /** + * ListIndexesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @instance + */ + ListIndexesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListIndexesResponse instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @static + * @param {google.firestore.admin.v1.IListIndexesResponse=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListIndexesResponse} ListIndexesResponse instance + */ + ListIndexesResponse.create = function create(properties) { + return new ListIndexesResponse(properties); + }; + + /** + * Encodes the specified ListIndexesResponse message. Does not implicitly {@link google.firestore.admin.v1.ListIndexesResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @static + * @param {google.firestore.admin.v1.IListIndexesResponse} message ListIndexesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIndexesResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.indexes != null && message.indexes.length) + for (var i = 0; i < message.indexes.length; ++i) + $root.google.firestore.admin.v1.Index.encode(message.indexes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListIndexesResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListIndexesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @static + * @param {google.firestore.admin.v1.IListIndexesResponse} message ListIndexesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIndexesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListIndexesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListIndexesResponse} ListIndexesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIndexesResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListIndexesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.indexes && message.indexes.length)) + message.indexes = []; + message.indexes.push($root.google.firestore.admin.v1.Index.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListIndexesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListIndexesResponse} ListIndexesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIndexesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListIndexesResponse message. + * @function verify + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListIndexesResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.indexes != null && Object.hasOwnProperty.call(message, "indexes")) { + if (!Array.isArray(message.indexes)) + return "indexes: array expected"; + for (var i = 0; i < message.indexes.length; ++i) { + var error = $root.google.firestore.admin.v1.Index.verify(message.indexes[i], long + 1); + if (error) + return "indexes." + error; + } + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListIndexesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListIndexesResponse} ListIndexesResponse + */ + ListIndexesResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListIndexesResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListIndexesResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListIndexesResponse(); + if (object.indexes) { + if (!Array.isArray(object.indexes)) + throw TypeError(".google.firestore.admin.v1.ListIndexesResponse.indexes: array expected"); + message.indexes = []; + for (var i = 0; i < object.indexes.length; ++i) { + if (!$util.isObject(object.indexes[i])) + throw TypeError(".google.firestore.admin.v1.ListIndexesResponse.indexes: object expected"); + message.indexes[i] = $root.google.firestore.admin.v1.Index.fromObject(object.indexes[i], long + 1); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListIndexesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @static + * @param {google.firestore.admin.v1.ListIndexesResponse} message ListIndexesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListIndexesResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.indexes = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.indexes && message.indexes.length) { + object.indexes = []; + for (var j = 0; j < message.indexes.length; ++j) + object.indexes[j] = $root.google.firestore.admin.v1.Index.toObject(message.indexes[j], options, q + 1); + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListIndexesResponse to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @instance + * @returns {Object.} JSON object + */ + ListIndexesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListIndexesResponse + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListIndexesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListIndexesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListIndexesResponse"; + }; + + return ListIndexesResponse; + })(); + + v1.GetIndexRequest = (function() { + + /** + * Properties of a GetIndexRequest. + * @memberof google.firestore.admin.v1 + * @interface IGetIndexRequest + * @property {string|null} [name] GetIndexRequest name + */ + + /** + * Constructs a new GetIndexRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a GetIndexRequest. + * @implements IGetIndexRequest + * @constructor + * @param {google.firestore.admin.v1.IGetIndexRequest=} [properties] Properties to set + */ + function GetIndexRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIndexRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.GetIndexRequest + * @instance + */ + GetIndexRequest.prototype.name = ""; + + /** + * Creates a new GetIndexRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.GetIndexRequest + * @static + * @param {google.firestore.admin.v1.IGetIndexRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.GetIndexRequest} GetIndexRequest instance + */ + GetIndexRequest.create = function create(properties) { + return new GetIndexRequest(properties); + }; + + /** + * Encodes the specified GetIndexRequest message. Does not implicitly {@link google.firestore.admin.v1.GetIndexRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.GetIndexRequest + * @static + * @param {google.firestore.admin.v1.IGetIndexRequest} message GetIndexRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIndexRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetIndexRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetIndexRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.GetIndexRequest + * @static + * @param {google.firestore.admin.v1.IGetIndexRequest} message GetIndexRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIndexRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GetIndexRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.GetIndexRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.GetIndexRequest} GetIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIndexRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.GetIndexRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GetIndexRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.GetIndexRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.GetIndexRequest} GetIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIndexRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIndexRequest message. + * @function verify + * @memberof google.firestore.admin.v1.GetIndexRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIndexRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetIndexRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.GetIndexRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.GetIndexRequest} GetIndexRequest + */ + GetIndexRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.GetIndexRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.GetIndexRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.GetIndexRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetIndexRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.GetIndexRequest + * @static + * @param {google.firestore.admin.v1.GetIndexRequest} message GetIndexRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIndexRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetIndexRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.GetIndexRequest + * @instance + * @returns {Object.} JSON object + */ + GetIndexRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetIndexRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.GetIndexRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetIndexRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.GetIndexRequest"; + }; + + return GetIndexRequest; + })(); + + v1.DeleteIndexRequest = (function() { + + /** + * Properties of a DeleteIndexRequest. + * @memberof google.firestore.admin.v1 + * @interface IDeleteIndexRequest + * @property {string|null} [name] DeleteIndexRequest name + */ + + /** + * Constructs a new DeleteIndexRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a DeleteIndexRequest. + * @implements IDeleteIndexRequest + * @constructor + * @param {google.firestore.admin.v1.IDeleteIndexRequest=} [properties] Properties to set + */ + function DeleteIndexRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteIndexRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @instance + */ + DeleteIndexRequest.prototype.name = ""; + + /** + * Creates a new DeleteIndexRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @static + * @param {google.firestore.admin.v1.IDeleteIndexRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.DeleteIndexRequest} DeleteIndexRequest instance + */ + DeleteIndexRequest.create = function create(properties) { + return new DeleteIndexRequest(properties); + }; + + /** + * Encodes the specified DeleteIndexRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteIndexRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @static + * @param {google.firestore.admin.v1.IDeleteIndexRequest} message DeleteIndexRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteIndexRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteIndexRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteIndexRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @static + * @param {google.firestore.admin.v1.IDeleteIndexRequest} message DeleteIndexRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteIndexRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DeleteIndexRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.DeleteIndexRequest} DeleteIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteIndexRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.DeleteIndexRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteIndexRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.DeleteIndexRequest} DeleteIndexRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteIndexRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteIndexRequest message. + * @function verify + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteIndexRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteIndexRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.DeleteIndexRequest} DeleteIndexRequest + */ + DeleteIndexRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.DeleteIndexRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.DeleteIndexRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.DeleteIndexRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteIndexRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @static + * @param {google.firestore.admin.v1.DeleteIndexRequest} message DeleteIndexRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteIndexRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteIndexRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteIndexRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteIndexRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.DeleteIndexRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteIndexRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.DeleteIndexRequest"; + }; + + return DeleteIndexRequest; + })(); + + v1.UpdateFieldRequest = (function() { + + /** + * Properties of an UpdateFieldRequest. + * @memberof google.firestore.admin.v1 + * @interface IUpdateFieldRequest + * @property {google.firestore.admin.v1.IField|null} [field] UpdateFieldRequest field + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateFieldRequest updateMask + */ + + /** + * Constructs a new UpdateFieldRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an UpdateFieldRequest. + * @implements IUpdateFieldRequest + * @constructor + * @param {google.firestore.admin.v1.IUpdateFieldRequest=} [properties] Properties to set + */ + function UpdateFieldRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateFieldRequest field. + * @member {google.firestore.admin.v1.IField|null|undefined} field + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @instance + */ + UpdateFieldRequest.prototype.field = null; + + /** + * UpdateFieldRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @instance + */ + UpdateFieldRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateFieldRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @static + * @param {google.firestore.admin.v1.IUpdateFieldRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.UpdateFieldRequest} UpdateFieldRequest instance + */ + UpdateFieldRequest.create = function create(properties) { + return new UpdateFieldRequest(properties); + }; + + /** + * Encodes the specified UpdateFieldRequest message. Does not implicitly {@link google.firestore.admin.v1.UpdateFieldRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @static + * @param {google.firestore.admin.v1.IUpdateFieldRequest} message UpdateFieldRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFieldRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + $root.google.firestore.admin.v1.Field.encode(message.field, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateFieldRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UpdateFieldRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @static + * @param {google.firestore.admin.v1.IUpdateFieldRequest} message UpdateFieldRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFieldRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UpdateFieldRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.UpdateFieldRequest} UpdateFieldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFieldRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.UpdateFieldRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.field = $root.google.firestore.admin.v1.Field.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateFieldRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.UpdateFieldRequest} UpdateFieldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFieldRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateFieldRequest message. + * @function verify + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateFieldRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + var error = $root.google.firestore.admin.v1.Field.verify(message.field, long + 1); + if (error) + return "field." + error; + } + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateFieldRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.UpdateFieldRequest} UpdateFieldRequest + */ + UpdateFieldRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.UpdateFieldRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.UpdateFieldRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.UpdateFieldRequest(); + if (object.field != null) { + if (!$util.isObject(object.field)) + throw TypeError(".google.firestore.admin.v1.UpdateFieldRequest.field: object expected"); + message.field = $root.google.firestore.admin.v1.Field.fromObject(object.field, long + 1); + } + if (object.updateMask != null) { + if (!$util.isObject(object.updateMask)) + throw TypeError(".google.firestore.admin.v1.UpdateFieldRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an UpdateFieldRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @static + * @param {google.firestore.admin.v1.UpdateFieldRequest} message UpdateFieldRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateFieldRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.field = null; + object.updateMask = null; + } + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + object.field = $root.google.firestore.admin.v1.Field.toObject(message.field, options, q + 1); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options, q + 1); + return object; + }; + + /** + * Converts this UpdateFieldRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateFieldRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateFieldRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.UpdateFieldRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateFieldRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.UpdateFieldRequest"; + }; + + return UpdateFieldRequest; + })(); + + v1.GetFieldRequest = (function() { + + /** + * Properties of a GetFieldRequest. + * @memberof google.firestore.admin.v1 + * @interface IGetFieldRequest + * @property {string|null} [name] GetFieldRequest name + */ + + /** + * Constructs a new GetFieldRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a GetFieldRequest. + * @implements IGetFieldRequest + * @constructor + * @param {google.firestore.admin.v1.IGetFieldRequest=} [properties] Properties to set + */ + function GetFieldRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetFieldRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.GetFieldRequest + * @instance + */ + GetFieldRequest.prototype.name = ""; + + /** + * Creates a new GetFieldRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.GetFieldRequest + * @static + * @param {google.firestore.admin.v1.IGetFieldRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.GetFieldRequest} GetFieldRequest instance + */ + GetFieldRequest.create = function create(properties) { + return new GetFieldRequest(properties); + }; + + /** + * Encodes the specified GetFieldRequest message. Does not implicitly {@link google.firestore.admin.v1.GetFieldRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.GetFieldRequest + * @static + * @param {google.firestore.admin.v1.IGetFieldRequest} message GetFieldRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFieldRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetFieldRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetFieldRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.GetFieldRequest + * @static + * @param {google.firestore.admin.v1.IGetFieldRequest} message GetFieldRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFieldRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GetFieldRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.GetFieldRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.GetFieldRequest} GetFieldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFieldRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.GetFieldRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GetFieldRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.GetFieldRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.GetFieldRequest} GetFieldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFieldRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetFieldRequest message. + * @function verify + * @memberof google.firestore.admin.v1.GetFieldRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetFieldRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetFieldRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.GetFieldRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.GetFieldRequest} GetFieldRequest + */ + GetFieldRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.GetFieldRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.GetFieldRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.GetFieldRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetFieldRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.GetFieldRequest + * @static + * @param {google.firestore.admin.v1.GetFieldRequest} message GetFieldRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetFieldRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetFieldRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.GetFieldRequest + * @instance + * @returns {Object.} JSON object + */ + GetFieldRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetFieldRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.GetFieldRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetFieldRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.GetFieldRequest"; + }; + + return GetFieldRequest; + })(); + + v1.ListFieldsRequest = (function() { + + /** + * Properties of a ListFieldsRequest. + * @memberof google.firestore.admin.v1 + * @interface IListFieldsRequest + * @property {string|null} [parent] ListFieldsRequest parent + * @property {string|null} [filter] ListFieldsRequest filter + * @property {number|null} [pageSize] ListFieldsRequest pageSize + * @property {string|null} [pageToken] ListFieldsRequest pageToken + */ + + /** + * Constructs a new ListFieldsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListFieldsRequest. + * @implements IListFieldsRequest + * @constructor + * @param {google.firestore.admin.v1.IListFieldsRequest=} [properties] Properties to set + */ + function ListFieldsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFieldsRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @instance + */ + ListFieldsRequest.prototype.parent = ""; + + /** + * ListFieldsRequest filter. + * @member {string} filter + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @instance + */ + ListFieldsRequest.prototype.filter = ""; + + /** + * ListFieldsRequest pageSize. + * @member {number} pageSize + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @instance + */ + ListFieldsRequest.prototype.pageSize = 0; + + /** + * ListFieldsRequest pageToken. + * @member {string} pageToken + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @instance + */ + ListFieldsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListFieldsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @static + * @param {google.firestore.admin.v1.IListFieldsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListFieldsRequest} ListFieldsRequest instance + */ + ListFieldsRequest.create = function create(properties) { + return new ListFieldsRequest(properties); + }; + + /** + * Encodes the specified ListFieldsRequest message. Does not implicitly {@link google.firestore.admin.v1.ListFieldsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @static + * @param {google.firestore.admin.v1.IListFieldsRequest} message ListFieldsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFieldsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListFieldsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListFieldsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @static + * @param {google.firestore.admin.v1.IListFieldsRequest} message ListFieldsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFieldsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListFieldsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListFieldsRequest} ListFieldsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFieldsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListFieldsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListFieldsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListFieldsRequest} ListFieldsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFieldsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFieldsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFieldsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListFieldsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListFieldsRequest} ListFieldsRequest + */ + ListFieldsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListFieldsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListFieldsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListFieldsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListFieldsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @static + * @param {google.firestore.admin.v1.ListFieldsRequest} message ListFieldsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFieldsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + object.filter = message.filter; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListFieldsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @instance + * @returns {Object.} JSON object + */ + ListFieldsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListFieldsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListFieldsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFieldsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListFieldsRequest"; + }; + + return ListFieldsRequest; + })(); + + v1.ListFieldsResponse = (function() { + + /** + * Properties of a ListFieldsResponse. + * @memberof google.firestore.admin.v1 + * @interface IListFieldsResponse + * @property {Array.|null} [fields] ListFieldsResponse fields + * @property {string|null} [nextPageToken] ListFieldsResponse nextPageToken + */ + + /** + * Constructs a new ListFieldsResponse. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListFieldsResponse. + * @implements IListFieldsResponse + * @constructor + * @param {google.firestore.admin.v1.IListFieldsResponse=} [properties] Properties to set + */ + function ListFieldsResponse(properties) { + this.fields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFieldsResponse fields. + * @member {Array.} fields + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @instance + */ + ListFieldsResponse.prototype.fields = $util.emptyArray; + + /** + * ListFieldsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @instance + */ + ListFieldsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListFieldsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @static + * @param {google.firestore.admin.v1.IListFieldsResponse=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListFieldsResponse} ListFieldsResponse instance + */ + ListFieldsResponse.create = function create(properties) { + return new ListFieldsResponse(properties); + }; + + /** + * Encodes the specified ListFieldsResponse message. Does not implicitly {@link google.firestore.admin.v1.ListFieldsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @static + * @param {google.firestore.admin.v1.IListFieldsResponse} message ListFieldsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFieldsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fields != null && message.fields.length) + for (var i = 0; i < message.fields.length; ++i) + $root.google.firestore.admin.v1.Field.encode(message.fields[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListFieldsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListFieldsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @static + * @param {google.firestore.admin.v1.IListFieldsResponse} message ListFieldsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFieldsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListFieldsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListFieldsResponse} ListFieldsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFieldsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListFieldsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.fields && message.fields.length)) + message.fields = []; + message.fields.push($root.google.firestore.admin.v1.Field.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListFieldsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListFieldsResponse} ListFieldsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFieldsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFieldsResponse message. + * @function verify + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFieldsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { + if (!Array.isArray(message.fields)) + return "fields: array expected"; + for (var i = 0; i < message.fields.length; ++i) { + var error = $root.google.firestore.admin.v1.Field.verify(message.fields[i], long + 1); + if (error) + return "fields." + error; + } + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListFieldsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListFieldsResponse} ListFieldsResponse + */ + ListFieldsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListFieldsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListFieldsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListFieldsResponse(); + if (object.fields) { + if (!Array.isArray(object.fields)) + throw TypeError(".google.firestore.admin.v1.ListFieldsResponse.fields: array expected"); + message.fields = []; + for (var i = 0; i < object.fields.length; ++i) { + if (!$util.isObject(object.fields[i])) + throw TypeError(".google.firestore.admin.v1.ListFieldsResponse.fields: object expected"); + message.fields[i] = $root.google.firestore.admin.v1.Field.fromObject(object.fields[i], long + 1); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListFieldsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @static + * @param {google.firestore.admin.v1.ListFieldsResponse} message ListFieldsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFieldsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.fields = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.fields && message.fields.length) { + object.fields = []; + for (var j = 0; j < message.fields.length; ++j) + object.fields[j] = $root.google.firestore.admin.v1.Field.toObject(message.fields[j], options, q + 1); + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListFieldsResponse to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @instance + * @returns {Object.} JSON object + */ + ListFieldsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListFieldsResponse + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListFieldsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFieldsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListFieldsResponse"; + }; + + return ListFieldsResponse; + })(); + + v1.ExportDocumentsRequest = (function() { + + /** + * Properties of an ExportDocumentsRequest. + * @memberof google.firestore.admin.v1 + * @interface IExportDocumentsRequest + * @property {string|null} [name] ExportDocumentsRequest name + * @property {Array.|null} [collectionIds] ExportDocumentsRequest collectionIds + * @property {string|null} [outputUriPrefix] ExportDocumentsRequest outputUriPrefix + * @property {Array.|null} [namespaceIds] ExportDocumentsRequest namespaceIds + * @property {google.protobuf.ITimestamp|null} [snapshotTime] ExportDocumentsRequest snapshotTime + */ + + /** + * Constructs a new ExportDocumentsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an ExportDocumentsRequest. + * @implements IExportDocumentsRequest + * @constructor + * @param {google.firestore.admin.v1.IExportDocumentsRequest=} [properties] Properties to set + */ + function ExportDocumentsRequest(properties) { + this.collectionIds = []; + this.namespaceIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportDocumentsRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @instance + */ + ExportDocumentsRequest.prototype.name = ""; + + /** + * ExportDocumentsRequest collectionIds. + * @member {Array.} collectionIds + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @instance + */ + ExportDocumentsRequest.prototype.collectionIds = $util.emptyArray; + + /** + * ExportDocumentsRequest outputUriPrefix. + * @member {string} outputUriPrefix + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @instance + */ + ExportDocumentsRequest.prototype.outputUriPrefix = ""; + + /** + * ExportDocumentsRequest namespaceIds. + * @member {Array.} namespaceIds + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @instance + */ + ExportDocumentsRequest.prototype.namespaceIds = $util.emptyArray; + + /** + * ExportDocumentsRequest snapshotTime. + * @member {google.protobuf.ITimestamp|null|undefined} snapshotTime + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @instance + */ + ExportDocumentsRequest.prototype.snapshotTime = null; + + /** + * Creates a new ExportDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @static + * @param {google.firestore.admin.v1.IExportDocumentsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ExportDocumentsRequest} ExportDocumentsRequest instance + */ + ExportDocumentsRequest.create = function create(properties) { + return new ExportDocumentsRequest(properties); + }; + + /** + * Encodes the specified ExportDocumentsRequest message. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @static + * @param {google.firestore.admin.v1.IExportDocumentsRequest} message ExportDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.collectionIds != null && message.collectionIds.length) + for (var i = 0; i < message.collectionIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.collectionIds[i]); + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputUriPrefix); + if (message.namespaceIds != null && message.namespaceIds.length) + for (var i = 0; i < message.namespaceIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.namespaceIds[i]); + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + $root.google.protobuf.Timestamp.encode(message.snapshotTime, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @static + * @param {google.firestore.admin.v1.IExportDocumentsRequest} message ExportDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExportDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ExportDocumentsRequest} ExportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ExportDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.collectionIds && message.collectionIds.length)) + message.collectionIds = []; + message.collectionIds.push(reader.string()); + break; + } + case 3: { + message.outputUriPrefix = reader.string(); + break; + } + case 4: { + if (!(message.namespaceIds && message.namespaceIds.length)) + message.namespaceIds = []; + message.namespaceIds.push(reader.string()); + break; + } + case 5: { + message.snapshotTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExportDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ExportDocumentsRequest} ExportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportDocumentsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportDocumentsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.collectionIds != null && Object.hasOwnProperty.call(message, "collectionIds")) { + if (!Array.isArray(message.collectionIds)) + return "collectionIds: array expected"; + for (var i = 0; i < message.collectionIds.length; ++i) + if (!$util.isString(message.collectionIds[i])) + return "collectionIds: string[] expected"; + } + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + if (!$util.isString(message.outputUriPrefix)) + return "outputUriPrefix: string expected"; + if (message.namespaceIds != null && Object.hasOwnProperty.call(message, "namespaceIds")) { + if (!Array.isArray(message.namespaceIds)) + return "namespaceIds: array expected"; + for (var i = 0; i < message.namespaceIds.length; ++i) + if (!$util.isString(message.namespaceIds[i])) + return "namespaceIds: string[] expected"; + } + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.snapshotTime, long + 1); + if (error) + return "snapshotTime." + error; + } + return null; + }; + + /** + * Creates an ExportDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ExportDocumentsRequest} ExportDocumentsRequest + */ + ExportDocumentsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ExportDocumentsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ExportDocumentsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.collectionIds) { + if (!Array.isArray(object.collectionIds)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsRequest.collectionIds: array expected"); + message.collectionIds = []; + for (var i = 0; i < object.collectionIds.length; ++i) + message.collectionIds[i] = String(object.collectionIds[i]); + } + if (object.outputUriPrefix != null) + message.outputUriPrefix = String(object.outputUriPrefix); + if (object.namespaceIds) { + if (!Array.isArray(object.namespaceIds)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsRequest.namespaceIds: array expected"); + message.namespaceIds = []; + for (var i = 0; i < object.namespaceIds.length; ++i) + message.namespaceIds[i] = String(object.namespaceIds[i]); + } + if (object.snapshotTime != null) { + if (!$util.isObject(object.snapshotTime)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsRequest.snapshotTime: object expected"); + message.snapshotTime = $root.google.protobuf.Timestamp.fromObject(object.snapshotTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an ExportDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @static + * @param {google.firestore.admin.v1.ExportDocumentsRequest} message ExportDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportDocumentsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.collectionIds = []; + object.namespaceIds = []; + } + if (options.defaults) { + object.name = ""; + object.outputUriPrefix = ""; + object.snapshotTime = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.collectionIds && message.collectionIds.length) { + object.collectionIds = []; + for (var j = 0; j < message.collectionIds.length; ++j) + object.collectionIds[j] = message.collectionIds[j]; + } + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + object.outputUriPrefix = message.outputUriPrefix; + if (message.namespaceIds && message.namespaceIds.length) { + object.namespaceIds = []; + for (var j = 0; j < message.namespaceIds.length; ++j) + object.namespaceIds[j] = message.namespaceIds[j]; + } + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + object.snapshotTime = $root.google.protobuf.Timestamp.toObject(message.snapshotTime, options, q + 1); + return object; + }; + + /** + * Converts this ExportDocumentsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + ExportDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportDocumentsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ExportDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ExportDocumentsRequest"; + }; + + return ExportDocumentsRequest; + })(); + + v1.ImportDocumentsRequest = (function() { + + /** + * Properties of an ImportDocumentsRequest. + * @memberof google.firestore.admin.v1 + * @interface IImportDocumentsRequest + * @property {string|null} [name] ImportDocumentsRequest name + * @property {Array.|null} [collectionIds] ImportDocumentsRequest collectionIds + * @property {string|null} [inputUriPrefix] ImportDocumentsRequest inputUriPrefix + * @property {Array.|null} [namespaceIds] ImportDocumentsRequest namespaceIds + */ + + /** + * Constructs a new ImportDocumentsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an ImportDocumentsRequest. + * @implements IImportDocumentsRequest + * @constructor + * @param {google.firestore.admin.v1.IImportDocumentsRequest=} [properties] Properties to set + */ + function ImportDocumentsRequest(properties) { + this.collectionIds = []; + this.namespaceIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportDocumentsRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.name = ""; + + /** + * ImportDocumentsRequest collectionIds. + * @member {Array.} collectionIds + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.collectionIds = $util.emptyArray; + + /** + * ImportDocumentsRequest inputUriPrefix. + * @member {string} inputUriPrefix + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.inputUriPrefix = ""; + + /** + * ImportDocumentsRequest namespaceIds. + * @member {Array.} namespaceIds + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.namespaceIds = $util.emptyArray; + + /** + * Creates a new ImportDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @static + * @param {google.firestore.admin.v1.IImportDocumentsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ImportDocumentsRequest} ImportDocumentsRequest instance + */ + ImportDocumentsRequest.create = function create(properties) { + return new ImportDocumentsRequest(properties); + }; + + /** + * Encodes the specified ImportDocumentsRequest message. Does not implicitly {@link google.firestore.admin.v1.ImportDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @static + * @param {google.firestore.admin.v1.IImportDocumentsRequest} message ImportDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.collectionIds != null && message.collectionIds.length) + for (var i = 0; i < message.collectionIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.collectionIds[i]); + if (message.inputUriPrefix != null && Object.hasOwnProperty.call(message, "inputUriPrefix")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.inputUriPrefix); + if (message.namespaceIds != null && message.namespaceIds.length) + for (var i = 0; i < message.namespaceIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.namespaceIds[i]); + return writer; + }; + + /** + * Encodes the specified ImportDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ImportDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @static + * @param {google.firestore.admin.v1.IImportDocumentsRequest} message ImportDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ImportDocumentsRequest} ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ImportDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.collectionIds && message.collectionIds.length)) + message.collectionIds = []; + message.collectionIds.push(reader.string()); + break; + } + case 3: { + message.inputUriPrefix = reader.string(); + break; + } + case 4: { + if (!(message.namespaceIds && message.namespaceIds.length)) + message.namespaceIds = []; + message.namespaceIds.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ImportDocumentsRequest} ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportDocumentsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportDocumentsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.collectionIds != null && Object.hasOwnProperty.call(message, "collectionIds")) { + if (!Array.isArray(message.collectionIds)) + return "collectionIds: array expected"; + for (var i = 0; i < message.collectionIds.length; ++i) + if (!$util.isString(message.collectionIds[i])) + return "collectionIds: string[] expected"; + } + if (message.inputUriPrefix != null && Object.hasOwnProperty.call(message, "inputUriPrefix")) + if (!$util.isString(message.inputUriPrefix)) + return "inputUriPrefix: string expected"; + if (message.namespaceIds != null && Object.hasOwnProperty.call(message, "namespaceIds")) { + if (!Array.isArray(message.namespaceIds)) + return "namespaceIds: array expected"; + for (var i = 0; i < message.namespaceIds.length; ++i) + if (!$util.isString(message.namespaceIds[i])) + return "namespaceIds: string[] expected"; + } + return null; + }; + + /** + * Creates an ImportDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ImportDocumentsRequest} ImportDocumentsRequest + */ + ImportDocumentsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ImportDocumentsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ImportDocumentsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.collectionIds) { + if (!Array.isArray(object.collectionIds)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsRequest.collectionIds: array expected"); + message.collectionIds = []; + for (var i = 0; i < object.collectionIds.length; ++i) + message.collectionIds[i] = String(object.collectionIds[i]); + } + if (object.inputUriPrefix != null) + message.inputUriPrefix = String(object.inputUriPrefix); + if (object.namespaceIds) { + if (!Array.isArray(object.namespaceIds)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsRequest.namespaceIds: array expected"); + message.namespaceIds = []; + for (var i = 0; i < object.namespaceIds.length; ++i) + message.namespaceIds[i] = String(object.namespaceIds[i]); + } + return message; + }; + + /** + * Creates a plain object from an ImportDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @static + * @param {google.firestore.admin.v1.ImportDocumentsRequest} message ImportDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportDocumentsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.collectionIds = []; + object.namespaceIds = []; + } + if (options.defaults) { + object.name = ""; + object.inputUriPrefix = ""; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.collectionIds && message.collectionIds.length) { + object.collectionIds = []; + for (var j = 0; j < message.collectionIds.length; ++j) + object.collectionIds[j] = message.collectionIds[j]; + } + if (message.inputUriPrefix != null && Object.hasOwnProperty.call(message, "inputUriPrefix")) + object.inputUriPrefix = message.inputUriPrefix; + if (message.namespaceIds && message.namespaceIds.length) { + object.namespaceIds = []; + for (var j = 0; j < message.namespaceIds.length; ++j) + object.namespaceIds[j] = message.namespaceIds[j]; + } + return object; + }; + + /** + * Converts this ImportDocumentsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportDocumentsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ImportDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ImportDocumentsRequest"; + }; + + return ImportDocumentsRequest; + })(); + + v1.BulkDeleteDocumentsRequest = (function() { + + /** + * Properties of a BulkDeleteDocumentsRequest. + * @memberof google.firestore.admin.v1 + * @interface IBulkDeleteDocumentsRequest + * @property {string|null} [name] BulkDeleteDocumentsRequest name + * @property {Array.|null} [collectionIds] BulkDeleteDocumentsRequest collectionIds + * @property {Array.|null} [namespaceIds] BulkDeleteDocumentsRequest namespaceIds + */ + + /** + * Constructs a new BulkDeleteDocumentsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a BulkDeleteDocumentsRequest. + * @implements IBulkDeleteDocumentsRequest + * @constructor + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsRequest=} [properties] Properties to set + */ + function BulkDeleteDocumentsRequest(properties) { + this.collectionIds = []; + this.namespaceIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BulkDeleteDocumentsRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @instance + */ + BulkDeleteDocumentsRequest.prototype.name = ""; + + /** + * BulkDeleteDocumentsRequest collectionIds. + * @member {Array.} collectionIds + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @instance + */ + BulkDeleteDocumentsRequest.prototype.collectionIds = $util.emptyArray; + + /** + * BulkDeleteDocumentsRequest namespaceIds. + * @member {Array.} namespaceIds + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @instance + */ + BulkDeleteDocumentsRequest.prototype.namespaceIds = $util.emptyArray; + + /** + * Creates a new BulkDeleteDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @static + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsRequest} BulkDeleteDocumentsRequest instance + */ + BulkDeleteDocumentsRequest.create = function create(properties) { + return new BulkDeleteDocumentsRequest(properties); + }; + + /** + * Encodes the specified BulkDeleteDocumentsRequest message. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @static + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsRequest} message BulkDeleteDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BulkDeleteDocumentsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.collectionIds != null && message.collectionIds.length) + for (var i = 0; i < message.collectionIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.collectionIds[i]); + if (message.namespaceIds != null && message.namespaceIds.length) + for (var i = 0; i < message.namespaceIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.namespaceIds[i]); + return writer; + }; + + /** + * Encodes the specified BulkDeleteDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @static + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsRequest} message BulkDeleteDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BulkDeleteDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BulkDeleteDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsRequest} BulkDeleteDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BulkDeleteDocumentsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.BulkDeleteDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.collectionIds && message.collectionIds.length)) + message.collectionIds = []; + message.collectionIds.push(reader.string()); + break; + } + case 3: { + if (!(message.namespaceIds && message.namespaceIds.length)) + message.namespaceIds = []; + message.namespaceIds.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BulkDeleteDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsRequest} BulkDeleteDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BulkDeleteDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BulkDeleteDocumentsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BulkDeleteDocumentsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.collectionIds != null && Object.hasOwnProperty.call(message, "collectionIds")) { + if (!Array.isArray(message.collectionIds)) + return "collectionIds: array expected"; + for (var i = 0; i < message.collectionIds.length; ++i) + if (!$util.isString(message.collectionIds[i])) + return "collectionIds: string[] expected"; + } + if (message.namespaceIds != null && Object.hasOwnProperty.call(message, "namespaceIds")) { + if (!Array.isArray(message.namespaceIds)) + return "namespaceIds: array expected"; + for (var i = 0; i < message.namespaceIds.length; ++i) + if (!$util.isString(message.namespaceIds[i])) + return "namespaceIds: string[] expected"; + } + return null; + }; + + /** + * Creates a BulkDeleteDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsRequest} BulkDeleteDocumentsRequest + */ + BulkDeleteDocumentsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.BulkDeleteDocumentsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.BulkDeleteDocumentsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.collectionIds) { + if (!Array.isArray(object.collectionIds)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsRequest.collectionIds: array expected"); + message.collectionIds = []; + for (var i = 0; i < object.collectionIds.length; ++i) + message.collectionIds[i] = String(object.collectionIds[i]); + } + if (object.namespaceIds) { + if (!Array.isArray(object.namespaceIds)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsRequest.namespaceIds: array expected"); + message.namespaceIds = []; + for (var i = 0; i < object.namespaceIds.length; ++i) + message.namespaceIds[i] = String(object.namespaceIds[i]); + } + return message; + }; + + /** + * Creates a plain object from a BulkDeleteDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @static + * @param {google.firestore.admin.v1.BulkDeleteDocumentsRequest} message BulkDeleteDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BulkDeleteDocumentsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.collectionIds = []; + object.namespaceIds = []; + } + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.collectionIds && message.collectionIds.length) { + object.collectionIds = []; + for (var j = 0; j < message.collectionIds.length; ++j) + object.collectionIds[j] = message.collectionIds[j]; + } + if (message.namespaceIds && message.namespaceIds.length) { + object.namespaceIds = []; + for (var j = 0; j < message.namespaceIds.length; ++j) + object.namespaceIds[j] = message.namespaceIds[j]; + } + return object; + }; + + /** + * Converts this BulkDeleteDocumentsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + BulkDeleteDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BulkDeleteDocumentsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BulkDeleteDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.BulkDeleteDocumentsRequest"; + }; + + return BulkDeleteDocumentsRequest; + })(); + + v1.BulkDeleteDocumentsResponse = (function() { + + /** + * Properties of a BulkDeleteDocumentsResponse. + * @memberof google.firestore.admin.v1 + * @interface IBulkDeleteDocumentsResponse + */ + + /** + * Constructs a new BulkDeleteDocumentsResponse. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a BulkDeleteDocumentsResponse. + * @implements IBulkDeleteDocumentsResponse + * @constructor + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsResponse=} [properties] Properties to set + */ + function BulkDeleteDocumentsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new BulkDeleteDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @static + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsResponse=} [properties] Properties to set + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsResponse} BulkDeleteDocumentsResponse instance + */ + BulkDeleteDocumentsResponse.create = function create(properties) { + return new BulkDeleteDocumentsResponse(properties); + }; + + /** + * Encodes the specified BulkDeleteDocumentsResponse message. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @static + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsResponse} message BulkDeleteDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BulkDeleteDocumentsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified BulkDeleteDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @static + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsResponse} message BulkDeleteDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BulkDeleteDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BulkDeleteDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsResponse} BulkDeleteDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BulkDeleteDocumentsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.BulkDeleteDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BulkDeleteDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsResponse} BulkDeleteDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BulkDeleteDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BulkDeleteDocumentsResponse message. + * @function verify + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BulkDeleteDocumentsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates a BulkDeleteDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsResponse} BulkDeleteDocumentsResponse + */ + BulkDeleteDocumentsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.BulkDeleteDocumentsResponse) + return object; + return new $root.google.firestore.admin.v1.BulkDeleteDocumentsResponse(); + }; + + /** + * Creates a plain object from a BulkDeleteDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @static + * @param {google.firestore.admin.v1.BulkDeleteDocumentsResponse} message BulkDeleteDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BulkDeleteDocumentsResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this BulkDeleteDocumentsResponse to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + BulkDeleteDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BulkDeleteDocumentsResponse + * @function getTypeUrl + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BulkDeleteDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.BulkDeleteDocumentsResponse"; + }; + + return BulkDeleteDocumentsResponse; + })(); + + v1.GetBackupRequest = (function() { + + /** + * Properties of a GetBackupRequest. + * @memberof google.firestore.admin.v1 + * @interface IGetBackupRequest + * @property {string|null} [name] GetBackupRequest name + */ + + /** + * Constructs a new GetBackupRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a GetBackupRequest. + * @implements IGetBackupRequest + * @constructor + * @param {google.firestore.admin.v1.IGetBackupRequest=} [properties] Properties to set + */ + function GetBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBackupRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.GetBackupRequest + * @instance + */ + GetBackupRequest.prototype.name = ""; + + /** + * Creates a new GetBackupRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.GetBackupRequest + * @static + * @param {google.firestore.admin.v1.IGetBackupRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.GetBackupRequest} GetBackupRequest instance + */ + GetBackupRequest.create = function create(properties) { + return new GetBackupRequest(properties); + }; + + /** + * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.firestore.admin.v1.GetBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.GetBackupRequest + * @static + * @param {google.firestore.admin.v1.IGetBackupRequest} message GetBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.GetBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.GetBackupRequest + * @static + * @param {google.firestore.admin.v1.IGetBackupRequest} message GetBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.GetBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.GetBackupRequest} GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.GetBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.GetBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.GetBackupRequest} GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBackupRequest message. + * @function verify + * @memberof google.firestore.admin.v1.GetBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBackupRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.GetBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.GetBackupRequest} GetBackupRequest + */ + GetBackupRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.GetBackupRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.GetBackupRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.GetBackupRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.GetBackupRequest + * @static + * @param {google.firestore.admin.v1.GetBackupRequest} message GetBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBackupRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetBackupRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.GetBackupRequest + * @instance + * @returns {Object.} JSON object + */ + GetBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetBackupRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.GetBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.GetBackupRequest"; + }; + + return GetBackupRequest; + })(); + + v1.ListBackupsRequest = (function() { + + /** + * Properties of a ListBackupsRequest. + * @memberof google.firestore.admin.v1 + * @interface IListBackupsRequest + * @property {string|null} [parent] ListBackupsRequest parent + * @property {string|null} [filter] ListBackupsRequest filter + */ + + /** + * Constructs a new ListBackupsRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListBackupsRequest. + * @implements IListBackupsRequest + * @constructor + * @param {google.firestore.admin.v1.IListBackupsRequest=} [properties] Properties to set + */ + function ListBackupsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupsRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.parent = ""; + + /** + * ListBackupsRequest filter. + * @member {string} filter + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.filter = ""; + + /** + * Creates a new ListBackupsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @static + * @param {google.firestore.admin.v1.IListBackupsRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListBackupsRequest} ListBackupsRequest instance + */ + ListBackupsRequest.create = function create(properties) { + return new ListBackupsRequest(properties); + }; + + /** + * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.firestore.admin.v1.ListBackupsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @static + * @param {google.firestore.admin.v1.IListBackupsRequest} message ListBackupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListBackupsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @static + * @param {google.firestore.admin.v1.IListBackupsRequest} message ListBackupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListBackupsRequest} ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListBackupsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListBackupsRequest} ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupsRequest message. + * @function verify + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListBackupsRequest} ListBackupsRequest + */ + ListBackupsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListBackupsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListBackupsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListBackupsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @static + * @param {google.firestore.admin.v1.ListBackupsRequest} message ListBackupsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListBackupsRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @instance + * @returns {Object.} JSON object + */ + ListBackupsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupsRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListBackupsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListBackupsRequest"; + }; + + return ListBackupsRequest; + })(); + + v1.ListBackupsResponse = (function() { + + /** + * Properties of a ListBackupsResponse. + * @memberof google.firestore.admin.v1 + * @interface IListBackupsResponse + * @property {Array.|null} [backups] ListBackupsResponse backups + * @property {Array.|null} [unreachable] ListBackupsResponse unreachable + */ + + /** + * Constructs a new ListBackupsResponse. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a ListBackupsResponse. + * @implements IListBackupsResponse + * @constructor + * @param {google.firestore.admin.v1.IListBackupsResponse=} [properties] Properties to set + */ + function ListBackupsResponse(properties) { + this.backups = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupsResponse backups. + * @member {Array.} backups + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @instance + */ + ListBackupsResponse.prototype.backups = $util.emptyArray; + + /** + * ListBackupsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @instance + */ + ListBackupsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListBackupsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @static + * @param {google.firestore.admin.v1.IListBackupsResponse=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ListBackupsResponse} ListBackupsResponse instance + */ + ListBackupsResponse.create = function create(properties) { + return new ListBackupsResponse(properties); + }; + + /** + * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.firestore.admin.v1.ListBackupsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @static + * @param {google.firestore.admin.v1.IListBackupsResponse} message ListBackupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.backups != null && message.backups.length) + for (var i = 0; i < message.backups.length; ++i) + $root.google.firestore.admin.v1.Backup.encode(message.backups[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ListBackupsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @static + * @param {google.firestore.admin.v1.IListBackupsResponse} message ListBackupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ListBackupsResponse} ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ListBackupsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.backups && message.backups.length)) + message.backups = []; + message.backups.push($root.google.firestore.admin.v1.Backup.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ListBackupsResponse} ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupsResponse message. + * @function verify + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.backups != null && Object.hasOwnProperty.call(message, "backups")) { + if (!Array.isArray(message.backups)) + return "backups: array expected"; + for (var i = 0; i < message.backups.length; ++i) { + var error = $root.google.firestore.admin.v1.Backup.verify(message.backups[i], long + 1); + if (error) + return "backups." + error; + } + } + if (message.unreachable != null && Object.hasOwnProperty.call(message, "unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ListBackupsResponse} ListBackupsResponse + */ + ListBackupsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ListBackupsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ListBackupsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ListBackupsResponse(); + if (object.backups) { + if (!Array.isArray(object.backups)) + throw TypeError(".google.firestore.admin.v1.ListBackupsResponse.backups: array expected"); + message.backups = []; + for (var i = 0; i < object.backups.length; ++i) { + if (!$util.isObject(object.backups[i])) + throw TypeError(".google.firestore.admin.v1.ListBackupsResponse.backups: object expected"); + message.backups[i] = $root.google.firestore.admin.v1.Backup.fromObject(object.backups[i], long + 1); + } + } + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.firestore.admin.v1.ListBackupsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @static + * @param {google.firestore.admin.v1.ListBackupsResponse} message ListBackupsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.backups = []; + object.unreachable = []; + } + if (message.backups && message.backups.length) { + object.backups = []; + for (var j = 0; j < message.backups.length; ++j) + object.backups[j] = $root.google.firestore.admin.v1.Backup.toObject(message.backups[j], options, q + 1); + } + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListBackupsResponse to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @instance + * @returns {Object.} JSON object + */ + ListBackupsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupsResponse + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ListBackupsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ListBackupsResponse"; + }; + + return ListBackupsResponse; + })(); + + v1.DeleteBackupRequest = (function() { + + /** + * Properties of a DeleteBackupRequest. + * @memberof google.firestore.admin.v1 + * @interface IDeleteBackupRequest + * @property {string|null} [name] DeleteBackupRequest name + */ + + /** + * Constructs a new DeleteBackupRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a DeleteBackupRequest. + * @implements IDeleteBackupRequest + * @constructor + * @param {google.firestore.admin.v1.IDeleteBackupRequest=} [properties] Properties to set + */ + function DeleteBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteBackupRequest name. + * @member {string} name + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @instance + */ + DeleteBackupRequest.prototype.name = ""; + + /** + * Creates a new DeleteBackupRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @static + * @param {google.firestore.admin.v1.IDeleteBackupRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.DeleteBackupRequest} DeleteBackupRequest instance + */ + DeleteBackupRequest.create = function create(properties) { + return new DeleteBackupRequest(properties); + }; + + /** + * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.firestore.admin.v1.DeleteBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @static + * @param {google.firestore.admin.v1.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DeleteBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @static + * @param {google.firestore.admin.v1.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.DeleteBackupRequest} DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.DeleteBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.DeleteBackupRequest} DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteBackupRequest message. + * @function verify + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteBackupRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.DeleteBackupRequest} DeleteBackupRequest + */ + DeleteBackupRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.DeleteBackupRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.DeleteBackupRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.DeleteBackupRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @static + * @param {google.firestore.admin.v1.DeleteBackupRequest} message DeleteBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteBackupRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteBackupRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteBackupRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.DeleteBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.DeleteBackupRequest"; + }; + + return DeleteBackupRequest; + })(); + + v1.RestoreDatabaseRequest = (function() { + + /** + * Properties of a RestoreDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @interface IRestoreDatabaseRequest + * @property {string|null} [parent] RestoreDatabaseRequest parent + * @property {string|null} [databaseId] RestoreDatabaseRequest databaseId + * @property {string|null} [backup] RestoreDatabaseRequest backup + * @property {google.firestore.admin.v1.Database.IEncryptionConfig|null} [encryptionConfig] RestoreDatabaseRequest encryptionConfig + * @property {Object.|null} [tags] RestoreDatabaseRequest tags + */ + + /** + * Constructs a new RestoreDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a RestoreDatabaseRequest. + * @implements IRestoreDatabaseRequest + * @constructor + * @param {google.firestore.admin.v1.IRestoreDatabaseRequest=} [properties] Properties to set + */ + function RestoreDatabaseRequest(properties) { + this.tags = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RestoreDatabaseRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @instance + */ + RestoreDatabaseRequest.prototype.parent = ""; + + /** + * RestoreDatabaseRequest databaseId. + * @member {string} databaseId + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @instance + */ + RestoreDatabaseRequest.prototype.databaseId = ""; + + /** + * RestoreDatabaseRequest backup. + * @member {string} backup + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @instance + */ + RestoreDatabaseRequest.prototype.backup = ""; + + /** + * RestoreDatabaseRequest encryptionConfig. + * @member {google.firestore.admin.v1.Database.IEncryptionConfig|null|undefined} encryptionConfig + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @instance + */ + RestoreDatabaseRequest.prototype.encryptionConfig = null; + + /** + * RestoreDatabaseRequest tags. + * @member {Object.} tags + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @instance + */ + RestoreDatabaseRequest.prototype.tags = $util.emptyObject; + + /** + * Creates a new RestoreDatabaseRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IRestoreDatabaseRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.RestoreDatabaseRequest} RestoreDatabaseRequest instance + */ + RestoreDatabaseRequest.create = function create(properties) { + return new RestoreDatabaseRequest(properties); + }; + + /** + * Encodes the specified RestoreDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.RestoreDatabaseRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IRestoreDatabaseRequest} message RestoreDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreDatabaseRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.databaseId != null && Object.hasOwnProperty.call(message, "databaseId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.databaseId); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.backup); + if (message.encryptionConfig != null && Object.hasOwnProperty.call(message, "encryptionConfig")) + $root.google.firestore.admin.v1.Database.EncryptionConfig.encode(message.encryptionConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) + for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified RestoreDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.RestoreDatabaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @static + * @param {google.firestore.admin.v1.IRestoreDatabaseRequest} message RestoreDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreDatabaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RestoreDatabaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.RestoreDatabaseRequest} RestoreDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreDatabaseRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.RestoreDatabaseRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.databaseId = reader.string(); + break; + } + case 3: { + message.backup = reader.string(); + break; + } + case 9: { + message.encryptionConfig = $root.google.firestore.admin.v1.Database.EncryptionConfig.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 10: { + if (message.tags === $util.emptyObject) + message.tags = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.tags, key); + message.tags[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RestoreDatabaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.RestoreDatabaseRequest} RestoreDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreDatabaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RestoreDatabaseRequest message. + * @function verify + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RestoreDatabaseRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.databaseId != null && Object.hasOwnProperty.call(message, "databaseId")) + if (!$util.isString(message.databaseId)) + return "databaseId: string expected"; + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + if (!$util.isString(message.backup)) + return "backup: string expected"; + if (message.encryptionConfig != null && Object.hasOwnProperty.call(message, "encryptionConfig")) { + var error = $root.google.firestore.admin.v1.Database.EncryptionConfig.verify(message.encryptionConfig, long + 1); + if (error) + return "encryptionConfig." + error; + } + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) { + if (!$util.isObject(message.tags)) + return "tags: object expected"; + var key = Object.keys(message.tags); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.tags[key[i]])) + return "tags: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a RestoreDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.RestoreDatabaseRequest} RestoreDatabaseRequest + */ + RestoreDatabaseRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.RestoreDatabaseRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.RestoreDatabaseRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.RestoreDatabaseRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.databaseId != null) + message.databaseId = String(object.databaseId); + if (object.backup != null) + message.backup = String(object.backup); + if (object.encryptionConfig != null) { + if (!$util.isObject(object.encryptionConfig)) + throw TypeError(".google.firestore.admin.v1.RestoreDatabaseRequest.encryptionConfig: object expected"); + message.encryptionConfig = $root.google.firestore.admin.v1.Database.EncryptionConfig.fromObject(object.encryptionConfig, long + 1); + } + if (object.tags) { + if (!$util.isObject(object.tags)) + throw TypeError(".google.firestore.admin.v1.RestoreDatabaseRequest.tags: object expected"); + message.tags = {}; + for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.tags, keys[i]); + message.tags[keys[i]] = String(object.tags[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a RestoreDatabaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @static + * @param {google.firestore.admin.v1.RestoreDatabaseRequest} message RestoreDatabaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RestoreDatabaseRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.tags = {}; + if (options.defaults) { + object.parent = ""; + object.databaseId = ""; + object.backup = ""; + object.encryptionConfig = null; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.databaseId != null && Object.hasOwnProperty.call(message, "databaseId")) + object.databaseId = message.databaseId; + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + object.backup = message.backup; + if (message.encryptionConfig != null && Object.hasOwnProperty.call(message, "encryptionConfig")) + object.encryptionConfig = $root.google.firestore.admin.v1.Database.EncryptionConfig.toObject(message.encryptionConfig, options, q + 1); + var keys2; + if (message.tags && (keys2 = Object.keys(message.tags)).length) { + object.tags = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.tags, keys2[j]); + object.tags[keys2[j]] = message.tags[keys2[j]]; + } + } + return object; + }; + + /** + * Converts this RestoreDatabaseRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @instance + * @returns {Object.} JSON object + */ + RestoreDatabaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RestoreDatabaseRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.RestoreDatabaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RestoreDatabaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.RestoreDatabaseRequest"; + }; + + return RestoreDatabaseRequest; + })(); + + v1.CloneDatabaseRequest = (function() { + + /** + * Properties of a CloneDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @interface ICloneDatabaseRequest + * @property {string|null} [parent] CloneDatabaseRequest parent + * @property {string|null} [databaseId] CloneDatabaseRequest databaseId + * @property {google.firestore.admin.v1.IPitrSnapshot|null} [pitrSnapshot] CloneDatabaseRequest pitrSnapshot + * @property {google.firestore.admin.v1.Database.IEncryptionConfig|null} [encryptionConfig] CloneDatabaseRequest encryptionConfig + * @property {Object.|null} [tags] CloneDatabaseRequest tags + */ + + /** + * Constructs a new CloneDatabaseRequest. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a CloneDatabaseRequest. + * @implements ICloneDatabaseRequest + * @constructor + * @param {google.firestore.admin.v1.ICloneDatabaseRequest=} [properties] Properties to set + */ + function CloneDatabaseRequest(properties) { + this.tags = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CloneDatabaseRequest parent. + * @member {string} parent + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @instance + */ + CloneDatabaseRequest.prototype.parent = ""; + + /** + * CloneDatabaseRequest databaseId. + * @member {string} databaseId + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @instance + */ + CloneDatabaseRequest.prototype.databaseId = ""; + + /** + * CloneDatabaseRequest pitrSnapshot. + * @member {google.firestore.admin.v1.IPitrSnapshot|null|undefined} pitrSnapshot + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @instance + */ + CloneDatabaseRequest.prototype.pitrSnapshot = null; + + /** + * CloneDatabaseRequest encryptionConfig. + * @member {google.firestore.admin.v1.Database.IEncryptionConfig|null|undefined} encryptionConfig + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @instance + */ + CloneDatabaseRequest.prototype.encryptionConfig = null; + + /** + * CloneDatabaseRequest tags. + * @member {Object.} tags + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @instance + */ + CloneDatabaseRequest.prototype.tags = $util.emptyObject; + + /** + * Creates a new CloneDatabaseRequest instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @static + * @param {google.firestore.admin.v1.ICloneDatabaseRequest=} [properties] Properties to set + * @returns {google.firestore.admin.v1.CloneDatabaseRequest} CloneDatabaseRequest instance + */ + CloneDatabaseRequest.create = function create(properties) { + return new CloneDatabaseRequest(properties); + }; + + /** + * Encodes the specified CloneDatabaseRequest message. Does not implicitly {@link google.firestore.admin.v1.CloneDatabaseRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @static + * @param {google.firestore.admin.v1.ICloneDatabaseRequest} message CloneDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloneDatabaseRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.databaseId != null && Object.hasOwnProperty.call(message, "databaseId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.databaseId); + if (message.encryptionConfig != null && Object.hasOwnProperty.call(message, "encryptionConfig")) + $root.google.firestore.admin.v1.Database.EncryptionConfig.encode(message.encryptionConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) + for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); + if (message.pitrSnapshot != null && Object.hasOwnProperty.call(message, "pitrSnapshot")) + $root.google.firestore.admin.v1.PitrSnapshot.encode(message.pitrSnapshot, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CloneDatabaseRequest message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CloneDatabaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @static + * @param {google.firestore.admin.v1.ICloneDatabaseRequest} message CloneDatabaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloneDatabaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CloneDatabaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.CloneDatabaseRequest} CloneDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloneDatabaseRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.CloneDatabaseRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.databaseId = reader.string(); + break; + } + case 6: { + message.pitrSnapshot = $root.google.firestore.admin.v1.PitrSnapshot.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.encryptionConfig = $root.google.firestore.admin.v1.Database.EncryptionConfig.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + if (message.tags === $util.emptyObject) + message.tags = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.tags, key); + message.tags[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CloneDatabaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.CloneDatabaseRequest} CloneDatabaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloneDatabaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloneDatabaseRequest message. + * @function verify + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloneDatabaseRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.databaseId != null && Object.hasOwnProperty.call(message, "databaseId")) + if (!$util.isString(message.databaseId)) + return "databaseId: string expected"; + if (message.pitrSnapshot != null && Object.hasOwnProperty.call(message, "pitrSnapshot")) { + var error = $root.google.firestore.admin.v1.PitrSnapshot.verify(message.pitrSnapshot, long + 1); + if (error) + return "pitrSnapshot." + error; + } + if (message.encryptionConfig != null && Object.hasOwnProperty.call(message, "encryptionConfig")) { + var error = $root.google.firestore.admin.v1.Database.EncryptionConfig.verify(message.encryptionConfig, long + 1); + if (error) + return "encryptionConfig." + error; + } + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) { + if (!$util.isObject(message.tags)) + return "tags: object expected"; + var key = Object.keys(message.tags); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.tags[key[i]])) + return "tags: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a CloneDatabaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.CloneDatabaseRequest} CloneDatabaseRequest + */ + CloneDatabaseRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.CloneDatabaseRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.CloneDatabaseRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.CloneDatabaseRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.databaseId != null) + message.databaseId = String(object.databaseId); + if (object.pitrSnapshot != null) { + if (!$util.isObject(object.pitrSnapshot)) + throw TypeError(".google.firestore.admin.v1.CloneDatabaseRequest.pitrSnapshot: object expected"); + message.pitrSnapshot = $root.google.firestore.admin.v1.PitrSnapshot.fromObject(object.pitrSnapshot, long + 1); + } + if (object.encryptionConfig != null) { + if (!$util.isObject(object.encryptionConfig)) + throw TypeError(".google.firestore.admin.v1.CloneDatabaseRequest.encryptionConfig: object expected"); + message.encryptionConfig = $root.google.firestore.admin.v1.Database.EncryptionConfig.fromObject(object.encryptionConfig, long + 1); + } + if (object.tags) { + if (!$util.isObject(object.tags)) + throw TypeError(".google.firestore.admin.v1.CloneDatabaseRequest.tags: object expected"); + message.tags = {}; + for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.tags, keys[i]); + message.tags[keys[i]] = String(object.tags[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a CloneDatabaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @static + * @param {google.firestore.admin.v1.CloneDatabaseRequest} message CloneDatabaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloneDatabaseRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.tags = {}; + if (options.defaults) { + object.parent = ""; + object.databaseId = ""; + object.encryptionConfig = null; + object.pitrSnapshot = null; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.databaseId != null && Object.hasOwnProperty.call(message, "databaseId")) + object.databaseId = message.databaseId; + if (message.encryptionConfig != null && Object.hasOwnProperty.call(message, "encryptionConfig")) + object.encryptionConfig = $root.google.firestore.admin.v1.Database.EncryptionConfig.toObject(message.encryptionConfig, options, q + 1); + var keys2; + if (message.tags && (keys2 = Object.keys(message.tags)).length) { + object.tags = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.tags, keys2[j]); + object.tags[keys2[j]] = message.tags[keys2[j]]; + } + } + if (message.pitrSnapshot != null && Object.hasOwnProperty.call(message, "pitrSnapshot")) + object.pitrSnapshot = $root.google.firestore.admin.v1.PitrSnapshot.toObject(message.pitrSnapshot, options, q + 1); + return object; + }; + + /** + * Converts this CloneDatabaseRequest to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @instance + * @returns {Object.} JSON object + */ + CloneDatabaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CloneDatabaseRequest + * @function getTypeUrl + * @memberof google.firestore.admin.v1.CloneDatabaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloneDatabaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.CloneDatabaseRequest"; + }; + + return CloneDatabaseRequest; + })(); + + v1.IndexOperationMetadata = (function() { + + /** + * Properties of an IndexOperationMetadata. + * @memberof google.firestore.admin.v1 + * @interface IIndexOperationMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] IndexOperationMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] IndexOperationMetadata endTime + * @property {string|null} [index] IndexOperationMetadata index + * @property {google.firestore.admin.v1.OperationState|null} [state] IndexOperationMetadata state + * @property {google.firestore.admin.v1.IProgress|null} [progressDocuments] IndexOperationMetadata progressDocuments + * @property {google.firestore.admin.v1.IProgress|null} [progressBytes] IndexOperationMetadata progressBytes + */ + + /** + * Constructs a new IndexOperationMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an IndexOperationMetadata. + * @implements IIndexOperationMetadata + * @constructor + * @param {google.firestore.admin.v1.IIndexOperationMetadata=} [properties] Properties to set + */ + function IndexOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * IndexOperationMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @instance + */ + IndexOperationMetadata.prototype.startTime = null; + + /** + * IndexOperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @instance + */ + IndexOperationMetadata.prototype.endTime = null; + + /** + * IndexOperationMetadata index. + * @member {string} index + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @instance + */ + IndexOperationMetadata.prototype.index = ""; + + /** + * IndexOperationMetadata state. + * @member {google.firestore.admin.v1.OperationState} state + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @instance + */ + IndexOperationMetadata.prototype.state = 0; + + /** + * IndexOperationMetadata progressDocuments. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressDocuments + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @instance + */ + IndexOperationMetadata.prototype.progressDocuments = null; + + /** + * IndexOperationMetadata progressBytes. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressBytes + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @instance + */ + IndexOperationMetadata.prototype.progressBytes = null; + + /** + * Creates a new IndexOperationMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @static + * @param {google.firestore.admin.v1.IIndexOperationMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.IndexOperationMetadata} IndexOperationMetadata instance + */ + IndexOperationMetadata.create = function create(properties) { + return new IndexOperationMetadata(properties); + }; + + /** + * Encodes the specified IndexOperationMetadata message. Does not implicitly {@link google.firestore.admin.v1.IndexOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @static + * @param {google.firestore.admin.v1.IIndexOperationMetadata} message IndexOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexOperationMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.index); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + $root.google.firestore.admin.v1.Progress.encode(message.progressDocuments, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + $root.google.firestore.admin.v1.Progress.encode(message.progressBytes, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified IndexOperationMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.IndexOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @static + * @param {google.firestore.admin.v1.IIndexOperationMetadata} message IndexOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an IndexOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.IndexOperationMetadata} IndexOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexOperationMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.IndexOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.index = reader.string(); + break; + } + case 4: { + message.state = reader.int32(); + break; + } + case 5: { + message.progressDocuments = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.progressBytes = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an IndexOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.IndexOperationMetadata} IndexOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IndexOperationMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IndexOperationMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime, long + 1); + if (error) + return "startTime." + error; + } + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime, long + 1); + if (error) + return "endTime." + error; + } + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + if (!$util.isString(message.index)) + return "index: string expected"; + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressDocuments, long + 1); + if (error) + return "progressDocuments." + error; + } + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressBytes, long + 1); + if (error) + return "progressBytes." + error; + } + return null; + }; + + /** + * Creates an IndexOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.IndexOperationMetadata} IndexOperationMetadata + */ + IndexOperationMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.IndexOperationMetadata) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.IndexOperationMetadata: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.IndexOperationMetadata(); + if (object.startTime != null) { + if (!$util.isObject(object.startTime)) + throw TypeError(".google.firestore.admin.v1.IndexOperationMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime, long + 1); + } + if (object.endTime != null) { + if (!$util.isObject(object.endTime)) + throw TypeError(".google.firestore.admin.v1.IndexOperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime, long + 1); + } + if (object.index != null) + message.index = String(object.index); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "INITIALIZING": + case 1: + message.state = 1; + break; + case "PROCESSING": + case 2: + message.state = 2; + break; + case "CANCELLING": + case 3: + message.state = 3; + break; + case "FINALIZING": + case 4: + message.state = 4; + break; + case "SUCCESSFUL": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + case "CANCELLED": + case 7: + message.state = 7; + break; + } + if (object.progressDocuments != null) { + if (!$util.isObject(object.progressDocuments)) + throw TypeError(".google.firestore.admin.v1.IndexOperationMetadata.progressDocuments: object expected"); + message.progressDocuments = $root.google.firestore.admin.v1.Progress.fromObject(object.progressDocuments, long + 1); + } + if (object.progressBytes != null) { + if (!$util.isObject(object.progressBytes)) + throw TypeError(".google.firestore.admin.v1.IndexOperationMetadata.progressBytes: object expected"); + message.progressBytes = $root.google.firestore.admin.v1.Progress.fromObject(object.progressBytes, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an IndexOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @static + * @param {google.firestore.admin.v1.IndexOperationMetadata} message IndexOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IndexOperationMetadata.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.index = ""; + object.state = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + object.progressDocuments = null; + object.progressBytes = null; + } + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options, q + 1); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options, q + 1); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + object.index = message.index; + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + object.state = options.enums === String ? $root.google.firestore.admin.v1.OperationState[message.state] === undefined ? message.state : $root.google.firestore.admin.v1.OperationState[message.state] : message.state; + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + object.progressDocuments = $root.google.firestore.admin.v1.Progress.toObject(message.progressDocuments, options, q + 1); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + object.progressBytes = $root.google.firestore.admin.v1.Progress.toObject(message.progressBytes, options, q + 1); + return object; + }; + + /** + * Converts this IndexOperationMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + IndexOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IndexOperationMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.IndexOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IndexOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.IndexOperationMetadata"; + }; + + return IndexOperationMetadata; + })(); + + v1.FieldOperationMetadata = (function() { + + /** + * Properties of a FieldOperationMetadata. + * @memberof google.firestore.admin.v1 + * @interface IFieldOperationMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] FieldOperationMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] FieldOperationMetadata endTime + * @property {string|null} [field] FieldOperationMetadata field + * @property {Array.|null} [indexConfigDeltas] FieldOperationMetadata indexConfigDeltas + * @property {google.firestore.admin.v1.OperationState|null} [state] FieldOperationMetadata state + * @property {google.firestore.admin.v1.IProgress|null} [progressDocuments] FieldOperationMetadata progressDocuments + * @property {google.firestore.admin.v1.IProgress|null} [progressBytes] FieldOperationMetadata progressBytes + * @property {google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta|null} [ttlConfigDelta] FieldOperationMetadata ttlConfigDelta + */ + + /** + * Constructs a new FieldOperationMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a FieldOperationMetadata. + * @implements IFieldOperationMetadata + * @constructor + * @param {google.firestore.admin.v1.IFieldOperationMetadata=} [properties] Properties to set + */ + function FieldOperationMetadata(properties) { + this.indexConfigDeltas = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOperationMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @instance + */ + FieldOperationMetadata.prototype.startTime = null; + + /** + * FieldOperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @instance + */ + FieldOperationMetadata.prototype.endTime = null; + + /** + * FieldOperationMetadata field. + * @member {string} field + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @instance + */ + FieldOperationMetadata.prototype.field = ""; + + /** + * FieldOperationMetadata indexConfigDeltas. + * @member {Array.} indexConfigDeltas + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @instance + */ + FieldOperationMetadata.prototype.indexConfigDeltas = $util.emptyArray; + + /** + * FieldOperationMetadata state. + * @member {google.firestore.admin.v1.OperationState} state + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @instance + */ + FieldOperationMetadata.prototype.state = 0; + + /** + * FieldOperationMetadata progressDocuments. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressDocuments + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @instance + */ + FieldOperationMetadata.prototype.progressDocuments = null; + + /** + * FieldOperationMetadata progressBytes. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressBytes + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @instance + */ + FieldOperationMetadata.prototype.progressBytes = null; + + /** + * FieldOperationMetadata ttlConfigDelta. + * @member {google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta|null|undefined} ttlConfigDelta + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @instance + */ + FieldOperationMetadata.prototype.ttlConfigDelta = null; + + /** + * Creates a new FieldOperationMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @static + * @param {google.firestore.admin.v1.IFieldOperationMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.FieldOperationMetadata} FieldOperationMetadata instance + */ + FieldOperationMetadata.create = function create(properties) { + return new FieldOperationMetadata(properties); + }; + + /** + * Encodes the specified FieldOperationMetadata message. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @static + * @param {google.firestore.admin.v1.IFieldOperationMetadata} message FieldOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOperationMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.field); + if (message.indexConfigDeltas != null && message.indexConfigDeltas.length) + for (var i = 0; i < message.indexConfigDeltas.length; ++i) + $root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.encode(message.indexConfigDeltas[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.state); + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + $root.google.firestore.admin.v1.Progress.encode(message.progressDocuments, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + $root.google.firestore.admin.v1.Progress.encode(message.progressBytes, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.ttlConfigDelta != null && Object.hasOwnProperty.call(message, "ttlConfigDelta")) + $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.encode(message.ttlConfigDelta, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOperationMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @static + * @param {google.firestore.admin.v1.IFieldOperationMetadata} message FieldOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.FieldOperationMetadata} FieldOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOperationMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.FieldOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.field = reader.string(); + break; + } + case 4: { + if (!(message.indexConfigDeltas && message.indexConfigDeltas.length)) + message.indexConfigDeltas = []; + message.indexConfigDeltas.push($root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 5: { + message.state = reader.int32(); + break; + } + case 6: { + message.progressDocuments = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.progressBytes = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 8: { + message.ttlConfigDelta = $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.FieldOperationMetadata} FieldOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOperationMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOperationMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime, long + 1); + if (error) + return "startTime." + error; + } + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime, long + 1); + if (error) + return "endTime." + error; + } + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + if (!$util.isString(message.field)) + return "field: string expected"; + if (message.indexConfigDeltas != null && Object.hasOwnProperty.call(message, "indexConfigDeltas")) { + if (!Array.isArray(message.indexConfigDeltas)) + return "indexConfigDeltas: array expected"; + for (var i = 0; i < message.indexConfigDeltas.length; ++i) { + var error = $root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.verify(message.indexConfigDeltas[i], long + 1); + if (error) + return "indexConfigDeltas." + error; + } + } + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressDocuments, long + 1); + if (error) + return "progressDocuments." + error; + } + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressBytes, long + 1); + if (error) + return "progressBytes." + error; + } + if (message.ttlConfigDelta != null && Object.hasOwnProperty.call(message, "ttlConfigDelta")) { + var error = $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.verify(message.ttlConfigDelta, long + 1); + if (error) + return "ttlConfigDelta." + error; + } + return null; + }; + + /** + * Creates a FieldOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.FieldOperationMetadata} FieldOperationMetadata + */ + FieldOperationMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.FieldOperationMetadata) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.FieldOperationMetadata(); + if (object.startTime != null) { + if (!$util.isObject(object.startTime)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime, long + 1); + } + if (object.endTime != null) { + if (!$util.isObject(object.endTime)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime, long + 1); + } + if (object.field != null) + message.field = String(object.field); + if (object.indexConfigDeltas) { + if (!Array.isArray(object.indexConfigDeltas)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.indexConfigDeltas: array expected"); + message.indexConfigDeltas = []; + for (var i = 0; i < object.indexConfigDeltas.length; ++i) { + if (!$util.isObject(object.indexConfigDeltas[i])) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.indexConfigDeltas: object expected"); + message.indexConfigDeltas[i] = $root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.fromObject(object.indexConfigDeltas[i], long + 1); + } + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "INITIALIZING": + case 1: + message.state = 1; + break; + case "PROCESSING": + case 2: + message.state = 2; + break; + case "CANCELLING": + case 3: + message.state = 3; + break; + case "FINALIZING": + case 4: + message.state = 4; + break; + case "SUCCESSFUL": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + case "CANCELLED": + case 7: + message.state = 7; + break; + } + if (object.progressDocuments != null) { + if (!$util.isObject(object.progressDocuments)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.progressDocuments: object expected"); + message.progressDocuments = $root.google.firestore.admin.v1.Progress.fromObject(object.progressDocuments, long + 1); + } + if (object.progressBytes != null) { + if (!$util.isObject(object.progressBytes)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.progressBytes: object expected"); + message.progressBytes = $root.google.firestore.admin.v1.Progress.fromObject(object.progressBytes, long + 1); + } + if (object.ttlConfigDelta != null) { + if (!$util.isObject(object.ttlConfigDelta)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.ttlConfigDelta: object expected"); + message.ttlConfigDelta = $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.fromObject(object.ttlConfigDelta, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a FieldOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @static + * @param {google.firestore.admin.v1.FieldOperationMetadata} message FieldOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOperationMetadata.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.indexConfigDeltas = []; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.field = ""; + object.state = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + object.progressDocuments = null; + object.progressBytes = null; + object.ttlConfigDelta = null; + } + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options, q + 1); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options, q + 1); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + object.field = message.field; + if (message.indexConfigDeltas && message.indexConfigDeltas.length) { + object.indexConfigDeltas = []; + for (var j = 0; j < message.indexConfigDeltas.length; ++j) + object.indexConfigDeltas[j] = $root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.toObject(message.indexConfigDeltas[j], options, q + 1); + } + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + object.state = options.enums === String ? $root.google.firestore.admin.v1.OperationState[message.state] === undefined ? message.state : $root.google.firestore.admin.v1.OperationState[message.state] : message.state; + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + object.progressDocuments = $root.google.firestore.admin.v1.Progress.toObject(message.progressDocuments, options, q + 1); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + object.progressBytes = $root.google.firestore.admin.v1.Progress.toObject(message.progressBytes, options, q + 1); + if (message.ttlConfigDelta != null && Object.hasOwnProperty.call(message, "ttlConfigDelta")) + object.ttlConfigDelta = $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.toObject(message.ttlConfigDelta, options, q + 1); + return object; + }; + + /** + * Converts this FieldOperationMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + FieldOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldOperationMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.FieldOperationMetadata"; + }; + + FieldOperationMetadata.IndexConfigDelta = (function() { + + /** + * Properties of an IndexConfigDelta. + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @interface IIndexConfigDelta + * @property {google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType|null} [changeType] IndexConfigDelta changeType + * @property {google.firestore.admin.v1.IIndex|null} [index] IndexConfigDelta index + */ + + /** + * Constructs a new IndexConfigDelta. + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @classdesc Represents an IndexConfigDelta. + * @implements IIndexConfigDelta + * @constructor + * @param {google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta=} [properties] Properties to set + */ + function IndexConfigDelta(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * IndexConfigDelta changeType. + * @member {google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType} changeType + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @instance + */ + IndexConfigDelta.prototype.changeType = 0; + + /** + * IndexConfigDelta index. + * @member {google.firestore.admin.v1.IIndex|null|undefined} index + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @instance + */ + IndexConfigDelta.prototype.index = null; + + /** + * Creates a new IndexConfigDelta instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @static + * @param {google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta=} [properties] Properties to set + * @returns {google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta} IndexConfigDelta instance + */ + IndexConfigDelta.create = function create(properties) { + return new IndexConfigDelta(properties); + }; + + /** + * Encodes the specified IndexConfigDelta message. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @static + * @param {google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta} message IndexConfigDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexConfigDelta.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.changeType != null && Object.hasOwnProperty.call(message, "changeType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.changeType); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + $root.google.firestore.admin.v1.Index.encode(message.index, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified IndexConfigDelta message, length delimited. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @static + * @param {google.firestore.admin.v1.FieldOperationMetadata.IIndexConfigDelta} message IndexConfigDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexConfigDelta.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an IndexConfigDelta message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta} IndexConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexConfigDelta.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.changeType = reader.int32(); + break; + } + case 2: { + message.index = $root.google.firestore.admin.v1.Index.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an IndexConfigDelta message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta} IndexConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexConfigDelta.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IndexConfigDelta message. + * @function verify + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IndexConfigDelta.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.changeType != null && Object.hasOwnProperty.call(message, "changeType")) + switch (message.changeType) { + default: + return "changeType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.index != null && Object.hasOwnProperty.call(message, "index")) { + var error = $root.google.firestore.admin.v1.Index.verify(message.index, long + 1); + if (error) + return "index." + error; + } + return null; + }; + + /** + * Creates an IndexConfigDelta message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta} IndexConfigDelta + */ + IndexConfigDelta.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta(); + switch (object.changeType) { + default: + if (typeof object.changeType === "number") { + message.changeType = object.changeType; + break; + } + break; + case "CHANGE_TYPE_UNSPECIFIED": + case 0: + message.changeType = 0; + break; + case "ADD": + case 1: + message.changeType = 1; + break; + case "REMOVE": + case 2: + message.changeType = 2; + break; + } + if (object.index != null) { + if (!$util.isObject(object.index)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.index: object expected"); + message.index = $root.google.firestore.admin.v1.Index.fromObject(object.index, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an IndexConfigDelta message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @static + * @param {google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta} message IndexConfigDelta + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IndexConfigDelta.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.changeType = options.enums === String ? "CHANGE_TYPE_UNSPECIFIED" : 0; + object.index = null; + } + if (message.changeType != null && Object.hasOwnProperty.call(message, "changeType")) + object.changeType = options.enums === String ? $root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType[message.changeType] === undefined ? message.changeType : $root.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType[message.changeType] : message.changeType; + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + object.index = $root.google.firestore.admin.v1.Index.toObject(message.index, options, q + 1); + return object; + }; + + /** + * Converts this IndexConfigDelta to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @instance + * @returns {Object.} JSON object + */ + IndexConfigDelta.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IndexConfigDelta + * @function getTypeUrl + * @memberof google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IndexConfigDelta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta"; + }; + + /** + * ChangeType enum. + * @name google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType + * @enum {number} + * @property {number} CHANGE_TYPE_UNSPECIFIED=0 CHANGE_TYPE_UNSPECIFIED value + * @property {number} ADD=1 ADD value + * @property {number} REMOVE=2 REMOVE value + */ + IndexConfigDelta.ChangeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CHANGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADD"] = 1; + values[valuesById[2] = "REMOVE"] = 2; + return values; + })(); + + return IndexConfigDelta; + })(); + + FieldOperationMetadata.TtlConfigDelta = (function() { + + /** + * Properties of a TtlConfigDelta. + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @interface ITtlConfigDelta + * @property {google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType|null} [changeType] TtlConfigDelta changeType + * @property {google.protobuf.IDuration|null} [expirationOffset] TtlConfigDelta expirationOffset + */ + + /** + * Constructs a new TtlConfigDelta. + * @memberof google.firestore.admin.v1.FieldOperationMetadata + * @classdesc Represents a TtlConfigDelta. + * @implements ITtlConfigDelta + * @constructor + * @param {google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta=} [properties] Properties to set + */ + function TtlConfigDelta(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * TtlConfigDelta changeType. + * @member {google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType} changeType + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @instance + */ + TtlConfigDelta.prototype.changeType = 0; + + /** + * TtlConfigDelta expirationOffset. + * @member {google.protobuf.IDuration|null|undefined} expirationOffset + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @instance + */ + TtlConfigDelta.prototype.expirationOffset = null; + + /** + * Creates a new TtlConfigDelta instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @static + * @param {google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta=} [properties] Properties to set + * @returns {google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta} TtlConfigDelta instance + */ + TtlConfigDelta.create = function create(properties) { + return new TtlConfigDelta(properties); + }; + + /** + * Encodes the specified TtlConfigDelta message. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @static + * @param {google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta} message TtlConfigDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TtlConfigDelta.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.changeType != null && Object.hasOwnProperty.call(message, "changeType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.changeType); + if (message.expirationOffset != null && Object.hasOwnProperty.call(message, "expirationOffset")) + $root.google.protobuf.Duration.encode(message.expirationOffset, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified TtlConfigDelta message, length delimited. Does not implicitly {@link google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @static + * @param {google.firestore.admin.v1.FieldOperationMetadata.ITtlConfigDelta} message TtlConfigDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TtlConfigDelta.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a TtlConfigDelta message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta} TtlConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TtlConfigDelta.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.changeType = reader.int32(); + break; + } + case 3: { + message.expirationOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a TtlConfigDelta message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta} TtlConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TtlConfigDelta.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TtlConfigDelta message. + * @function verify + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TtlConfigDelta.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.changeType != null && Object.hasOwnProperty.call(message, "changeType")) + switch (message.changeType) { + default: + return "changeType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.expirationOffset != null && Object.hasOwnProperty.call(message, "expirationOffset")) { + var error = $root.google.protobuf.Duration.verify(message.expirationOffset, long + 1); + if (error) + return "expirationOffset." + error; + } + return null; + }; + + /** + * Creates a TtlConfigDelta message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta} TtlConfigDelta + */ + TtlConfigDelta.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta(); + switch (object.changeType) { + default: + if (typeof object.changeType === "number") { + message.changeType = object.changeType; + break; + } + break; + case "CHANGE_TYPE_UNSPECIFIED": + case 0: + message.changeType = 0; + break; + case "ADD": + case 1: + message.changeType = 1; + break; + case "REMOVE": + case 2: + message.changeType = 2; + break; + } + if (object.expirationOffset != null) { + if (!$util.isObject(object.expirationOffset)) + throw TypeError(".google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.expirationOffset: object expected"); + message.expirationOffset = $root.google.protobuf.Duration.fromObject(object.expirationOffset, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a TtlConfigDelta message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @static + * @param {google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta} message TtlConfigDelta + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TtlConfigDelta.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.changeType = options.enums === String ? "CHANGE_TYPE_UNSPECIFIED" : 0; + object.expirationOffset = null; + } + if (message.changeType != null && Object.hasOwnProperty.call(message, "changeType")) + object.changeType = options.enums === String ? $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType[message.changeType] === undefined ? message.changeType : $root.google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType[message.changeType] : message.changeType; + if (message.expirationOffset != null && Object.hasOwnProperty.call(message, "expirationOffset")) + object.expirationOffset = $root.google.protobuf.Duration.toObject(message.expirationOffset, options, q + 1); + return object; + }; + + /** + * Converts this TtlConfigDelta to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @instance + * @returns {Object.} JSON object + */ + TtlConfigDelta.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TtlConfigDelta + * @function getTypeUrl + * @memberof google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TtlConfigDelta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta"; + }; + + /** + * ChangeType enum. + * @name google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType + * @enum {number} + * @property {number} CHANGE_TYPE_UNSPECIFIED=0 CHANGE_TYPE_UNSPECIFIED value + * @property {number} ADD=1 ADD value + * @property {number} REMOVE=2 REMOVE value + */ + TtlConfigDelta.ChangeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CHANGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADD"] = 1; + values[valuesById[2] = "REMOVE"] = 2; + return values; + })(); + + return TtlConfigDelta; + })(); + + return FieldOperationMetadata; + })(); + + v1.ExportDocumentsMetadata = (function() { + + /** + * Properties of an ExportDocumentsMetadata. + * @memberof google.firestore.admin.v1 + * @interface IExportDocumentsMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] ExportDocumentsMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] ExportDocumentsMetadata endTime + * @property {google.firestore.admin.v1.OperationState|null} [operationState] ExportDocumentsMetadata operationState + * @property {google.firestore.admin.v1.IProgress|null} [progressDocuments] ExportDocumentsMetadata progressDocuments + * @property {google.firestore.admin.v1.IProgress|null} [progressBytes] ExportDocumentsMetadata progressBytes + * @property {Array.|null} [collectionIds] ExportDocumentsMetadata collectionIds + * @property {string|null} [outputUriPrefix] ExportDocumentsMetadata outputUriPrefix + * @property {Array.|null} [namespaceIds] ExportDocumentsMetadata namespaceIds + * @property {google.protobuf.ITimestamp|null} [snapshotTime] ExportDocumentsMetadata snapshotTime + */ + + /** + * Constructs a new ExportDocumentsMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an ExportDocumentsMetadata. + * @implements IExportDocumentsMetadata + * @constructor + * @param {google.firestore.admin.v1.IExportDocumentsMetadata=} [properties] Properties to set + */ + function ExportDocumentsMetadata(properties) { + this.collectionIds = []; + this.namespaceIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportDocumentsMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + */ + ExportDocumentsMetadata.prototype.startTime = null; + + /** + * ExportDocumentsMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + */ + ExportDocumentsMetadata.prototype.endTime = null; + + /** + * ExportDocumentsMetadata operationState. + * @member {google.firestore.admin.v1.OperationState} operationState + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + */ + ExportDocumentsMetadata.prototype.operationState = 0; + + /** + * ExportDocumentsMetadata progressDocuments. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressDocuments + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + */ + ExportDocumentsMetadata.prototype.progressDocuments = null; + + /** + * ExportDocumentsMetadata progressBytes. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressBytes + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + */ + ExportDocumentsMetadata.prototype.progressBytes = null; + + /** + * ExportDocumentsMetadata collectionIds. + * @member {Array.} collectionIds + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + */ + ExportDocumentsMetadata.prototype.collectionIds = $util.emptyArray; + + /** + * ExportDocumentsMetadata outputUriPrefix. + * @member {string} outputUriPrefix + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + */ + ExportDocumentsMetadata.prototype.outputUriPrefix = ""; + + /** + * ExportDocumentsMetadata namespaceIds. + * @member {Array.} namespaceIds + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + */ + ExportDocumentsMetadata.prototype.namespaceIds = $util.emptyArray; + + /** + * ExportDocumentsMetadata snapshotTime. + * @member {google.protobuf.ITimestamp|null|undefined} snapshotTime + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + */ + ExportDocumentsMetadata.prototype.snapshotTime = null; + + /** + * Creates a new ExportDocumentsMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.IExportDocumentsMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ExportDocumentsMetadata} ExportDocumentsMetadata instance + */ + ExportDocumentsMetadata.create = function create(properties) { + return new ExportDocumentsMetadata(properties); + }; + + /** + * Encodes the specified ExportDocumentsMetadata message. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.IExportDocumentsMetadata} message ExportDocumentsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentsMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.operationState); + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + $root.google.firestore.admin.v1.Progress.encode(message.progressDocuments, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + $root.google.firestore.admin.v1.Progress.encode(message.progressBytes, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.collectionIds != null && message.collectionIds.length) + for (var i = 0; i < message.collectionIds.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.collectionIds[i]); + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.outputUriPrefix); + if (message.namespaceIds != null && message.namespaceIds.length) + for (var i = 0; i < message.namespaceIds.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.namespaceIds[i]); + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + $root.google.protobuf.Timestamp.encode(message.snapshotTime, writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportDocumentsMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.IExportDocumentsMetadata} message ExportDocumentsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExportDocumentsMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ExportDocumentsMetadata} ExportDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentsMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ExportDocumentsMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.operationState = reader.int32(); + break; + } + case 4: { + message.progressDocuments = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.progressBytes = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + if (!(message.collectionIds && message.collectionIds.length)) + message.collectionIds = []; + message.collectionIds.push(reader.string()); + break; + } + case 7: { + message.outputUriPrefix = reader.string(); + break; + } + case 8: { + if (!(message.namespaceIds && message.namespaceIds.length)) + message.namespaceIds = []; + message.namespaceIds.push(reader.string()); + break; + } + case 9: { + message.snapshotTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExportDocumentsMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ExportDocumentsMetadata} ExportDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentsMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportDocumentsMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportDocumentsMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime, long + 1); + if (error) + return "startTime." + error; + } + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime, long + 1); + if (error) + return "endTime." + error; + } + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + switch (message.operationState) { + default: + return "operationState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressDocuments, long + 1); + if (error) + return "progressDocuments." + error; + } + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressBytes, long + 1); + if (error) + return "progressBytes." + error; + } + if (message.collectionIds != null && Object.hasOwnProperty.call(message, "collectionIds")) { + if (!Array.isArray(message.collectionIds)) + return "collectionIds: array expected"; + for (var i = 0; i < message.collectionIds.length; ++i) + if (!$util.isString(message.collectionIds[i])) + return "collectionIds: string[] expected"; + } + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + if (!$util.isString(message.outputUriPrefix)) + return "outputUriPrefix: string expected"; + if (message.namespaceIds != null && Object.hasOwnProperty.call(message, "namespaceIds")) { + if (!Array.isArray(message.namespaceIds)) + return "namespaceIds: array expected"; + for (var i = 0; i < message.namespaceIds.length; ++i) + if (!$util.isString(message.namespaceIds[i])) + return "namespaceIds: string[] expected"; + } + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.snapshotTime, long + 1); + if (error) + return "snapshotTime." + error; + } + return null; + }; + + /** + * Creates an ExportDocumentsMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ExportDocumentsMetadata} ExportDocumentsMetadata + */ + ExportDocumentsMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ExportDocumentsMetadata) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsMetadata: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ExportDocumentsMetadata(); + if (object.startTime != null) { + if (!$util.isObject(object.startTime)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime, long + 1); + } + if (object.endTime != null) { + if (!$util.isObject(object.endTime)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime, long + 1); + } + switch (object.operationState) { + default: + if (typeof object.operationState === "number") { + message.operationState = object.operationState; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.operationState = 0; + break; + case "INITIALIZING": + case 1: + message.operationState = 1; + break; + case "PROCESSING": + case 2: + message.operationState = 2; + break; + case "CANCELLING": + case 3: + message.operationState = 3; + break; + case "FINALIZING": + case 4: + message.operationState = 4; + break; + case "SUCCESSFUL": + case 5: + message.operationState = 5; + break; + case "FAILED": + case 6: + message.operationState = 6; + break; + case "CANCELLED": + case 7: + message.operationState = 7; + break; + } + if (object.progressDocuments != null) { + if (!$util.isObject(object.progressDocuments)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsMetadata.progressDocuments: object expected"); + message.progressDocuments = $root.google.firestore.admin.v1.Progress.fromObject(object.progressDocuments, long + 1); + } + if (object.progressBytes != null) { + if (!$util.isObject(object.progressBytes)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsMetadata.progressBytes: object expected"); + message.progressBytes = $root.google.firestore.admin.v1.Progress.fromObject(object.progressBytes, long + 1); + } + if (object.collectionIds) { + if (!Array.isArray(object.collectionIds)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsMetadata.collectionIds: array expected"); + message.collectionIds = []; + for (var i = 0; i < object.collectionIds.length; ++i) + message.collectionIds[i] = String(object.collectionIds[i]); + } + if (object.outputUriPrefix != null) + message.outputUriPrefix = String(object.outputUriPrefix); + if (object.namespaceIds) { + if (!Array.isArray(object.namespaceIds)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsMetadata.namespaceIds: array expected"); + message.namespaceIds = []; + for (var i = 0; i < object.namespaceIds.length; ++i) + message.namespaceIds[i] = String(object.namespaceIds[i]); + } + if (object.snapshotTime != null) { + if (!$util.isObject(object.snapshotTime)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsMetadata.snapshotTime: object expected"); + message.snapshotTime = $root.google.protobuf.Timestamp.fromObject(object.snapshotTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an ExportDocumentsMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.ExportDocumentsMetadata} message ExportDocumentsMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportDocumentsMetadata.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.collectionIds = []; + object.namespaceIds = []; + } + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.operationState = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + object.progressDocuments = null; + object.progressBytes = null; + object.outputUriPrefix = ""; + object.snapshotTime = null; + } + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options, q + 1); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options, q + 1); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + object.operationState = options.enums === String ? $root.google.firestore.admin.v1.OperationState[message.operationState] === undefined ? message.operationState : $root.google.firestore.admin.v1.OperationState[message.operationState] : message.operationState; + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + object.progressDocuments = $root.google.firestore.admin.v1.Progress.toObject(message.progressDocuments, options, q + 1); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + object.progressBytes = $root.google.firestore.admin.v1.Progress.toObject(message.progressBytes, options, q + 1); + if (message.collectionIds && message.collectionIds.length) { + object.collectionIds = []; + for (var j = 0; j < message.collectionIds.length; ++j) + object.collectionIds[j] = message.collectionIds[j]; + } + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + object.outputUriPrefix = message.outputUriPrefix; + if (message.namespaceIds && message.namespaceIds.length) { + object.namespaceIds = []; + for (var j = 0; j < message.namespaceIds.length; ++j) + object.namespaceIds[j] = message.namespaceIds[j]; + } + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + object.snapshotTime = $root.google.protobuf.Timestamp.toObject(message.snapshotTime, options, q + 1); + return object; + }; + + /** + * Converts this ExportDocumentsMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @instance + * @returns {Object.} JSON object + */ + ExportDocumentsMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportDocumentsMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ExportDocumentsMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportDocumentsMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ExportDocumentsMetadata"; + }; + + return ExportDocumentsMetadata; + })(); + + v1.ImportDocumentsMetadata = (function() { + + /** + * Properties of an ImportDocumentsMetadata. + * @memberof google.firestore.admin.v1 + * @interface IImportDocumentsMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] ImportDocumentsMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] ImportDocumentsMetadata endTime + * @property {google.firestore.admin.v1.OperationState|null} [operationState] ImportDocumentsMetadata operationState + * @property {google.firestore.admin.v1.IProgress|null} [progressDocuments] ImportDocumentsMetadata progressDocuments + * @property {google.firestore.admin.v1.IProgress|null} [progressBytes] ImportDocumentsMetadata progressBytes + * @property {Array.|null} [collectionIds] ImportDocumentsMetadata collectionIds + * @property {string|null} [inputUriPrefix] ImportDocumentsMetadata inputUriPrefix + * @property {Array.|null} [namespaceIds] ImportDocumentsMetadata namespaceIds + */ + + /** + * Constructs a new ImportDocumentsMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an ImportDocumentsMetadata. + * @implements IImportDocumentsMetadata + * @constructor + * @param {google.firestore.admin.v1.IImportDocumentsMetadata=} [properties] Properties to set + */ + function ImportDocumentsMetadata(properties) { + this.collectionIds = []; + this.namespaceIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportDocumentsMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @instance + */ + ImportDocumentsMetadata.prototype.startTime = null; + + /** + * ImportDocumentsMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @instance + */ + ImportDocumentsMetadata.prototype.endTime = null; + + /** + * ImportDocumentsMetadata operationState. + * @member {google.firestore.admin.v1.OperationState} operationState + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @instance + */ + ImportDocumentsMetadata.prototype.operationState = 0; + + /** + * ImportDocumentsMetadata progressDocuments. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressDocuments + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @instance + */ + ImportDocumentsMetadata.prototype.progressDocuments = null; + + /** + * ImportDocumentsMetadata progressBytes. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressBytes + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @instance + */ + ImportDocumentsMetadata.prototype.progressBytes = null; + + /** + * ImportDocumentsMetadata collectionIds. + * @member {Array.} collectionIds + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @instance + */ + ImportDocumentsMetadata.prototype.collectionIds = $util.emptyArray; + + /** + * ImportDocumentsMetadata inputUriPrefix. + * @member {string} inputUriPrefix + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @instance + */ + ImportDocumentsMetadata.prototype.inputUriPrefix = ""; + + /** + * ImportDocumentsMetadata namespaceIds. + * @member {Array.} namespaceIds + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @instance + */ + ImportDocumentsMetadata.prototype.namespaceIds = $util.emptyArray; + + /** + * Creates a new ImportDocumentsMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.IImportDocumentsMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ImportDocumentsMetadata} ImportDocumentsMetadata instance + */ + ImportDocumentsMetadata.create = function create(properties) { + return new ImportDocumentsMetadata(properties); + }; + + /** + * Encodes the specified ImportDocumentsMetadata message. Does not implicitly {@link google.firestore.admin.v1.ImportDocumentsMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.IImportDocumentsMetadata} message ImportDocumentsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.operationState); + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + $root.google.firestore.admin.v1.Progress.encode(message.progressDocuments, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + $root.google.firestore.admin.v1.Progress.encode(message.progressBytes, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.collectionIds != null && message.collectionIds.length) + for (var i = 0; i < message.collectionIds.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.collectionIds[i]); + if (message.inputUriPrefix != null && Object.hasOwnProperty.call(message, "inputUriPrefix")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.inputUriPrefix); + if (message.namespaceIds != null && message.namespaceIds.length) + for (var i = 0; i < message.namespaceIds.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.namespaceIds[i]); + return writer; + }; + + /** + * Encodes the specified ImportDocumentsMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ImportDocumentsMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.IImportDocumentsMetadata} message ImportDocumentsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ImportDocumentsMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ImportDocumentsMetadata} ImportDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ImportDocumentsMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.operationState = reader.int32(); + break; + } + case 4: { + message.progressDocuments = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.progressBytes = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + if (!(message.collectionIds && message.collectionIds.length)) + message.collectionIds = []; + message.collectionIds.push(reader.string()); + break; + } + case 7: { + message.inputUriPrefix = reader.string(); + break; + } + case 8: { + if (!(message.namespaceIds && message.namespaceIds.length)) + message.namespaceIds = []; + message.namespaceIds.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ImportDocumentsMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ImportDocumentsMetadata} ImportDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportDocumentsMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportDocumentsMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime, long + 1); + if (error) + return "startTime." + error; + } + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime, long + 1); + if (error) + return "endTime." + error; + } + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + switch (message.operationState) { + default: + return "operationState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressDocuments, long + 1); + if (error) + return "progressDocuments." + error; + } + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressBytes, long + 1); + if (error) + return "progressBytes." + error; + } + if (message.collectionIds != null && Object.hasOwnProperty.call(message, "collectionIds")) { + if (!Array.isArray(message.collectionIds)) + return "collectionIds: array expected"; + for (var i = 0; i < message.collectionIds.length; ++i) + if (!$util.isString(message.collectionIds[i])) + return "collectionIds: string[] expected"; + } + if (message.inputUriPrefix != null && Object.hasOwnProperty.call(message, "inputUriPrefix")) + if (!$util.isString(message.inputUriPrefix)) + return "inputUriPrefix: string expected"; + if (message.namespaceIds != null && Object.hasOwnProperty.call(message, "namespaceIds")) { + if (!Array.isArray(message.namespaceIds)) + return "namespaceIds: array expected"; + for (var i = 0; i < message.namespaceIds.length; ++i) + if (!$util.isString(message.namespaceIds[i])) + return "namespaceIds: string[] expected"; + } + return null; + }; + + /** + * Creates an ImportDocumentsMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ImportDocumentsMetadata} ImportDocumentsMetadata + */ + ImportDocumentsMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ImportDocumentsMetadata) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsMetadata: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ImportDocumentsMetadata(); + if (object.startTime != null) { + if (!$util.isObject(object.startTime)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime, long + 1); + } + if (object.endTime != null) { + if (!$util.isObject(object.endTime)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime, long + 1); + } + switch (object.operationState) { + default: + if (typeof object.operationState === "number") { + message.operationState = object.operationState; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.operationState = 0; + break; + case "INITIALIZING": + case 1: + message.operationState = 1; + break; + case "PROCESSING": + case 2: + message.operationState = 2; + break; + case "CANCELLING": + case 3: + message.operationState = 3; + break; + case "FINALIZING": + case 4: + message.operationState = 4; + break; + case "SUCCESSFUL": + case 5: + message.operationState = 5; + break; + case "FAILED": + case 6: + message.operationState = 6; + break; + case "CANCELLED": + case 7: + message.operationState = 7; + break; + } + if (object.progressDocuments != null) { + if (!$util.isObject(object.progressDocuments)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsMetadata.progressDocuments: object expected"); + message.progressDocuments = $root.google.firestore.admin.v1.Progress.fromObject(object.progressDocuments, long + 1); + } + if (object.progressBytes != null) { + if (!$util.isObject(object.progressBytes)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsMetadata.progressBytes: object expected"); + message.progressBytes = $root.google.firestore.admin.v1.Progress.fromObject(object.progressBytes, long + 1); + } + if (object.collectionIds) { + if (!Array.isArray(object.collectionIds)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsMetadata.collectionIds: array expected"); + message.collectionIds = []; + for (var i = 0; i < object.collectionIds.length; ++i) + message.collectionIds[i] = String(object.collectionIds[i]); + } + if (object.inputUriPrefix != null) + message.inputUriPrefix = String(object.inputUriPrefix); + if (object.namespaceIds) { + if (!Array.isArray(object.namespaceIds)) + throw TypeError(".google.firestore.admin.v1.ImportDocumentsMetadata.namespaceIds: array expected"); + message.namespaceIds = []; + for (var i = 0; i < object.namespaceIds.length; ++i) + message.namespaceIds[i] = String(object.namespaceIds[i]); + } + return message; + }; + + /** + * Creates a plain object from an ImportDocumentsMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.ImportDocumentsMetadata} message ImportDocumentsMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportDocumentsMetadata.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.collectionIds = []; + object.namespaceIds = []; + } + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.operationState = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + object.progressDocuments = null; + object.progressBytes = null; + object.inputUriPrefix = ""; + } + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options, q + 1); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options, q + 1); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + object.operationState = options.enums === String ? $root.google.firestore.admin.v1.OperationState[message.operationState] === undefined ? message.operationState : $root.google.firestore.admin.v1.OperationState[message.operationState] : message.operationState; + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + object.progressDocuments = $root.google.firestore.admin.v1.Progress.toObject(message.progressDocuments, options, q + 1); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + object.progressBytes = $root.google.firestore.admin.v1.Progress.toObject(message.progressBytes, options, q + 1); + if (message.collectionIds && message.collectionIds.length) { + object.collectionIds = []; + for (var j = 0; j < message.collectionIds.length; ++j) + object.collectionIds[j] = message.collectionIds[j]; + } + if (message.inputUriPrefix != null && Object.hasOwnProperty.call(message, "inputUriPrefix")) + object.inputUriPrefix = message.inputUriPrefix; + if (message.namespaceIds && message.namespaceIds.length) { + object.namespaceIds = []; + for (var j = 0; j < message.namespaceIds.length; ++j) + object.namespaceIds[j] = message.namespaceIds[j]; + } + return object; + }; + + /** + * Converts this ImportDocumentsMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @instance + * @returns {Object.} JSON object + */ + ImportDocumentsMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportDocumentsMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ImportDocumentsMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportDocumentsMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ImportDocumentsMetadata"; + }; + + return ImportDocumentsMetadata; + })(); + + v1.BulkDeleteDocumentsMetadata = (function() { + + /** + * Properties of a BulkDeleteDocumentsMetadata. + * @memberof google.firestore.admin.v1 + * @interface IBulkDeleteDocumentsMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] BulkDeleteDocumentsMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] BulkDeleteDocumentsMetadata endTime + * @property {google.firestore.admin.v1.OperationState|null} [operationState] BulkDeleteDocumentsMetadata operationState + * @property {google.firestore.admin.v1.IProgress|null} [progressDocuments] BulkDeleteDocumentsMetadata progressDocuments + * @property {google.firestore.admin.v1.IProgress|null} [progressBytes] BulkDeleteDocumentsMetadata progressBytes + * @property {Array.|null} [collectionIds] BulkDeleteDocumentsMetadata collectionIds + * @property {Array.|null} [namespaceIds] BulkDeleteDocumentsMetadata namespaceIds + * @property {google.protobuf.ITimestamp|null} [snapshotTime] BulkDeleteDocumentsMetadata snapshotTime + */ + + /** + * Constructs a new BulkDeleteDocumentsMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a BulkDeleteDocumentsMetadata. + * @implements IBulkDeleteDocumentsMetadata + * @constructor + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsMetadata=} [properties] Properties to set + */ + function BulkDeleteDocumentsMetadata(properties) { + this.collectionIds = []; + this.namespaceIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BulkDeleteDocumentsMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @instance + */ + BulkDeleteDocumentsMetadata.prototype.startTime = null; + + /** + * BulkDeleteDocumentsMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @instance + */ + BulkDeleteDocumentsMetadata.prototype.endTime = null; + + /** + * BulkDeleteDocumentsMetadata operationState. + * @member {google.firestore.admin.v1.OperationState} operationState + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @instance + */ + BulkDeleteDocumentsMetadata.prototype.operationState = 0; + + /** + * BulkDeleteDocumentsMetadata progressDocuments. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressDocuments + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @instance + */ + BulkDeleteDocumentsMetadata.prototype.progressDocuments = null; + + /** + * BulkDeleteDocumentsMetadata progressBytes. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressBytes + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @instance + */ + BulkDeleteDocumentsMetadata.prototype.progressBytes = null; + + /** + * BulkDeleteDocumentsMetadata collectionIds. + * @member {Array.} collectionIds + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @instance + */ + BulkDeleteDocumentsMetadata.prototype.collectionIds = $util.emptyArray; + + /** + * BulkDeleteDocumentsMetadata namespaceIds. + * @member {Array.} namespaceIds + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @instance + */ + BulkDeleteDocumentsMetadata.prototype.namespaceIds = $util.emptyArray; + + /** + * BulkDeleteDocumentsMetadata snapshotTime. + * @member {google.protobuf.ITimestamp|null|undefined} snapshotTime + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @instance + */ + BulkDeleteDocumentsMetadata.prototype.snapshotTime = null; + + /** + * Creates a new BulkDeleteDocumentsMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsMetadata} BulkDeleteDocumentsMetadata instance + */ + BulkDeleteDocumentsMetadata.create = function create(properties) { + return new BulkDeleteDocumentsMetadata(properties); + }; + + /** + * Encodes the specified BulkDeleteDocumentsMetadata message. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsMetadata} message BulkDeleteDocumentsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BulkDeleteDocumentsMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.operationState); + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + $root.google.firestore.admin.v1.Progress.encode(message.progressDocuments, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + $root.google.firestore.admin.v1.Progress.encode(message.progressBytes, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.collectionIds != null && message.collectionIds.length) + for (var i = 0; i < message.collectionIds.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.collectionIds[i]); + if (message.namespaceIds != null && message.namespaceIds.length) + for (var i = 0; i < message.namespaceIds.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.namespaceIds[i]); + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + $root.google.protobuf.Timestamp.encode(message.snapshotTime, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BulkDeleteDocumentsMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.BulkDeleteDocumentsMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.IBulkDeleteDocumentsMetadata} message BulkDeleteDocumentsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BulkDeleteDocumentsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BulkDeleteDocumentsMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsMetadata} BulkDeleteDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BulkDeleteDocumentsMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.BulkDeleteDocumentsMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.operationState = reader.int32(); + break; + } + case 4: { + message.progressDocuments = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.progressBytes = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + if (!(message.collectionIds && message.collectionIds.length)) + message.collectionIds = []; + message.collectionIds.push(reader.string()); + break; + } + case 7: { + if (!(message.namespaceIds && message.namespaceIds.length)) + message.namespaceIds = []; + message.namespaceIds.push(reader.string()); + break; + } + case 8: { + message.snapshotTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BulkDeleteDocumentsMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsMetadata} BulkDeleteDocumentsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BulkDeleteDocumentsMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BulkDeleteDocumentsMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BulkDeleteDocumentsMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime, long + 1); + if (error) + return "startTime." + error; + } + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime, long + 1); + if (error) + return "endTime." + error; + } + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + switch (message.operationState) { + default: + return "operationState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressDocuments, long + 1); + if (error) + return "progressDocuments." + error; + } + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressBytes, long + 1); + if (error) + return "progressBytes." + error; + } + if (message.collectionIds != null && Object.hasOwnProperty.call(message, "collectionIds")) { + if (!Array.isArray(message.collectionIds)) + return "collectionIds: array expected"; + for (var i = 0; i < message.collectionIds.length; ++i) + if (!$util.isString(message.collectionIds[i])) + return "collectionIds: string[] expected"; + } + if (message.namespaceIds != null && Object.hasOwnProperty.call(message, "namespaceIds")) { + if (!Array.isArray(message.namespaceIds)) + return "namespaceIds: array expected"; + for (var i = 0; i < message.namespaceIds.length; ++i) + if (!$util.isString(message.namespaceIds[i])) + return "namespaceIds: string[] expected"; + } + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.snapshotTime, long + 1); + if (error) + return "snapshotTime." + error; + } + return null; + }; + + /** + * Creates a BulkDeleteDocumentsMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.BulkDeleteDocumentsMetadata} BulkDeleteDocumentsMetadata + */ + BulkDeleteDocumentsMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.BulkDeleteDocumentsMetadata) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsMetadata: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.BulkDeleteDocumentsMetadata(); + if (object.startTime != null) { + if (!$util.isObject(object.startTime)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime, long + 1); + } + if (object.endTime != null) { + if (!$util.isObject(object.endTime)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime, long + 1); + } + switch (object.operationState) { + default: + if (typeof object.operationState === "number") { + message.operationState = object.operationState; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.operationState = 0; + break; + case "INITIALIZING": + case 1: + message.operationState = 1; + break; + case "PROCESSING": + case 2: + message.operationState = 2; + break; + case "CANCELLING": + case 3: + message.operationState = 3; + break; + case "FINALIZING": + case 4: + message.operationState = 4; + break; + case "SUCCESSFUL": + case 5: + message.operationState = 5; + break; + case "FAILED": + case 6: + message.operationState = 6; + break; + case "CANCELLED": + case 7: + message.operationState = 7; + break; + } + if (object.progressDocuments != null) { + if (!$util.isObject(object.progressDocuments)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsMetadata.progressDocuments: object expected"); + message.progressDocuments = $root.google.firestore.admin.v1.Progress.fromObject(object.progressDocuments, long + 1); + } + if (object.progressBytes != null) { + if (!$util.isObject(object.progressBytes)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsMetadata.progressBytes: object expected"); + message.progressBytes = $root.google.firestore.admin.v1.Progress.fromObject(object.progressBytes, long + 1); + } + if (object.collectionIds) { + if (!Array.isArray(object.collectionIds)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsMetadata.collectionIds: array expected"); + message.collectionIds = []; + for (var i = 0; i < object.collectionIds.length; ++i) + message.collectionIds[i] = String(object.collectionIds[i]); + } + if (object.namespaceIds) { + if (!Array.isArray(object.namespaceIds)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsMetadata.namespaceIds: array expected"); + message.namespaceIds = []; + for (var i = 0; i < object.namespaceIds.length; ++i) + message.namespaceIds[i] = String(object.namespaceIds[i]); + } + if (object.snapshotTime != null) { + if (!$util.isObject(object.snapshotTime)) + throw TypeError(".google.firestore.admin.v1.BulkDeleteDocumentsMetadata.snapshotTime: object expected"); + message.snapshotTime = $root.google.protobuf.Timestamp.fromObject(object.snapshotTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a BulkDeleteDocumentsMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @static + * @param {google.firestore.admin.v1.BulkDeleteDocumentsMetadata} message BulkDeleteDocumentsMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BulkDeleteDocumentsMetadata.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.collectionIds = []; + object.namespaceIds = []; + } + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.operationState = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + object.progressDocuments = null; + object.progressBytes = null; + object.snapshotTime = null; + } + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options, q + 1); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options, q + 1); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + object.operationState = options.enums === String ? $root.google.firestore.admin.v1.OperationState[message.operationState] === undefined ? message.operationState : $root.google.firestore.admin.v1.OperationState[message.operationState] : message.operationState; + if (message.progressDocuments != null && Object.hasOwnProperty.call(message, "progressDocuments")) + object.progressDocuments = $root.google.firestore.admin.v1.Progress.toObject(message.progressDocuments, options, q + 1); + if (message.progressBytes != null && Object.hasOwnProperty.call(message, "progressBytes")) + object.progressBytes = $root.google.firestore.admin.v1.Progress.toObject(message.progressBytes, options, q + 1); + if (message.collectionIds && message.collectionIds.length) { + object.collectionIds = []; + for (var j = 0; j < message.collectionIds.length; ++j) + object.collectionIds[j] = message.collectionIds[j]; + } + if (message.namespaceIds && message.namespaceIds.length) { + object.namespaceIds = []; + for (var j = 0; j < message.namespaceIds.length; ++j) + object.namespaceIds[j] = message.namespaceIds[j]; + } + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + object.snapshotTime = $root.google.protobuf.Timestamp.toObject(message.snapshotTime, options, q + 1); + return object; + }; + + /** + * Converts this BulkDeleteDocumentsMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @instance + * @returns {Object.} JSON object + */ + BulkDeleteDocumentsMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BulkDeleteDocumentsMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.BulkDeleteDocumentsMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BulkDeleteDocumentsMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.BulkDeleteDocumentsMetadata"; + }; + + return BulkDeleteDocumentsMetadata; + })(); + + v1.ExportDocumentsResponse = (function() { + + /** + * Properties of an ExportDocumentsResponse. + * @memberof google.firestore.admin.v1 + * @interface IExportDocumentsResponse + * @property {string|null} [outputUriPrefix] ExportDocumentsResponse outputUriPrefix + */ + + /** + * Constructs a new ExportDocumentsResponse. + * @memberof google.firestore.admin.v1 + * @classdesc Represents an ExportDocumentsResponse. + * @implements IExportDocumentsResponse + * @constructor + * @param {google.firestore.admin.v1.IExportDocumentsResponse=} [properties] Properties to set + */ + function ExportDocumentsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportDocumentsResponse outputUriPrefix. + * @member {string} outputUriPrefix + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @instance + */ + ExportDocumentsResponse.prototype.outputUriPrefix = ""; + + /** + * Creates a new ExportDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @static + * @param {google.firestore.admin.v1.IExportDocumentsResponse=} [properties] Properties to set + * @returns {google.firestore.admin.v1.ExportDocumentsResponse} ExportDocumentsResponse instance + */ + ExportDocumentsResponse.create = function create(properties) { + return new ExportDocumentsResponse(properties); + }; + + /** + * Encodes the specified ExportDocumentsResponse message. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @static + * @param {google.firestore.admin.v1.IExportDocumentsResponse} message ExportDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.outputUriPrefix); + return writer; + }; + + /** + * Encodes the specified ExportDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.admin.v1.ExportDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @static + * @param {google.firestore.admin.v1.IExportDocumentsResponse} message ExportDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExportDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.ExportDocumentsResponse} ExportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.ExportDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.outputUriPrefix = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExportDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.ExportDocumentsResponse} ExportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportDocumentsResponse message. + * @function verify + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportDocumentsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + if (!$util.isString(message.outputUriPrefix)) + return "outputUriPrefix: string expected"; + return null; + }; + + /** + * Creates an ExportDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.ExportDocumentsResponse} ExportDocumentsResponse + */ + ExportDocumentsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.ExportDocumentsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.ExportDocumentsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.ExportDocumentsResponse(); + if (object.outputUriPrefix != null) + message.outputUriPrefix = String(object.outputUriPrefix); + return message; + }; + + /** + * Creates a plain object from an ExportDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @static + * @param {google.firestore.admin.v1.ExportDocumentsResponse} message ExportDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportDocumentsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.outputUriPrefix = ""; + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + object.outputUriPrefix = message.outputUriPrefix; + return object; + }; + + /** + * Converts this ExportDocumentsResponse to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + ExportDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportDocumentsResponse + * @function getTypeUrl + * @memberof google.firestore.admin.v1.ExportDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.ExportDocumentsResponse"; + }; + + return ExportDocumentsResponse; + })(); + + v1.RestoreDatabaseMetadata = (function() { + + /** + * Properties of a RestoreDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @interface IRestoreDatabaseMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] RestoreDatabaseMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] RestoreDatabaseMetadata endTime + * @property {google.firestore.admin.v1.OperationState|null} [operationState] RestoreDatabaseMetadata operationState + * @property {string|null} [database] RestoreDatabaseMetadata database + * @property {string|null} [backup] RestoreDatabaseMetadata backup + * @property {google.firestore.admin.v1.IProgress|null} [progressPercentage] RestoreDatabaseMetadata progressPercentage + */ + + /** + * Constructs a new RestoreDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a RestoreDatabaseMetadata. + * @implements IRestoreDatabaseMetadata + * @constructor + * @param {google.firestore.admin.v1.IRestoreDatabaseMetadata=} [properties] Properties to set + */ + function RestoreDatabaseMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RestoreDatabaseMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @instance + */ + RestoreDatabaseMetadata.prototype.startTime = null; + + /** + * RestoreDatabaseMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @instance + */ + RestoreDatabaseMetadata.prototype.endTime = null; + + /** + * RestoreDatabaseMetadata operationState. + * @member {google.firestore.admin.v1.OperationState} operationState + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @instance + */ + RestoreDatabaseMetadata.prototype.operationState = 0; + + /** + * RestoreDatabaseMetadata database. + * @member {string} database + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @instance + */ + RestoreDatabaseMetadata.prototype.database = ""; + + /** + * RestoreDatabaseMetadata backup. + * @member {string} backup + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @instance + */ + RestoreDatabaseMetadata.prototype.backup = ""; + + /** + * RestoreDatabaseMetadata progressPercentage. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressPercentage + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @instance + */ + RestoreDatabaseMetadata.prototype.progressPercentage = null; + + /** + * Creates a new RestoreDatabaseMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.IRestoreDatabaseMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.RestoreDatabaseMetadata} RestoreDatabaseMetadata instance + */ + RestoreDatabaseMetadata.create = function create(properties) { + return new RestoreDatabaseMetadata(properties); + }; + + /** + * Encodes the specified RestoreDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.RestoreDatabaseMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.IRestoreDatabaseMetadata} message RestoreDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreDatabaseMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.operationState); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.database); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.backup); + if (message.progressPercentage != null && Object.hasOwnProperty.call(message, "progressPercentage")) + $root.google.firestore.admin.v1.Progress.encode(message.progressPercentage, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified RestoreDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.RestoreDatabaseMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.IRestoreDatabaseMetadata} message RestoreDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreDatabaseMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RestoreDatabaseMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.RestoreDatabaseMetadata} RestoreDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreDatabaseMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.RestoreDatabaseMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.operationState = reader.int32(); + break; + } + case 4: { + message.database = reader.string(); + break; + } + case 5: { + message.backup = reader.string(); + break; + } + case 8: { + message.progressPercentage = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RestoreDatabaseMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.RestoreDatabaseMetadata} RestoreDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreDatabaseMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RestoreDatabaseMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RestoreDatabaseMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime, long + 1); + if (error) + return "startTime." + error; + } + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime, long + 1); + if (error) + return "endTime." + error; + } + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + switch (message.operationState) { + default: + return "operationState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + if (!$util.isString(message.backup)) + return "backup: string expected"; + if (message.progressPercentage != null && Object.hasOwnProperty.call(message, "progressPercentage")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressPercentage, long + 1); + if (error) + return "progressPercentage." + error; + } + return null; + }; + + /** + * Creates a RestoreDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.RestoreDatabaseMetadata} RestoreDatabaseMetadata + */ + RestoreDatabaseMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.RestoreDatabaseMetadata) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.RestoreDatabaseMetadata: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.RestoreDatabaseMetadata(); + if (object.startTime != null) { + if (!$util.isObject(object.startTime)) + throw TypeError(".google.firestore.admin.v1.RestoreDatabaseMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime, long + 1); + } + if (object.endTime != null) { + if (!$util.isObject(object.endTime)) + throw TypeError(".google.firestore.admin.v1.RestoreDatabaseMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime, long + 1); + } + switch (object.operationState) { + default: + if (typeof object.operationState === "number") { + message.operationState = object.operationState; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.operationState = 0; + break; + case "INITIALIZING": + case 1: + message.operationState = 1; + break; + case "PROCESSING": + case 2: + message.operationState = 2; + break; + case "CANCELLING": + case 3: + message.operationState = 3; + break; + case "FINALIZING": + case 4: + message.operationState = 4; + break; + case "SUCCESSFUL": + case 5: + message.operationState = 5; + break; + case "FAILED": + case 6: + message.operationState = 6; + break; + case "CANCELLED": + case 7: + message.operationState = 7; + break; + } + if (object.database != null) + message.database = String(object.database); + if (object.backup != null) + message.backup = String(object.backup); + if (object.progressPercentage != null) { + if (!$util.isObject(object.progressPercentage)) + throw TypeError(".google.firestore.admin.v1.RestoreDatabaseMetadata.progressPercentage: object expected"); + message.progressPercentage = $root.google.firestore.admin.v1.Progress.fromObject(object.progressPercentage, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a RestoreDatabaseMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.RestoreDatabaseMetadata} message RestoreDatabaseMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RestoreDatabaseMetadata.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.operationState = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + object.database = ""; + object.backup = ""; + object.progressPercentage = null; + } + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options, q + 1); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options, q + 1); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + object.operationState = options.enums === String ? $root.google.firestore.admin.v1.OperationState[message.operationState] === undefined ? message.operationState : $root.google.firestore.admin.v1.OperationState[message.operationState] : message.operationState; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + object.backup = message.backup; + if (message.progressPercentage != null && Object.hasOwnProperty.call(message, "progressPercentage")) + object.progressPercentage = $root.google.firestore.admin.v1.Progress.toObject(message.progressPercentage, options, q + 1); + return object; + }; + + /** + * Converts this RestoreDatabaseMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @instance + * @returns {Object.} JSON object + */ + RestoreDatabaseMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RestoreDatabaseMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.RestoreDatabaseMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RestoreDatabaseMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.RestoreDatabaseMetadata"; + }; + + return RestoreDatabaseMetadata; + })(); + + v1.CloneDatabaseMetadata = (function() { + + /** + * Properties of a CloneDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @interface ICloneDatabaseMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] CloneDatabaseMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] CloneDatabaseMetadata endTime + * @property {google.firestore.admin.v1.OperationState|null} [operationState] CloneDatabaseMetadata operationState + * @property {string|null} [database] CloneDatabaseMetadata database + * @property {google.firestore.admin.v1.IPitrSnapshot|null} [pitrSnapshot] CloneDatabaseMetadata pitrSnapshot + * @property {google.firestore.admin.v1.IProgress|null} [progressPercentage] CloneDatabaseMetadata progressPercentage + */ + + /** + * Constructs a new CloneDatabaseMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a CloneDatabaseMetadata. + * @implements ICloneDatabaseMetadata + * @constructor + * @param {google.firestore.admin.v1.ICloneDatabaseMetadata=} [properties] Properties to set + */ + function CloneDatabaseMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CloneDatabaseMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @instance + */ + CloneDatabaseMetadata.prototype.startTime = null; + + /** + * CloneDatabaseMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @instance + */ + CloneDatabaseMetadata.prototype.endTime = null; + + /** + * CloneDatabaseMetadata operationState. + * @member {google.firestore.admin.v1.OperationState} operationState + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @instance + */ + CloneDatabaseMetadata.prototype.operationState = 0; + + /** + * CloneDatabaseMetadata database. + * @member {string} database + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @instance + */ + CloneDatabaseMetadata.prototype.database = ""; + + /** + * CloneDatabaseMetadata pitrSnapshot. + * @member {google.firestore.admin.v1.IPitrSnapshot|null|undefined} pitrSnapshot + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @instance + */ + CloneDatabaseMetadata.prototype.pitrSnapshot = null; + + /** + * CloneDatabaseMetadata progressPercentage. + * @member {google.firestore.admin.v1.IProgress|null|undefined} progressPercentage + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @instance + */ + CloneDatabaseMetadata.prototype.progressPercentage = null; + + /** + * Creates a new CloneDatabaseMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.ICloneDatabaseMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.CloneDatabaseMetadata} CloneDatabaseMetadata instance + */ + CloneDatabaseMetadata.create = function create(properties) { + return new CloneDatabaseMetadata(properties); + }; + + /** + * Encodes the specified CloneDatabaseMetadata message. Does not implicitly {@link google.firestore.admin.v1.CloneDatabaseMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.ICloneDatabaseMetadata} message CloneDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloneDatabaseMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.operationState); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.database); + if (message.progressPercentage != null && Object.hasOwnProperty.call(message, "progressPercentage")) + $root.google.firestore.admin.v1.Progress.encode(message.progressPercentage, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.pitrSnapshot != null && Object.hasOwnProperty.call(message, "pitrSnapshot")) + $root.google.firestore.admin.v1.PitrSnapshot.encode(message.pitrSnapshot, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CloneDatabaseMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.CloneDatabaseMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.ICloneDatabaseMetadata} message CloneDatabaseMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloneDatabaseMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CloneDatabaseMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.CloneDatabaseMetadata} CloneDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloneDatabaseMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.CloneDatabaseMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.operationState = reader.int32(); + break; + } + case 4: { + message.database = reader.string(); + break; + } + case 7: { + message.pitrSnapshot = $root.google.firestore.admin.v1.PitrSnapshot.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.progressPercentage = $root.google.firestore.admin.v1.Progress.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CloneDatabaseMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.CloneDatabaseMetadata} CloneDatabaseMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloneDatabaseMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloneDatabaseMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloneDatabaseMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime, long + 1); + if (error) + return "startTime." + error; + } + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime, long + 1); + if (error) + return "endTime." + error; + } + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + switch (message.operationState) { + default: + return "operationState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.pitrSnapshot != null && Object.hasOwnProperty.call(message, "pitrSnapshot")) { + var error = $root.google.firestore.admin.v1.PitrSnapshot.verify(message.pitrSnapshot, long + 1); + if (error) + return "pitrSnapshot." + error; + } + if (message.progressPercentage != null && Object.hasOwnProperty.call(message, "progressPercentage")) { + var error = $root.google.firestore.admin.v1.Progress.verify(message.progressPercentage, long + 1); + if (error) + return "progressPercentage." + error; + } + return null; + }; + + /** + * Creates a CloneDatabaseMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.CloneDatabaseMetadata} CloneDatabaseMetadata + */ + CloneDatabaseMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.CloneDatabaseMetadata) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.CloneDatabaseMetadata: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.CloneDatabaseMetadata(); + if (object.startTime != null) { + if (!$util.isObject(object.startTime)) + throw TypeError(".google.firestore.admin.v1.CloneDatabaseMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime, long + 1); + } + if (object.endTime != null) { + if (!$util.isObject(object.endTime)) + throw TypeError(".google.firestore.admin.v1.CloneDatabaseMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime, long + 1); + } + switch (object.operationState) { + default: + if (typeof object.operationState === "number") { + message.operationState = object.operationState; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.operationState = 0; + break; + case "INITIALIZING": + case 1: + message.operationState = 1; + break; + case "PROCESSING": + case 2: + message.operationState = 2; + break; + case "CANCELLING": + case 3: + message.operationState = 3; + break; + case "FINALIZING": + case 4: + message.operationState = 4; + break; + case "SUCCESSFUL": + case 5: + message.operationState = 5; + break; + case "FAILED": + case 6: + message.operationState = 6; + break; + case "CANCELLED": + case 7: + message.operationState = 7; + break; + } + if (object.database != null) + message.database = String(object.database); + if (object.pitrSnapshot != null) { + if (!$util.isObject(object.pitrSnapshot)) + throw TypeError(".google.firestore.admin.v1.CloneDatabaseMetadata.pitrSnapshot: object expected"); + message.pitrSnapshot = $root.google.firestore.admin.v1.PitrSnapshot.fromObject(object.pitrSnapshot, long + 1); + } + if (object.progressPercentage != null) { + if (!$util.isObject(object.progressPercentage)) + throw TypeError(".google.firestore.admin.v1.CloneDatabaseMetadata.progressPercentage: object expected"); + message.progressPercentage = $root.google.firestore.admin.v1.Progress.fromObject(object.progressPercentage, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a CloneDatabaseMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @static + * @param {google.firestore.admin.v1.CloneDatabaseMetadata} message CloneDatabaseMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloneDatabaseMetadata.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.operationState = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + object.database = ""; + object.progressPercentage = null; + object.pitrSnapshot = null; + } + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options, q + 1); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options, q + 1); + if (message.operationState != null && Object.hasOwnProperty.call(message, "operationState")) + object.operationState = options.enums === String ? $root.google.firestore.admin.v1.OperationState[message.operationState] === undefined ? message.operationState : $root.google.firestore.admin.v1.OperationState[message.operationState] : message.operationState; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.progressPercentage != null && Object.hasOwnProperty.call(message, "progressPercentage")) + object.progressPercentage = $root.google.firestore.admin.v1.Progress.toObject(message.progressPercentage, options, q + 1); + if (message.pitrSnapshot != null && Object.hasOwnProperty.call(message, "pitrSnapshot")) + object.pitrSnapshot = $root.google.firestore.admin.v1.PitrSnapshot.toObject(message.pitrSnapshot, options, q + 1); + return object; + }; + + /** + * Converts this CloneDatabaseMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @instance + * @returns {Object.} JSON object + */ + CloneDatabaseMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CloneDatabaseMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.CloneDatabaseMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloneDatabaseMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.CloneDatabaseMetadata"; + }; + + return CloneDatabaseMetadata; + })(); + + v1.Progress = (function() { + + /** + * Properties of a Progress. + * @memberof google.firestore.admin.v1 + * @interface IProgress + * @property {number|Long|null} [estimatedWork] Progress estimatedWork + * @property {number|Long|null} [completedWork] Progress completedWork + */ + + /** + * Constructs a new Progress. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a Progress. + * @implements IProgress + * @constructor + * @param {google.firestore.admin.v1.IProgress=} [properties] Properties to set + */ + function Progress(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Progress estimatedWork. + * @member {number|Long} estimatedWork + * @memberof google.firestore.admin.v1.Progress + * @instance + */ + Progress.prototype.estimatedWork = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Progress completedWork. + * @member {number|Long} completedWork + * @memberof google.firestore.admin.v1.Progress + * @instance + */ + Progress.prototype.completedWork = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Progress instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.Progress + * @static + * @param {google.firestore.admin.v1.IProgress=} [properties] Properties to set + * @returns {google.firestore.admin.v1.Progress} Progress instance + */ + Progress.create = function create(properties) { + return new Progress(properties); + }; + + /** + * Encodes the specified Progress message. Does not implicitly {@link google.firestore.admin.v1.Progress.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.Progress + * @static + * @param {google.firestore.admin.v1.IProgress} message Progress message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Progress.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.estimatedWork != null && Object.hasOwnProperty.call(message, "estimatedWork")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.estimatedWork); + if (message.completedWork != null && Object.hasOwnProperty.call(message, "completedWork")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.completedWork); + return writer; + }; + + /** + * Encodes the specified Progress message, length delimited. Does not implicitly {@link google.firestore.admin.v1.Progress.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.Progress + * @static + * @param {google.firestore.admin.v1.IProgress} message Progress message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Progress.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Progress message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.Progress + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.Progress} Progress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Progress.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.Progress(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.estimatedWork = reader.int64(); + break; + } + case 2: { + message.completedWork = reader.int64(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Progress message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.Progress + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.Progress} Progress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Progress.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Progress message. + * @function verify + * @memberof google.firestore.admin.v1.Progress + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Progress.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.estimatedWork != null && Object.hasOwnProperty.call(message, "estimatedWork")) + if (!$util.isInteger(message.estimatedWork) && !(message.estimatedWork && $util.isInteger(message.estimatedWork.low) && $util.isInteger(message.estimatedWork.high))) + return "estimatedWork: integer|Long expected"; + if (message.completedWork != null && Object.hasOwnProperty.call(message, "completedWork")) + if (!$util.isInteger(message.completedWork) && !(message.completedWork && $util.isInteger(message.completedWork.low) && $util.isInteger(message.completedWork.high))) + return "completedWork: integer|Long expected"; + return null; + }; + + /** + * Creates a Progress message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.Progress + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.Progress} Progress + */ + Progress.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.Progress) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.Progress: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.Progress(); + if (object.estimatedWork != null) + if ($util.Long) + message.estimatedWork = $util.Long.fromValue(object.estimatedWork, false); + else if (typeof object.estimatedWork === "string") + message.estimatedWork = parseInt(object.estimatedWork, 10); + else if (typeof object.estimatedWork === "number") + message.estimatedWork = object.estimatedWork; + else if (typeof object.estimatedWork === "object") + message.estimatedWork = new $util.LongBits(object.estimatedWork.low >>> 0, object.estimatedWork.high >>> 0).toNumber(); + if (object.completedWork != null) + if ($util.Long) + message.completedWork = $util.Long.fromValue(object.completedWork, false); + else if (typeof object.completedWork === "string") + message.completedWork = parseInt(object.completedWork, 10); + else if (typeof object.completedWork === "number") + message.completedWork = object.completedWork; + else if (typeof object.completedWork === "object") + message.completedWork = new $util.LongBits(object.completedWork.low >>> 0, object.completedWork.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Progress message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.Progress + * @static + * @param {google.firestore.admin.v1.Progress} message Progress + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Progress.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.estimatedWork = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.estimatedWork = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.completedWork = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.completedWork = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + } + if (message.estimatedWork != null && Object.hasOwnProperty.call(message, "estimatedWork")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.estimatedWork = typeof message.estimatedWork === "number" ? BigInt(message.estimatedWork) : $util.Long.fromBits(message.estimatedWork.low >>> 0, message.estimatedWork.high >>> 0, false).toBigInt(); + else if (typeof message.estimatedWork === "number") + object.estimatedWork = options.longs === String ? String(message.estimatedWork) : message.estimatedWork; + else + object.estimatedWork = options.longs === String ? $util.Long.prototype.toString.call(message.estimatedWork) : options.longs === Number ? new $util.LongBits(message.estimatedWork.low >>> 0, message.estimatedWork.high >>> 0).toNumber() : message.estimatedWork; + if (message.completedWork != null && Object.hasOwnProperty.call(message, "completedWork")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.completedWork = typeof message.completedWork === "number" ? BigInt(message.completedWork) : $util.Long.fromBits(message.completedWork.low >>> 0, message.completedWork.high >>> 0, false).toBigInt(); + else if (typeof message.completedWork === "number") + object.completedWork = options.longs === String ? String(message.completedWork) : message.completedWork; + else + object.completedWork = options.longs === String ? $util.Long.prototype.toString.call(message.completedWork) : options.longs === Number ? new $util.LongBits(message.completedWork.low >>> 0, message.completedWork.high >>> 0).toNumber() : message.completedWork; + return object; + }; + + /** + * Converts this Progress to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.Progress + * @instance + * @returns {Object.} JSON object + */ + Progress.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Progress + * @function getTypeUrl + * @memberof google.firestore.admin.v1.Progress + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Progress.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.Progress"; + }; + + return Progress; + })(); + + /** + * OperationState enum. + * @name google.firestore.admin.v1.OperationState + * @enum {number} + * @property {number} OPERATION_STATE_UNSPECIFIED=0 OPERATION_STATE_UNSPECIFIED value + * @property {number} INITIALIZING=1 INITIALIZING value + * @property {number} PROCESSING=2 PROCESSING value + * @property {number} CANCELLING=3 CANCELLING value + * @property {number} FINALIZING=4 FINALIZING value + * @property {number} SUCCESSFUL=5 SUCCESSFUL value + * @property {number} FAILED=6 FAILED value + * @property {number} CANCELLED=7 CANCELLED value + */ + v1.OperationState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATION_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INITIALIZING"] = 1; + values[valuesById[2] = "PROCESSING"] = 2; + values[valuesById[3] = "CANCELLING"] = 3; + values[valuesById[4] = "FINALIZING"] = 4; + values[valuesById[5] = "SUCCESSFUL"] = 5; + values[valuesById[6] = "FAILED"] = 6; + values[valuesById[7] = "CANCELLED"] = 7; + return values; + })(); + + v1.PitrSnapshot = (function() { + + /** + * Properties of a PitrSnapshot. + * @memberof google.firestore.admin.v1 + * @interface IPitrSnapshot + * @property {string|null} [database] PitrSnapshot database + * @property {Uint8Array|null} [databaseUid] PitrSnapshot databaseUid + * @property {google.protobuf.ITimestamp|null} [snapshotTime] PitrSnapshot snapshotTime + */ + + /** + * Constructs a new PitrSnapshot. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a PitrSnapshot. + * @implements IPitrSnapshot + * @constructor + * @param {google.firestore.admin.v1.IPitrSnapshot=} [properties] Properties to set + */ + function PitrSnapshot(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * PitrSnapshot database. + * @member {string} database + * @memberof google.firestore.admin.v1.PitrSnapshot + * @instance + */ + PitrSnapshot.prototype.database = ""; + + /** + * PitrSnapshot databaseUid. + * @member {Uint8Array} databaseUid + * @memberof google.firestore.admin.v1.PitrSnapshot + * @instance + */ + PitrSnapshot.prototype.databaseUid = $util.newBuffer([]); + + /** + * PitrSnapshot snapshotTime. + * @member {google.protobuf.ITimestamp|null|undefined} snapshotTime + * @memberof google.firestore.admin.v1.PitrSnapshot + * @instance + */ + PitrSnapshot.prototype.snapshotTime = null; + + /** + * Creates a new PitrSnapshot instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.PitrSnapshot + * @static + * @param {google.firestore.admin.v1.IPitrSnapshot=} [properties] Properties to set + * @returns {google.firestore.admin.v1.PitrSnapshot} PitrSnapshot instance + */ + PitrSnapshot.create = function create(properties) { + return new PitrSnapshot(properties); + }; + + /** + * Encodes the specified PitrSnapshot message. Does not implicitly {@link google.firestore.admin.v1.PitrSnapshot.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.PitrSnapshot + * @static + * @param {google.firestore.admin.v1.IPitrSnapshot} message PitrSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PitrSnapshot.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.databaseUid != null && Object.hasOwnProperty.call(message, "databaseUid")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.databaseUid); + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + $root.google.protobuf.Timestamp.encode(message.snapshotTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified PitrSnapshot message, length delimited. Does not implicitly {@link google.firestore.admin.v1.PitrSnapshot.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.PitrSnapshot + * @static + * @param {google.firestore.admin.v1.IPitrSnapshot} message PitrSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PitrSnapshot.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a PitrSnapshot message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.PitrSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.PitrSnapshot} PitrSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PitrSnapshot.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.PitrSnapshot(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.databaseUid = reader.bytes(); + break; + } + case 3: { + message.snapshotTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a PitrSnapshot message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.PitrSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.PitrSnapshot} PitrSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PitrSnapshot.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PitrSnapshot message. + * @function verify + * @memberof google.firestore.admin.v1.PitrSnapshot + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PitrSnapshot.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.databaseUid != null && Object.hasOwnProperty.call(message, "databaseUid")) + if (!(message.databaseUid && typeof message.databaseUid.length === "number" || $util.isString(message.databaseUid))) + return "databaseUid: buffer expected"; + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.snapshotTime, long + 1); + if (error) + return "snapshotTime." + error; + } + return null; + }; + + /** + * Creates a PitrSnapshot message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.PitrSnapshot + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.PitrSnapshot} PitrSnapshot + */ + PitrSnapshot.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.PitrSnapshot) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.PitrSnapshot: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.PitrSnapshot(); + if (object.database != null) + message.database = String(object.database); + if (object.databaseUid != null) + if (typeof object.databaseUid === "string") + $util.base64.decode(object.databaseUid, message.databaseUid = $util.newBuffer($util.base64.length(object.databaseUid)), 0); + else if (object.databaseUid.length >= 0) + message.databaseUid = object.databaseUid; + if (object.snapshotTime != null) { + if (!$util.isObject(object.snapshotTime)) + throw TypeError(".google.firestore.admin.v1.PitrSnapshot.snapshotTime: object expected"); + message.snapshotTime = $root.google.protobuf.Timestamp.fromObject(object.snapshotTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a PitrSnapshot message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.PitrSnapshot + * @static + * @param {google.firestore.admin.v1.PitrSnapshot} message PitrSnapshot + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PitrSnapshot.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.database = ""; + if (options.bytes === String) + object.databaseUid = ""; + else { + object.databaseUid = []; + if (options.bytes !== Array) + object.databaseUid = $util.newBuffer(object.databaseUid); + } + object.snapshotTime = null; + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.databaseUid != null && Object.hasOwnProperty.call(message, "databaseUid")) + object.databaseUid = options.bytes === String ? $util.base64.encode(message.databaseUid, 0, message.databaseUid.length) : options.bytes === Array ? Array.prototype.slice.call(message.databaseUid) : message.databaseUid; + if (message.snapshotTime != null && Object.hasOwnProperty.call(message, "snapshotTime")) + object.snapshotTime = $root.google.protobuf.Timestamp.toObject(message.snapshotTime, options, q + 1); + return object; + }; + + /** + * Converts this PitrSnapshot to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.PitrSnapshot + * @instance + * @returns {Object.} JSON object + */ + PitrSnapshot.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PitrSnapshot + * @function getTypeUrl + * @memberof google.firestore.admin.v1.PitrSnapshot + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PitrSnapshot.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.PitrSnapshot"; + }; + + return PitrSnapshot; + })(); + + v1.BackupSchedule = (function() { + + /** + * Properties of a BackupSchedule. + * @memberof google.firestore.admin.v1 + * @interface IBackupSchedule + * @property {string|null} [name] BackupSchedule name + * @property {google.protobuf.ITimestamp|null} [createTime] BackupSchedule createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] BackupSchedule updateTime + * @property {google.protobuf.IDuration|null} [retention] BackupSchedule retention + * @property {google.firestore.admin.v1.IDailyRecurrence|null} [dailyRecurrence] BackupSchedule dailyRecurrence + * @property {google.firestore.admin.v1.IWeeklyRecurrence|null} [weeklyRecurrence] BackupSchedule weeklyRecurrence + */ + + /** + * Constructs a new BackupSchedule. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a BackupSchedule. + * @implements IBackupSchedule + * @constructor + * @param {google.firestore.admin.v1.IBackupSchedule=} [properties] Properties to set + */ + function BackupSchedule(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupSchedule name. + * @member {string} name + * @memberof google.firestore.admin.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.name = ""; + + /** + * BackupSchedule createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.firestore.admin.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.createTime = null; + + /** + * BackupSchedule updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.firestore.admin.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.updateTime = null; + + /** + * BackupSchedule retention. + * @member {google.protobuf.IDuration|null|undefined} retention + * @memberof google.firestore.admin.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.retention = null; + + /** + * BackupSchedule dailyRecurrence. + * @member {google.firestore.admin.v1.IDailyRecurrence|null|undefined} dailyRecurrence + * @memberof google.firestore.admin.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.dailyRecurrence = null; + + /** + * BackupSchedule weeklyRecurrence. + * @member {google.firestore.admin.v1.IWeeklyRecurrence|null|undefined} weeklyRecurrence + * @memberof google.firestore.admin.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.weeklyRecurrence = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BackupSchedule recurrence. + * @member {"dailyRecurrence"|"weeklyRecurrence"|undefined} recurrence + * @memberof google.firestore.admin.v1.BackupSchedule + * @instance + */ + Object.defineProperty(BackupSchedule.prototype, "recurrence", { + get: $util.oneOfGetter($oneOfFields = ["dailyRecurrence", "weeklyRecurrence"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupSchedule instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.BackupSchedule + * @static + * @param {google.firestore.admin.v1.IBackupSchedule=} [properties] Properties to set + * @returns {google.firestore.admin.v1.BackupSchedule} BackupSchedule instance + */ + BackupSchedule.create = function create(properties) { + return new BackupSchedule(properties); + }; + + /** + * Encodes the specified BackupSchedule message. Does not implicitly {@link google.firestore.admin.v1.BackupSchedule.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.BackupSchedule + * @static + * @param {google.firestore.admin.v1.IBackupSchedule} message BackupSchedule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupSchedule.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) + $root.google.protobuf.Duration.encode(message.retention, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.dailyRecurrence != null && Object.hasOwnProperty.call(message, "dailyRecurrence")) + $root.google.firestore.admin.v1.DailyRecurrence.encode(message.dailyRecurrence, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.weeklyRecurrence != null && Object.hasOwnProperty.call(message, "weeklyRecurrence")) + $root.google.firestore.admin.v1.WeeklyRecurrence.encode(message.weeklyRecurrence, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 10, wireType 2 =*/82).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BackupSchedule message, length delimited. Does not implicitly {@link google.firestore.admin.v1.BackupSchedule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.BackupSchedule + * @static + * @param {google.firestore.admin.v1.IBackupSchedule} message BackupSchedule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupSchedule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BackupSchedule message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.BackupSchedule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.BackupSchedule} BackupSchedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupSchedule.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.BackupSchedule(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 10: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.retention = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.dailyRecurrence = $root.google.firestore.admin.v1.DailyRecurrence.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 8: { + message.weeklyRecurrence = $root.google.firestore.admin.v1.WeeklyRecurrence.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BackupSchedule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.BackupSchedule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.BackupSchedule} BackupSchedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupSchedule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupSchedule message. + * @function verify + * @memberof google.firestore.admin.v1.BackupSchedule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupSchedule.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime, long + 1); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime, long + 1); + if (error) + return "updateTime." + error; + } + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) { + var error = $root.google.protobuf.Duration.verify(message.retention, long + 1); + if (error) + return "retention." + error; + } + if (message.dailyRecurrence != null && Object.hasOwnProperty.call(message, "dailyRecurrence")) { + properties.recurrence = 1; + { + var error = $root.google.firestore.admin.v1.DailyRecurrence.verify(message.dailyRecurrence, long + 1); + if (error) + return "dailyRecurrence." + error; + } + } + if (message.weeklyRecurrence != null && Object.hasOwnProperty.call(message, "weeklyRecurrence")) { + if (properties.recurrence === 1) + return "recurrence: multiple values"; + properties.recurrence = 1; + { + var error = $root.google.firestore.admin.v1.WeeklyRecurrence.verify(message.weeklyRecurrence, long + 1); + if (error) + return "weeklyRecurrence." + error; + } + } + return null; + }; + + /** + * Creates a BackupSchedule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.BackupSchedule + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.BackupSchedule} BackupSchedule + */ + BackupSchedule.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.BackupSchedule) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.BackupSchedule: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.BackupSchedule(); + if (object.name != null) + message.name = String(object.name); + if (object.createTime != null) { + if (!$util.isObject(object.createTime)) + throw TypeError(".google.firestore.admin.v1.BackupSchedule.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime, long + 1); + } + if (object.updateTime != null) { + if (!$util.isObject(object.updateTime)) + throw TypeError(".google.firestore.admin.v1.BackupSchedule.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime, long + 1); + } + if (object.retention != null) { + if (!$util.isObject(object.retention)) + throw TypeError(".google.firestore.admin.v1.BackupSchedule.retention: object expected"); + message.retention = $root.google.protobuf.Duration.fromObject(object.retention, long + 1); + } + if (object.dailyRecurrence != null) { + if (!$util.isObject(object.dailyRecurrence)) + throw TypeError(".google.firestore.admin.v1.BackupSchedule.dailyRecurrence: object expected"); + message.dailyRecurrence = $root.google.firestore.admin.v1.DailyRecurrence.fromObject(object.dailyRecurrence, long + 1); + } + if (object.weeklyRecurrence != null) { + if (!$util.isObject(object.weeklyRecurrence)) + throw TypeError(".google.firestore.admin.v1.BackupSchedule.weeklyRecurrence: object expected"); + message.weeklyRecurrence = $root.google.firestore.admin.v1.WeeklyRecurrence.fromObject(object.weeklyRecurrence, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a BackupSchedule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.BackupSchedule + * @static + * @param {google.firestore.admin.v1.BackupSchedule} message BackupSchedule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupSchedule.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.retention = null; + object.updateTime = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options, q + 1); + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) + object.retention = $root.google.protobuf.Duration.toObject(message.retention, options, q + 1); + if (message.dailyRecurrence != null && Object.hasOwnProperty.call(message, "dailyRecurrence")) { + object.dailyRecurrence = $root.google.firestore.admin.v1.DailyRecurrence.toObject(message.dailyRecurrence, options, q + 1); + if (options.oneofs) + object.recurrence = "dailyRecurrence"; + } + if (message.weeklyRecurrence != null && Object.hasOwnProperty.call(message, "weeklyRecurrence")) { + object.weeklyRecurrence = $root.google.firestore.admin.v1.WeeklyRecurrence.toObject(message.weeklyRecurrence, options, q + 1); + if (options.oneofs) + object.recurrence = "weeklyRecurrence"; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options, q + 1); + return object; + }; + + /** + * Converts this BackupSchedule to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.BackupSchedule + * @instance + * @returns {Object.} JSON object + */ + BackupSchedule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupSchedule + * @function getTypeUrl + * @memberof google.firestore.admin.v1.BackupSchedule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupSchedule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.BackupSchedule"; + }; + + return BackupSchedule; + })(); + + v1.DailyRecurrence = (function() { + + /** + * Properties of a DailyRecurrence. + * @memberof google.firestore.admin.v1 + * @interface IDailyRecurrence + */ + + /** + * Constructs a new DailyRecurrence. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a DailyRecurrence. + * @implements IDailyRecurrence + * @constructor + * @param {google.firestore.admin.v1.IDailyRecurrence=} [properties] Properties to set + */ + function DailyRecurrence(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new DailyRecurrence instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.DailyRecurrence + * @static + * @param {google.firestore.admin.v1.IDailyRecurrence=} [properties] Properties to set + * @returns {google.firestore.admin.v1.DailyRecurrence} DailyRecurrence instance + */ + DailyRecurrence.create = function create(properties) { + return new DailyRecurrence(properties); + }; + + /** + * Encodes the specified DailyRecurrence message. Does not implicitly {@link google.firestore.admin.v1.DailyRecurrence.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.DailyRecurrence + * @static + * @param {google.firestore.admin.v1.IDailyRecurrence} message DailyRecurrence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DailyRecurrence.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified DailyRecurrence message, length delimited. Does not implicitly {@link google.firestore.admin.v1.DailyRecurrence.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.DailyRecurrence + * @static + * @param {google.firestore.admin.v1.IDailyRecurrence} message DailyRecurrence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DailyRecurrence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DailyRecurrence message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.DailyRecurrence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.DailyRecurrence} DailyRecurrence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DailyRecurrence.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.DailyRecurrence(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DailyRecurrence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.DailyRecurrence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.DailyRecurrence} DailyRecurrence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DailyRecurrence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DailyRecurrence message. + * @function verify + * @memberof google.firestore.admin.v1.DailyRecurrence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DailyRecurrence.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates a DailyRecurrence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.DailyRecurrence + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.DailyRecurrence} DailyRecurrence + */ + DailyRecurrence.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.DailyRecurrence) + return object; + return new $root.google.firestore.admin.v1.DailyRecurrence(); + }; + + /** + * Creates a plain object from a DailyRecurrence message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.DailyRecurrence + * @static + * @param {google.firestore.admin.v1.DailyRecurrence} message DailyRecurrence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DailyRecurrence.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DailyRecurrence to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.DailyRecurrence + * @instance + * @returns {Object.} JSON object + */ + DailyRecurrence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DailyRecurrence + * @function getTypeUrl + * @memberof google.firestore.admin.v1.DailyRecurrence + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DailyRecurrence.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.DailyRecurrence"; + }; + + return DailyRecurrence; + })(); + + v1.WeeklyRecurrence = (function() { + + /** + * Properties of a WeeklyRecurrence. + * @memberof google.firestore.admin.v1 + * @interface IWeeklyRecurrence + * @property {google.type.DayOfWeek|null} [day] WeeklyRecurrence day + */ + + /** + * Constructs a new WeeklyRecurrence. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a WeeklyRecurrence. + * @implements IWeeklyRecurrence + * @constructor + * @param {google.firestore.admin.v1.IWeeklyRecurrence=} [properties] Properties to set + */ + function WeeklyRecurrence(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * WeeklyRecurrence day. + * @member {google.type.DayOfWeek} day + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @instance + */ + WeeklyRecurrence.prototype.day = 0; + + /** + * Creates a new WeeklyRecurrence instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @static + * @param {google.firestore.admin.v1.IWeeklyRecurrence=} [properties] Properties to set + * @returns {google.firestore.admin.v1.WeeklyRecurrence} WeeklyRecurrence instance + */ + WeeklyRecurrence.create = function create(properties) { + return new WeeklyRecurrence(properties); + }; + + /** + * Encodes the specified WeeklyRecurrence message. Does not implicitly {@link google.firestore.admin.v1.WeeklyRecurrence.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @static + * @param {google.firestore.admin.v1.IWeeklyRecurrence} message WeeklyRecurrence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WeeklyRecurrence.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.day != null && Object.hasOwnProperty.call(message, "day")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.day); + return writer; + }; + + /** + * Encodes the specified WeeklyRecurrence message, length delimited. Does not implicitly {@link google.firestore.admin.v1.WeeklyRecurrence.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @static + * @param {google.firestore.admin.v1.IWeeklyRecurrence} message WeeklyRecurrence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WeeklyRecurrence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a WeeklyRecurrence message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.WeeklyRecurrence} WeeklyRecurrence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WeeklyRecurrence.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.WeeklyRecurrence(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.day = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a WeeklyRecurrence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.WeeklyRecurrence} WeeklyRecurrence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WeeklyRecurrence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WeeklyRecurrence message. + * @function verify + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WeeklyRecurrence.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.day != null && Object.hasOwnProperty.call(message, "day")) + switch (message.day) { + default: + return "day: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + return null; + }; + + /** + * Creates a WeeklyRecurrence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.WeeklyRecurrence} WeeklyRecurrence + */ + WeeklyRecurrence.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.WeeklyRecurrence) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.WeeklyRecurrence: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.WeeklyRecurrence(); + switch (object.day) { + default: + if (typeof object.day === "number") { + message.day = object.day; + break; + } + break; + case "DAY_OF_WEEK_UNSPECIFIED": + case 0: + message.day = 0; + break; + case "MONDAY": + case 1: + message.day = 1; + break; + case "TUESDAY": + case 2: + message.day = 2; + break; + case "WEDNESDAY": + case 3: + message.day = 3; + break; + case "THURSDAY": + case 4: + message.day = 4; + break; + case "FRIDAY": + case 5: + message.day = 5; + break; + case "SATURDAY": + case 6: + message.day = 6; + break; + case "SUNDAY": + case 7: + message.day = 7; + break; + } + return message; + }; + + /** + * Creates a plain object from a WeeklyRecurrence message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @static + * @param {google.firestore.admin.v1.WeeklyRecurrence} message WeeklyRecurrence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WeeklyRecurrence.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.day = options.enums === String ? "DAY_OF_WEEK_UNSPECIFIED" : 0; + if (message.day != null && Object.hasOwnProperty.call(message, "day")) + object.day = options.enums === String ? $root.google.type.DayOfWeek[message.day] === undefined ? message.day : $root.google.type.DayOfWeek[message.day] : message.day; + return object; + }; + + /** + * Converts this WeeklyRecurrence to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @instance + * @returns {Object.} JSON object + */ + WeeklyRecurrence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WeeklyRecurrence + * @function getTypeUrl + * @memberof google.firestore.admin.v1.WeeklyRecurrence + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WeeklyRecurrence.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.WeeklyRecurrence"; + }; + + return WeeklyRecurrence; + })(); + + v1.UserCreds = (function() { + + /** + * Properties of a UserCreds. + * @memberof google.firestore.admin.v1 + * @interface IUserCreds + * @property {string|null} [name] UserCreds name + * @property {google.protobuf.ITimestamp|null} [createTime] UserCreds createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] UserCreds updateTime + * @property {google.firestore.admin.v1.UserCreds.State|null} [state] UserCreds state + * @property {string|null} [securePassword] UserCreds securePassword + * @property {google.firestore.admin.v1.UserCreds.IResourceIdentity|null} [resourceIdentity] UserCreds resourceIdentity + */ + + /** + * Constructs a new UserCreds. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a UserCreds. + * @implements IUserCreds + * @constructor + * @param {google.firestore.admin.v1.IUserCreds=} [properties] Properties to set + */ + function UserCreds(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserCreds name. + * @member {string} name + * @memberof google.firestore.admin.v1.UserCreds + * @instance + */ + UserCreds.prototype.name = ""; + + /** + * UserCreds createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.firestore.admin.v1.UserCreds + * @instance + */ + UserCreds.prototype.createTime = null; + + /** + * UserCreds updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.firestore.admin.v1.UserCreds + * @instance + */ + UserCreds.prototype.updateTime = null; + + /** + * UserCreds state. + * @member {google.firestore.admin.v1.UserCreds.State} state + * @memberof google.firestore.admin.v1.UserCreds + * @instance + */ + UserCreds.prototype.state = 0; + + /** + * UserCreds securePassword. + * @member {string} securePassword + * @memberof google.firestore.admin.v1.UserCreds + * @instance + */ + UserCreds.prototype.securePassword = ""; + + /** + * UserCreds resourceIdentity. + * @member {google.firestore.admin.v1.UserCreds.IResourceIdentity|null|undefined} resourceIdentity + * @memberof google.firestore.admin.v1.UserCreds + * @instance + */ + UserCreds.prototype.resourceIdentity = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UserCreds UserCredsIdentity. + * @member {"resourceIdentity"|undefined} UserCredsIdentity + * @memberof google.firestore.admin.v1.UserCreds + * @instance + */ + Object.defineProperty(UserCreds.prototype, "UserCredsIdentity", { + get: $util.oneOfGetter($oneOfFields = ["resourceIdentity"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UserCreds instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.UserCreds + * @static + * @param {google.firestore.admin.v1.IUserCreds=} [properties] Properties to set + * @returns {google.firestore.admin.v1.UserCreds} UserCreds instance + */ + UserCreds.create = function create(properties) { + return new UserCreds(properties); + }; + + /** + * Encodes the specified UserCreds message. Does not implicitly {@link google.firestore.admin.v1.UserCreds.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.UserCreds + * @static + * @param {google.firestore.admin.v1.IUserCreds} message UserCreds message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserCreds.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.securePassword != null && Object.hasOwnProperty.call(message, "securePassword")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.securePassword); + if (message.resourceIdentity != null && Object.hasOwnProperty.call(message, "resourceIdentity")) + $root.google.firestore.admin.v1.UserCreds.ResourceIdentity.encode(message.resourceIdentity, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserCreds message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UserCreds.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.UserCreds + * @static + * @param {google.firestore.admin.v1.IUserCreds} message UserCreds message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserCreds.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a UserCreds message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.UserCreds + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.UserCreds} UserCreds + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserCreds.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.UserCreds(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.state = reader.int32(); + break; + } + case 5: { + message.securePassword = reader.string(); + break; + } + case 6: { + message.resourceIdentity = $root.google.firestore.admin.v1.UserCreds.ResourceIdentity.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a UserCreds message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.UserCreds + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.UserCreds} UserCreds + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserCreds.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserCreds message. + * @function verify + * @memberof google.firestore.admin.v1.UserCreds + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserCreds.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime, long + 1); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime, long + 1); + if (error) + return "updateTime." + error; + } + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.securePassword != null && Object.hasOwnProperty.call(message, "securePassword")) + if (!$util.isString(message.securePassword)) + return "securePassword: string expected"; + if (message.resourceIdentity != null && Object.hasOwnProperty.call(message, "resourceIdentity")) { + properties.UserCredsIdentity = 1; + { + var error = $root.google.firestore.admin.v1.UserCreds.ResourceIdentity.verify(message.resourceIdentity, long + 1); + if (error) + return "resourceIdentity." + error; + } + } + return null; + }; + + /** + * Creates a UserCreds message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.UserCreds + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.UserCreds} UserCreds + */ + UserCreds.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.UserCreds) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.UserCreds: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.UserCreds(); + if (object.name != null) + message.name = String(object.name); + if (object.createTime != null) { + if (!$util.isObject(object.createTime)) + throw TypeError(".google.firestore.admin.v1.UserCreds.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime, long + 1); + } + if (object.updateTime != null) { + if (!$util.isObject(object.updateTime)) + throw TypeError(".google.firestore.admin.v1.UserCreds.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime, long + 1); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ENABLED": + case 1: + message.state = 1; + break; + case "DISABLED": + case 2: + message.state = 2; + break; + } + if (object.securePassword != null) + message.securePassword = String(object.securePassword); + if (object.resourceIdentity != null) { + if (!$util.isObject(object.resourceIdentity)) + throw TypeError(".google.firestore.admin.v1.UserCreds.resourceIdentity: object expected"); + message.resourceIdentity = $root.google.firestore.admin.v1.UserCreds.ResourceIdentity.fromObject(object.resourceIdentity, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a UserCreds message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.UserCreds + * @static + * @param {google.firestore.admin.v1.UserCreds} message UserCreds + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserCreds.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.updateTime = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.securePassword = ""; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options, q + 1); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options, q + 1); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + object.state = options.enums === String ? $root.google.firestore.admin.v1.UserCreds.State[message.state] === undefined ? message.state : $root.google.firestore.admin.v1.UserCreds.State[message.state] : message.state; + if (message.securePassword != null && Object.hasOwnProperty.call(message, "securePassword")) + object.securePassword = message.securePassword; + if (message.resourceIdentity != null && Object.hasOwnProperty.call(message, "resourceIdentity")) { + object.resourceIdentity = $root.google.firestore.admin.v1.UserCreds.ResourceIdentity.toObject(message.resourceIdentity, options, q + 1); + if (options.oneofs) + object.UserCredsIdentity = "resourceIdentity"; + } + return object; + }; + + /** + * Converts this UserCreds to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.UserCreds + * @instance + * @returns {Object.} JSON object + */ + UserCreds.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UserCreds + * @function getTypeUrl + * @memberof google.firestore.admin.v1.UserCreds + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserCreds.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.UserCreds"; + }; + + /** + * State enum. + * @name google.firestore.admin.v1.UserCreds.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ENABLED=1 ENABLED value + * @property {number} DISABLED=2 DISABLED value + */ + UserCreds.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENABLED"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + return values; + })(); + + UserCreds.ResourceIdentity = (function() { + + /** + * Properties of a ResourceIdentity. + * @memberof google.firestore.admin.v1.UserCreds + * @interface IResourceIdentity + * @property {string|null} [principal] ResourceIdentity principal + */ + + /** + * Constructs a new ResourceIdentity. + * @memberof google.firestore.admin.v1.UserCreds + * @classdesc Represents a ResourceIdentity. + * @implements IResourceIdentity + * @constructor + * @param {google.firestore.admin.v1.UserCreds.IResourceIdentity=} [properties] Properties to set + */ + function ResourceIdentity(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceIdentity principal. + * @member {string} principal + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @instance + */ + ResourceIdentity.prototype.principal = ""; + + /** + * Creates a new ResourceIdentity instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @static + * @param {google.firestore.admin.v1.UserCreds.IResourceIdentity=} [properties] Properties to set + * @returns {google.firestore.admin.v1.UserCreds.ResourceIdentity} ResourceIdentity instance + */ + ResourceIdentity.create = function create(properties) { + return new ResourceIdentity(properties); + }; + + /** + * Encodes the specified ResourceIdentity message. Does not implicitly {@link google.firestore.admin.v1.UserCreds.ResourceIdentity.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @static + * @param {google.firestore.admin.v1.UserCreds.IResourceIdentity} message ResourceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceIdentity.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.principal != null && Object.hasOwnProperty.call(message, "principal")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.principal); + return writer; + }; + + /** + * Encodes the specified ResourceIdentity message, length delimited. Does not implicitly {@link google.firestore.admin.v1.UserCreds.ResourceIdentity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @static + * @param {google.firestore.admin.v1.UserCreds.IResourceIdentity} message ResourceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceIdentity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ResourceIdentity message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.UserCreds.ResourceIdentity} ResourceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceIdentity.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.UserCreds.ResourceIdentity(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.principal = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceIdentity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.UserCreds.ResourceIdentity} ResourceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceIdentity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceIdentity message. + * @function verify + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceIdentity.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.principal != null && Object.hasOwnProperty.call(message, "principal")) + if (!$util.isString(message.principal)) + return "principal: string expected"; + return null; + }; + + /** + * Creates a ResourceIdentity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.UserCreds.ResourceIdentity} ResourceIdentity + */ + ResourceIdentity.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.UserCreds.ResourceIdentity) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.admin.v1.UserCreds.ResourceIdentity: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.admin.v1.UserCreds.ResourceIdentity(); + if (object.principal != null) + message.principal = String(object.principal); + return message; + }; + + /** + * Creates a plain object from a ResourceIdentity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @static + * @param {google.firestore.admin.v1.UserCreds.ResourceIdentity} message ResourceIdentity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceIdentity.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.principal = ""; + if (message.principal != null && Object.hasOwnProperty.call(message, "principal")) + object.principal = message.principal; + return object; + }; + + /** + * Converts this ResourceIdentity to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @instance + * @returns {Object.} JSON object + */ + ResourceIdentity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceIdentity + * @function getTypeUrl + * @memberof google.firestore.admin.v1.UserCreds.ResourceIdentity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceIdentity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.UserCreds.ResourceIdentity"; + }; + + return ResourceIdentity; + })(); + + return UserCreds; + })(); + + v1.LocationMetadata = (function() { + + /** + * Properties of a LocationMetadata. + * @memberof google.firestore.admin.v1 + * @interface ILocationMetadata + */ + + /** + * Constructs a new LocationMetadata. + * @memberof google.firestore.admin.v1 + * @classdesc Represents a LocationMetadata. + * @implements ILocationMetadata + * @constructor + * @param {google.firestore.admin.v1.ILocationMetadata=} [properties] Properties to set + */ + function LocationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new LocationMetadata instance using the specified properties. + * @function create + * @memberof google.firestore.admin.v1.LocationMetadata + * @static + * @param {google.firestore.admin.v1.ILocationMetadata=} [properties] Properties to set + * @returns {google.firestore.admin.v1.LocationMetadata} LocationMetadata instance + */ + LocationMetadata.create = function create(properties) { + return new LocationMetadata(properties); + }; + + /** + * Encodes the specified LocationMetadata message. Does not implicitly {@link google.firestore.admin.v1.LocationMetadata.verify|verify} messages. + * @function encode + * @memberof google.firestore.admin.v1.LocationMetadata + * @static + * @param {google.firestore.admin.v1.ILocationMetadata} message LocationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationMetadata.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified LocationMetadata message, length delimited. Does not implicitly {@link google.firestore.admin.v1.LocationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.admin.v1.LocationMetadata + * @static + * @param {google.firestore.admin.v1.ILocationMetadata} message LocationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.admin.v1.LocationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.admin.v1.LocationMetadata} LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationMetadata.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.admin.v1.LocationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.admin.v1.LocationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.admin.v1.LocationMetadata} LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationMetadata message. + * @function verify + * @memberof google.firestore.admin.v1.LocationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationMetadata.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates a LocationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.admin.v1.LocationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.admin.v1.LocationMetadata} LocationMetadata + */ + LocationMetadata.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.admin.v1.LocationMetadata) + return object; + return new $root.google.firestore.admin.v1.LocationMetadata(); + }; + + /** + * Creates a plain object from a LocationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.admin.v1.LocationMetadata + * @static + * @param {google.firestore.admin.v1.LocationMetadata} message LocationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocationMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this LocationMetadata to JSON. + * @function toJSON + * @memberof google.firestore.admin.v1.LocationMetadata + * @instance + * @returns {Object.} JSON object + */ + LocationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LocationMetadata + * @function getTypeUrl + * @memberof google.firestore.admin.v1.LocationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.admin.v1.LocationMetadata"; + }; + + return LocationMetadata; + })(); + + return v1; + })(); + + return admin; + })(); + + firestore.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.firestore + * @namespace + */ + var v1 = {}; + + v1.AggregationResult = (function() { + + /** + * Properties of an AggregationResult. + * @memberof google.firestore.v1 + * @interface IAggregationResult + * @property {Object.|null} [aggregateFields] AggregationResult aggregateFields + */ + + /** + * Constructs a new AggregationResult. + * @memberof google.firestore.v1 + * @classdesc Represents an AggregationResult. + * @implements IAggregationResult + * @constructor + * @param {google.firestore.v1.IAggregationResult=} [properties] Properties to set + */ + function AggregationResult(properties) { + this.aggregateFields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * AggregationResult aggregateFields. + * @member {Object.} aggregateFields + * @memberof google.firestore.v1.AggregationResult + * @instance + */ + AggregationResult.prototype.aggregateFields = $util.emptyObject; + + /** + * Creates a new AggregationResult instance using the specified properties. + * @function create + * @memberof google.firestore.v1.AggregationResult + * @static + * @param {google.firestore.v1.IAggregationResult=} [properties] Properties to set + * @returns {google.firestore.v1.AggregationResult} AggregationResult instance + */ + AggregationResult.create = function create(properties) { + return new AggregationResult(properties); + }; + + /** + * Encodes the specified AggregationResult message. Does not implicitly {@link google.firestore.v1.AggregationResult.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.AggregationResult + * @static + * @param {google.firestore.v1.IAggregationResult} message AggregationResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AggregationResult.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.aggregateFields != null && Object.hasOwnProperty.call(message, "aggregateFields")) + for (var keys = Object.keys(message.aggregateFields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.firestore.v1.Value.encode(message.aggregateFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified AggregationResult message, length delimited. Does not implicitly {@link google.firestore.v1.AggregationResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.AggregationResult + * @static + * @param {google.firestore.v1.IAggregationResult} message AggregationResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AggregationResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an AggregationResult message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.AggregationResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.AggregationResult} AggregationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AggregationResult.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.AggregationResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (message.aggregateFields === $util.emptyObject) + message.aggregateFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.aggregateFields, key); + message.aggregateFields[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an AggregationResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.AggregationResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.AggregationResult} AggregationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AggregationResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AggregationResult message. + * @function verify + * @memberof google.firestore.v1.AggregationResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AggregationResult.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.aggregateFields != null && Object.hasOwnProperty.call(message, "aggregateFields")) { + if (!$util.isObject(message.aggregateFields)) + return "aggregateFields: object expected"; + var key = Object.keys(message.aggregateFields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.aggregateFields[key[i]], long + 1); + if (error) + return "aggregateFields." + error; + } + } + return null; + }; + + /** + * Creates an AggregationResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.AggregationResult + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.AggregationResult} AggregationResult + */ + AggregationResult.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.AggregationResult) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.AggregationResult: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.AggregationResult(); + if (object.aggregateFields) { + if (!$util.isObject(object.aggregateFields)) + throw TypeError(".google.firestore.v1.AggregationResult.aggregateFields: object expected"); + message.aggregateFields = {}; + for (var keys = Object.keys(object.aggregateFields), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.aggregateFields, keys[i]); + if (!$util.isObject(object.aggregateFields[keys[i]])) + throw TypeError(".google.firestore.v1.AggregationResult.aggregateFields: object expected"); + message.aggregateFields[keys[i]] = $root.google.firestore.v1.Value.fromObject(object.aggregateFields[keys[i]], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from an AggregationResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.AggregationResult + * @static + * @param {google.firestore.v1.AggregationResult} message AggregationResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AggregationResult.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.aggregateFields = {}; + var keys2; + if (message.aggregateFields && (keys2 = Object.keys(message.aggregateFields)).length) { + object.aggregateFields = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.aggregateFields, keys2[j]); + object.aggregateFields[keys2[j]] = $root.google.firestore.v1.Value.toObject(message.aggregateFields[keys2[j]], options, q + 1); + } + } + return object; + }; + + /** + * Converts this AggregationResult to JSON. + * @function toJSON + * @memberof google.firestore.v1.AggregationResult + * @instance + * @returns {Object.} JSON object + */ + AggregationResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AggregationResult + * @function getTypeUrl + * @memberof google.firestore.v1.AggregationResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AggregationResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.AggregationResult"; + }; + + return AggregationResult; + })(); + + v1.Document = (function() { + + /** + * Properties of a Document. + * @memberof google.firestore.v1 + * @interface IDocument + * @property {string|null} [name] Document name + * @property {Object.|null} [fields] Document fields + * @property {google.protobuf.ITimestamp|null} [createTime] Document createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Document updateTime + */ + + /** + * Constructs a new Document. + * @memberof google.firestore.v1 + * @classdesc Represents a Document. + * @implements IDocument + * @constructor + * @param {google.firestore.v1.IDocument=} [properties] Properties to set + */ + function Document(properties) { + this.fields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Document name. + * @member {string} name + * @memberof google.firestore.v1.Document + * @instance + */ + Document.prototype.name = ""; + + /** + * Document fields. + * @member {Object.} fields + * @memberof google.firestore.v1.Document + * @instance + */ + Document.prototype.fields = $util.emptyObject; + + /** + * Document createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.firestore.v1.Document + * @instance + */ + Document.prototype.createTime = null; + + /** + * Document updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.firestore.v1.Document + * @instance + */ + Document.prototype.updateTime = null; + + /** + * Creates a new Document instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Document + * @static + * @param {google.firestore.v1.IDocument=} [properties] Properties to set + * @returns {google.firestore.v1.Document} Document instance + */ + Document.create = function create(properties) { + return new Document(properties); + }; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.firestore.v1.Document.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Document + * @static + * @param {google.firestore.v1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) + for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.firestore.v1.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); + } + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.firestore.v1.Document.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Document + * @static + * @param {google.firestore.v1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Document message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Document(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.fields, key); + message.fields[key] = value; + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Document message. + * @function verify + * @memberof google.firestore.v1.Document + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Document.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { + if (!$util.isObject(message.fields)) + return "fields: object expected"; + var key = Object.keys(message.fields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.fields[key[i]], long + 1); + if (error) + return "fields." + error; + } + } + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime, long + 1); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime, long + 1); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Document + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Document} Document + */ + Document.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Document) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Document: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Document(); + if (object.name != null) + message.name = String(object.name); + if (object.fields) { + if (!$util.isObject(object.fields)) + throw TypeError(".google.firestore.v1.Document.fields: object expected"); + message.fields = {}; + for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.fields, keys[i]); + if (!$util.isObject(object.fields[keys[i]])) + throw TypeError(".google.firestore.v1.Document.fields: object expected"); + message.fields[keys[i]] = $root.google.firestore.v1.Value.fromObject(object.fields[keys[i]], long + 1); + } + } + if (object.createTime != null) { + if (!$util.isObject(object.createTime)) + throw TypeError(".google.firestore.v1.Document.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime, long + 1); + } + if (object.updateTime != null) { + if (!$util.isObject(object.updateTime)) + throw TypeError(".google.firestore.v1.Document.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Document + * @static + * @param {google.firestore.v1.Document} message Document + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Document.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.fields = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + var keys2; + if (message.fields && (keys2 = Object.keys(message.fields)).length) { + object.fields = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.fields, keys2[j]); + object.fields[keys2[j]] = $root.google.firestore.v1.Value.toObject(message.fields[keys2[j]], options, q + 1); + } + } + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options, q + 1); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options, q + 1); + return object; + }; + + /** + * Converts this Document to JSON. + * @function toJSON + * @memberof google.firestore.v1.Document + * @instance + * @returns {Object.} JSON object + */ + Document.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Document + * @function getTypeUrl + * @memberof google.firestore.v1.Document + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Document"; + }; + + return Document; + })(); + + v1.Value = (function() { + + /** + * Properties of a Value. + * @memberof google.firestore.v1 + * @interface IValue + * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue + * @property {boolean|null} [booleanValue] Value booleanValue + * @property {number|Long|null} [integerValue] Value integerValue + * @property {number|null} [doubleValue] Value doubleValue + * @property {google.protobuf.ITimestamp|null} [timestampValue] Value timestampValue + * @property {string|null} [stringValue] Value stringValue + * @property {Uint8Array|null} [bytesValue] Value bytesValue + * @property {string|null} [referenceValue] Value referenceValue + * @property {google.type.ILatLng|null} [geoPointValue] Value geoPointValue + * @property {google.firestore.v1.IArrayValue|null} [arrayValue] Value arrayValue + * @property {google.firestore.v1.IMapValue|null} [mapValue] Value mapValue + * @property {string|null} [fieldReferenceValue] Value fieldReferenceValue + * @property {string|null} [variableReferenceValue] Value variableReferenceValue + * @property {google.firestore.v1.IFunction|null} [functionValue] Value functionValue + * @property {google.firestore.v1.IPipeline|null} [pipelineValue] Value pipelineValue + */ + + /** + * Constructs a new Value. + * @memberof google.firestore.v1 + * @classdesc Represents a Value. + * @implements IValue + * @constructor + * @param {google.firestore.v1.IValue=} [properties] Properties to set + */ + function Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Value nullValue. + * @member {google.protobuf.NullValue|null|undefined} nullValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.nullValue = null; + + /** + * Value booleanValue. + * @member {boolean|null|undefined} booleanValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.booleanValue = null; + + /** + * Value integerValue. + * @member {number|Long|null|undefined} integerValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.integerValue = null; + + /** + * Value doubleValue. + * @member {number|null|undefined} doubleValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.doubleValue = null; + + /** + * Value timestampValue. + * @member {google.protobuf.ITimestamp|null|undefined} timestampValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.timestampValue = null; + + /** + * Value stringValue. + * @member {string|null|undefined} stringValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.stringValue = null; + + /** + * Value bytesValue. + * @member {Uint8Array|null|undefined} bytesValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.bytesValue = null; + + /** + * Value referenceValue. + * @member {string|null|undefined} referenceValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.referenceValue = null; + + /** + * Value geoPointValue. + * @member {google.type.ILatLng|null|undefined} geoPointValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.geoPointValue = null; + + /** + * Value arrayValue. + * @member {google.firestore.v1.IArrayValue|null|undefined} arrayValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.arrayValue = null; + + /** + * Value mapValue. + * @member {google.firestore.v1.IMapValue|null|undefined} mapValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.mapValue = null; + + /** + * Value fieldReferenceValue. + * @member {string|null|undefined} fieldReferenceValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.fieldReferenceValue = null; + + /** + * Value variableReferenceValue. + * @member {string|null|undefined} variableReferenceValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.variableReferenceValue = null; + + /** + * Value functionValue. + * @member {google.firestore.v1.IFunction|null|undefined} functionValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.functionValue = null; + + /** + * Value pipelineValue. + * @member {google.firestore.v1.IPipeline|null|undefined} pipelineValue + * @memberof google.firestore.v1.Value + * @instance + */ + Value.prototype.pipelineValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Value valueType. + * @member {"nullValue"|"booleanValue"|"integerValue"|"doubleValue"|"timestampValue"|"stringValue"|"bytesValue"|"referenceValue"|"geoPointValue"|"arrayValue"|"mapValue"|"fieldReferenceValue"|"variableReferenceValue"|"functionValue"|"pipelineValue"|undefined} valueType + * @memberof google.firestore.v1.Value + * @instance + */ + Object.defineProperty(Value.prototype, "valueType", { + get: $util.oneOfGetter($oneOfFields = ["nullValue", "booleanValue", "integerValue", "doubleValue", "timestampValue", "stringValue", "bytesValue", "referenceValue", "geoPointValue", "arrayValue", "mapValue", "fieldReferenceValue", "variableReferenceValue", "functionValue", "pipelineValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Value instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Value + * @static + * @param {google.firestore.v1.IValue=} [properties] Properties to set + * @returns {google.firestore.v1.Value} Value instance + */ + Value.create = function create(properties) { + return new Value(properties); + }; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.firestore.v1.Value.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Value + * @static + * @param {google.firestore.v1.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.booleanValue); + if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.integerValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.doubleValue); + if (message.referenceValue != null && Object.hasOwnProperty.call(message, "referenceValue")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.referenceValue); + if (message.mapValue != null && Object.hasOwnProperty.call(message, "mapValue")) + $root.google.firestore.v1.MapValue.encode(message.mapValue, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.geoPointValue != null && Object.hasOwnProperty.call(message, "geoPointValue")) + $root.google.type.LatLng.encode(message.geoPointValue, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue")) + $root.google.firestore.v1.ArrayValue.encode(message.arrayValue, writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); + if (message.timestampValue != null && Object.hasOwnProperty.call(message, "timestampValue")) + $root.google.protobuf.Timestamp.encode(message.timestampValue, writer.uint32(/* id 10, wireType 2 =*/82).fork(), q + 1).ldelim(); + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.nullValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.stringValue); + if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue")) + writer.uint32(/* id 18, wireType 2 =*/146).bytes(message.bytesValue); + if (message.fieldReferenceValue != null && Object.hasOwnProperty.call(message, "fieldReferenceValue")) + writer.uint32(/* id 19, wireType 2 =*/154).string(message.fieldReferenceValue); + if (message.functionValue != null && Object.hasOwnProperty.call(message, "functionValue")) + $root.google.firestore.v1.Function.encode(message.functionValue, writer.uint32(/* id 20, wireType 2 =*/162).fork(), q + 1).ldelim(); + if (message.pipelineValue != null && Object.hasOwnProperty.call(message, "pipelineValue")) + $root.google.firestore.v1.Pipeline.encode(message.pipelineValue, writer.uint32(/* id 21, wireType 2 =*/170).fork(), q + 1).ldelim(); + if (message.variableReferenceValue != null && Object.hasOwnProperty.call(message, "variableReferenceValue")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.variableReferenceValue); + return writer; + }; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.firestore.v1.Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Value + * @static + * @param {google.firestore.v1.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Value message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 11: { + message.nullValue = reader.int32(); + break; + } + case 1: { + message.booleanValue = reader.bool(); + break; + } + case 2: { + message.integerValue = reader.int64(); + break; + } + case 3: { + message.doubleValue = reader.double(); + break; + } + case 10: { + message.timestampValue = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 17: { + message.stringValue = reader.string(); + break; + } + case 18: { + message.bytesValue = reader.bytes(); + break; + } + case 5: { + message.referenceValue = reader.string(); + break; + } + case 8: { + message.geoPointValue = $root.google.type.LatLng.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 9: { + message.arrayValue = $root.google.firestore.v1.ArrayValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.mapValue = $root.google.firestore.v1.MapValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 19: { + message.fieldReferenceValue = reader.string(); + break; + } + case 22: { + message.variableReferenceValue = reader.string(); + break; + } + case 20: { + message.functionValue = $root.google.firestore.v1.Function.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 21: { + message.pipelineValue = $root.google.firestore.v1.Pipeline.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Value message. + * @function verify + * @memberof google.firestore.v1.Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Value.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) { + properties.valueType = 1; + switch (message.nullValue) { + default: + return "nullValue: enum value expected"; + case 0: + break; + } + } + if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (typeof message.booleanValue !== "boolean") + return "booleanValue: boolean expected"; + } + if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!$util.isInteger(message.integerValue) && !(message.integerValue && $util.isInteger(message.integerValue.low) && $util.isInteger(message.integerValue.high))) + return "integerValue: integer|Long expected"; + } + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + } + if (message.timestampValue != null && Object.hasOwnProperty.call(message, "timestampValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.timestampValue, long + 1); + if (error) + return "timestampValue." + error; + } + } + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!$util.isString(message.stringValue)) + return "stringValue: string expected"; + } + if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!(message.bytesValue && typeof message.bytesValue.length === "number" || $util.isString(message.bytesValue))) + return "bytesValue: buffer expected"; + } + if (message.referenceValue != null && Object.hasOwnProperty.call(message, "referenceValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!$util.isString(message.referenceValue)) + return "referenceValue: string expected"; + } + if (message.geoPointValue != null && Object.hasOwnProperty.call(message, "geoPointValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.type.LatLng.verify(message.geoPointValue, long + 1); + if (error) + return "geoPointValue." + error; + } + } + if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.firestore.v1.ArrayValue.verify(message.arrayValue, long + 1); + if (error) + return "arrayValue." + error; + } + } + if (message.mapValue != null && Object.hasOwnProperty.call(message, "mapValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.firestore.v1.MapValue.verify(message.mapValue, long + 1); + if (error) + return "mapValue." + error; + } + } + if (message.fieldReferenceValue != null && Object.hasOwnProperty.call(message, "fieldReferenceValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!$util.isString(message.fieldReferenceValue)) + return "fieldReferenceValue: string expected"; + } + if (message.variableReferenceValue != null && Object.hasOwnProperty.call(message, "variableReferenceValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!$util.isString(message.variableReferenceValue)) + return "variableReferenceValue: string expected"; + } + if (message.functionValue != null && Object.hasOwnProperty.call(message, "functionValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.firestore.v1.Function.verify(message.functionValue, long + 1); + if (error) + return "functionValue." + error; + } + } + if (message.pipelineValue != null && Object.hasOwnProperty.call(message, "pipelineValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.firestore.v1.Pipeline.verify(message.pipelineValue, long + 1); + if (error) + return "pipelineValue." + error; + } + } + return null; + }; + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Value + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Value} Value + */ + Value.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Value) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Value: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Value(); + switch (object.nullValue) { + default: + if (typeof object.nullValue === "number") { + message.nullValue = object.nullValue; + break; + } + break; + case "NULL_VALUE": + case 0: + message.nullValue = 0; + break; + } + if (object.booleanValue != null) + message.booleanValue = Boolean(object.booleanValue); + if (object.integerValue != null) + if ($util.Long) + message.integerValue = $util.Long.fromValue(object.integerValue, false); + else if (typeof object.integerValue === "string") + message.integerValue = parseInt(object.integerValue, 10); + else if (typeof object.integerValue === "number") + message.integerValue = object.integerValue; + else if (typeof object.integerValue === "object") + message.integerValue = new $util.LongBits(object.integerValue.low >>> 0, object.integerValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.timestampValue != null) { + if (!$util.isObject(object.timestampValue)) + throw TypeError(".google.firestore.v1.Value.timestampValue: object expected"); + message.timestampValue = $root.google.protobuf.Timestamp.fromObject(object.timestampValue, long + 1); + } + if (object.stringValue != null) + message.stringValue = String(object.stringValue); + if (object.bytesValue != null) + if (typeof object.bytesValue === "string") + $util.base64.decode(object.bytesValue, message.bytesValue = $util.newBuffer($util.base64.length(object.bytesValue)), 0); + else if (object.bytesValue.length >= 0) + message.bytesValue = object.bytesValue; + if (object.referenceValue != null) + message.referenceValue = String(object.referenceValue); + if (object.geoPointValue != null) { + if (!$util.isObject(object.geoPointValue)) + throw TypeError(".google.firestore.v1.Value.geoPointValue: object expected"); + message.geoPointValue = $root.google.type.LatLng.fromObject(object.geoPointValue, long + 1); + } + if (object.arrayValue != null) { + if (!$util.isObject(object.arrayValue)) + throw TypeError(".google.firestore.v1.Value.arrayValue: object expected"); + message.arrayValue = $root.google.firestore.v1.ArrayValue.fromObject(object.arrayValue, long + 1); + } + if (object.mapValue != null) { + if (!$util.isObject(object.mapValue)) + throw TypeError(".google.firestore.v1.Value.mapValue: object expected"); + message.mapValue = $root.google.firestore.v1.MapValue.fromObject(object.mapValue, long + 1); + } + if (object.fieldReferenceValue != null) + message.fieldReferenceValue = String(object.fieldReferenceValue); + if (object.variableReferenceValue != null) + message.variableReferenceValue = String(object.variableReferenceValue); + if (object.functionValue != null) { + if (!$util.isObject(object.functionValue)) + throw TypeError(".google.firestore.v1.Value.functionValue: object expected"); + message.functionValue = $root.google.firestore.v1.Function.fromObject(object.functionValue, long + 1); + } + if (object.pipelineValue != null) { + if (!$util.isObject(object.pipelineValue)) + throw TypeError(".google.firestore.v1.Value.pipelineValue: object expected"); + message.pipelineValue = $root.google.firestore.v1.Pipeline.fromObject(object.pipelineValue, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Value + * @static + * @param {google.firestore.v1.Value} message Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Value.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) { + object.booleanValue = message.booleanValue; + if (options.oneofs) + object.valueType = "booleanValue"; + } + if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue")) { + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.integerValue = typeof message.integerValue === "number" ? BigInt(message.integerValue) : $util.Long.fromBits(message.integerValue.low >>> 0, message.integerValue.high >>> 0, false).toBigInt(); + else if (typeof message.integerValue === "number") + object.integerValue = options.longs === String ? String(message.integerValue) : message.integerValue; + else + object.integerValue = options.longs === String ? $util.Long.prototype.toString.call(message.integerValue) : options.longs === Number ? new $util.LongBits(message.integerValue.low >>> 0, message.integerValue.high >>> 0).toNumber() : message.integerValue; + if (options.oneofs) + object.valueType = "integerValue"; + } + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) { + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (options.oneofs) + object.valueType = "doubleValue"; + } + if (message.referenceValue != null && Object.hasOwnProperty.call(message, "referenceValue")) { + object.referenceValue = message.referenceValue; + if (options.oneofs) + object.valueType = "referenceValue"; + } + if (message.mapValue != null && Object.hasOwnProperty.call(message, "mapValue")) { + object.mapValue = $root.google.firestore.v1.MapValue.toObject(message.mapValue, options, q + 1); + if (options.oneofs) + object.valueType = "mapValue"; + } + if (message.geoPointValue != null && Object.hasOwnProperty.call(message, "geoPointValue")) { + object.geoPointValue = $root.google.type.LatLng.toObject(message.geoPointValue, options, q + 1); + if (options.oneofs) + object.valueType = "geoPointValue"; + } + if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue")) { + object.arrayValue = $root.google.firestore.v1.ArrayValue.toObject(message.arrayValue, options, q + 1); + if (options.oneofs) + object.valueType = "arrayValue"; + } + if (message.timestampValue != null && Object.hasOwnProperty.call(message, "timestampValue")) { + object.timestampValue = $root.google.protobuf.Timestamp.toObject(message.timestampValue, options, q + 1); + if (options.oneofs) + object.valueType = "timestampValue"; + } + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) { + object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; + if (options.oneofs) + object.valueType = "nullValue"; + } + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) { + object.stringValue = message.stringValue; + if (options.oneofs) + object.valueType = "stringValue"; + } + if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue")) { + object.bytesValue = options.bytes === String ? $util.base64.encode(message.bytesValue, 0, message.bytesValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.bytesValue) : message.bytesValue; + if (options.oneofs) + object.valueType = "bytesValue"; + } + if (message.fieldReferenceValue != null && Object.hasOwnProperty.call(message, "fieldReferenceValue")) { + object.fieldReferenceValue = message.fieldReferenceValue; + if (options.oneofs) + object.valueType = "fieldReferenceValue"; + } + if (message.functionValue != null && Object.hasOwnProperty.call(message, "functionValue")) { + object.functionValue = $root.google.firestore.v1.Function.toObject(message.functionValue, options, q + 1); + if (options.oneofs) + object.valueType = "functionValue"; + } + if (message.pipelineValue != null && Object.hasOwnProperty.call(message, "pipelineValue")) { + object.pipelineValue = $root.google.firestore.v1.Pipeline.toObject(message.pipelineValue, options, q + 1); + if (options.oneofs) + object.valueType = "pipelineValue"; + } + if (message.variableReferenceValue != null && Object.hasOwnProperty.call(message, "variableReferenceValue")) { + object.variableReferenceValue = message.variableReferenceValue; + if (options.oneofs) + object.valueType = "variableReferenceValue"; + } + return object; + }; + + /** + * Converts this Value to JSON. + * @function toJSON + * @memberof google.firestore.v1.Value + * @instance + * @returns {Object.} JSON object + */ + Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Value + * @function getTypeUrl + * @memberof google.firestore.v1.Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Value"; + }; + + return Value; + })(); + + v1.ArrayValue = (function() { + + /** + * Properties of an ArrayValue. + * @memberof google.firestore.v1 + * @interface IArrayValue + * @property {Array.|null} [values] ArrayValue values + */ + + /** + * Constructs a new ArrayValue. + * @memberof google.firestore.v1 + * @classdesc Represents an ArrayValue. + * @implements IArrayValue + * @constructor + * @param {google.firestore.v1.IArrayValue=} [properties] Properties to set + */ + function ArrayValue(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ArrayValue values. + * @member {Array.} values + * @memberof google.firestore.v1.ArrayValue + * @instance + */ + ArrayValue.prototype.values = $util.emptyArray; + + /** + * Creates a new ArrayValue instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ArrayValue + * @static + * @param {google.firestore.v1.IArrayValue=} [properties] Properties to set + * @returns {google.firestore.v1.ArrayValue} ArrayValue instance + */ + ArrayValue.create = function create(properties) { + return new ArrayValue(properties); + }; + + /** + * Encodes the specified ArrayValue message. Does not implicitly {@link google.firestore.v1.ArrayValue.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ArrayValue + * @static + * @param {google.firestore.v1.IArrayValue} message ArrayValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArrayValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.firestore.v1.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link google.firestore.v1.ArrayValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ArrayValue + * @static + * @param {google.firestore.v1.IArrayValue} message ArrayValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArrayValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ArrayValue message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ArrayValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ArrayValue} ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArrayValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ArrayValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ArrayValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ArrayValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ArrayValue} ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArrayValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ArrayValue message. + * @function verify + * @memberof google.firestore.v1.ArrayValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ArrayValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.values != null && Object.hasOwnProperty.call(message, "values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.values[i], long + 1); + if (error) + return "values." + error; + } + } + return null; + }; + + /** + * Creates an ArrayValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ArrayValue + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ArrayValue} ArrayValue + */ + ArrayValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ArrayValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ArrayValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ArrayValue(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.firestore.v1.ArrayValue.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (!$util.isObject(object.values[i])) + throw TypeError(".google.firestore.v1.ArrayValue.values: object expected"); + message.values[i] = $root.google.firestore.v1.Value.fromObject(object.values[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from an ArrayValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ArrayValue + * @static + * @param {google.firestore.v1.ArrayValue} message ArrayValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ArrayValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.firestore.v1.Value.toObject(message.values[j], options, q + 1); + } + return object; + }; + + /** + * Converts this ArrayValue to JSON. + * @function toJSON + * @memberof google.firestore.v1.ArrayValue + * @instance + * @returns {Object.} JSON object + */ + ArrayValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ArrayValue + * @function getTypeUrl + * @memberof google.firestore.v1.ArrayValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ArrayValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ArrayValue"; + }; + + return ArrayValue; + })(); + + v1.MapValue = (function() { + + /** + * Properties of a MapValue. + * @memberof google.firestore.v1 + * @interface IMapValue + * @property {Object.|null} [fields] MapValue fields + */ + + /** + * Constructs a new MapValue. + * @memberof google.firestore.v1 + * @classdesc Represents a MapValue. + * @implements IMapValue + * @constructor + * @param {google.firestore.v1.IMapValue=} [properties] Properties to set + */ + function MapValue(properties) { + this.fields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * MapValue fields. + * @member {Object.} fields + * @memberof google.firestore.v1.MapValue + * @instance + */ + MapValue.prototype.fields = $util.emptyObject; + + /** + * Creates a new MapValue instance using the specified properties. + * @function create + * @memberof google.firestore.v1.MapValue + * @static + * @param {google.firestore.v1.IMapValue=} [properties] Properties to set + * @returns {google.firestore.v1.MapValue} MapValue instance + */ + MapValue.create = function create(properties) { + return new MapValue(properties); + }; + + /** + * Encodes the specified MapValue message. Does not implicitly {@link google.firestore.v1.MapValue.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.MapValue + * @static + * @param {google.firestore.v1.IMapValue} message MapValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MapValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) + for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.firestore.v1.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified MapValue message, length delimited. Does not implicitly {@link google.firestore.v1.MapValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.MapValue + * @static + * @param {google.firestore.v1.IMapValue} message MapValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MapValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a MapValue message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.MapValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.MapValue} MapValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MapValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.MapValue(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.fields, key); + message.fields[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a MapValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.MapValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.MapValue} MapValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MapValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MapValue message. + * @function verify + * @memberof google.firestore.v1.MapValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MapValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { + if (!$util.isObject(message.fields)) + return "fields: object expected"; + var key = Object.keys(message.fields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.fields[key[i]], long + 1); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a MapValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.MapValue + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.MapValue} MapValue + */ + MapValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.MapValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.MapValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.MapValue(); + if (object.fields) { + if (!$util.isObject(object.fields)) + throw TypeError(".google.firestore.v1.MapValue.fields: object expected"); + message.fields = {}; + for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.fields, keys[i]); + if (!$util.isObject(object.fields[keys[i]])) + throw TypeError(".google.firestore.v1.MapValue.fields: object expected"); + message.fields[keys[i]] = $root.google.firestore.v1.Value.fromObject(object.fields[keys[i]], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a MapValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.MapValue + * @static + * @param {google.firestore.v1.MapValue} message MapValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MapValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.fields = {}; + var keys2; + if (message.fields && (keys2 = Object.keys(message.fields)).length) { + object.fields = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.fields, keys2[j]); + object.fields[keys2[j]] = $root.google.firestore.v1.Value.toObject(message.fields[keys2[j]], options, q + 1); + } + } + return object; + }; + + /** + * Converts this MapValue to JSON. + * @function toJSON + * @memberof google.firestore.v1.MapValue + * @instance + * @returns {Object.} JSON object + */ + MapValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MapValue + * @function getTypeUrl + * @memberof google.firestore.v1.MapValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MapValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.MapValue"; + }; + + return MapValue; + })(); + + v1.Function = (function() { + + /** + * Properties of a Function. + * @memberof google.firestore.v1 + * @interface IFunction + * @property {string|null} [name] Function name + * @property {Array.|null} [args] Function args + * @property {Object.|null} [options] Function options + */ + + /** + * Constructs a new Function. + * @memberof google.firestore.v1 + * @classdesc Represents a Function. + * @implements IFunction + * @constructor + * @param {google.firestore.v1.IFunction=} [properties] Properties to set + */ + function Function(properties) { + this.args = []; + this.options = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Function name. + * @member {string} name + * @memberof google.firestore.v1.Function + * @instance + */ + Function.prototype.name = ""; + + /** + * Function args. + * @member {Array.} args + * @memberof google.firestore.v1.Function + * @instance + */ + Function.prototype.args = $util.emptyArray; + + /** + * Function options. + * @member {Object.} options + * @memberof google.firestore.v1.Function + * @instance + */ + Function.prototype.options = $util.emptyObject; + + /** + * Creates a new Function instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Function + * @static + * @param {google.firestore.v1.IFunction=} [properties] Properties to set + * @returns {google.firestore.v1.Function} Function instance + */ + Function.create = function create(properties) { + return new Function(properties); + }; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.firestore.v1.Function.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Function + * @static + * @param {google.firestore.v1.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.args != null && message.args.length) + for (var i = 0; i < message.args.length; ++i) + $root.google.firestore.v1.Value.encode(message.args[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + for (var keys = Object.keys(message.options), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.firestore.v1.Value.encode(message.options[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.firestore.v1.Function.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Function + * @static + * @param {google.firestore.v1.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Function message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Function(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.args && message.args.length)) + message.args = []; + message.args.push($root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + if (message.options === $util.emptyObject) + message.options = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.options, key); + message.options[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Function message. + * @function verify + * @memberof google.firestore.v1.Function + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Function.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.args != null && Object.hasOwnProperty.call(message, "args")) { + if (!Array.isArray(message.args)) + return "args: array expected"; + for (var i = 0; i < message.args.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.args[i], long + 1); + if (error) + return "args." + error; + } + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + if (!$util.isObject(message.options)) + return "options: object expected"; + var key = Object.keys(message.options); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.options[key[i]], long + 1); + if (error) + return "options." + error; + } + } + return null; + }; + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Function + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Function} Function + */ + Function.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Function) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Function: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Function(); + if (object.name != null) + message.name = String(object.name); + if (object.args) { + if (!Array.isArray(object.args)) + throw TypeError(".google.firestore.v1.Function.args: array expected"); + message.args = []; + for (var i = 0; i < object.args.length; ++i) { + if (!$util.isObject(object.args[i])) + throw TypeError(".google.firestore.v1.Function.args: object expected"); + message.args[i] = $root.google.firestore.v1.Value.fromObject(object.args[i], long + 1); + } + } + if (object.options) { + if (!$util.isObject(object.options)) + throw TypeError(".google.firestore.v1.Function.options: object expected"); + message.options = {}; + for (var keys = Object.keys(object.options), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.options, keys[i]); + if (!$util.isObject(object.options[keys[i]])) + throw TypeError(".google.firestore.v1.Function.options: object expected"); + message.options[keys[i]] = $root.google.firestore.v1.Value.fromObject(object.options[keys[i]], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Function + * @static + * @param {google.firestore.v1.Function} message Function + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Function.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.args = []; + if (options.objects || options.defaults) + object.options = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.args && message.args.length) { + object.args = []; + for (var j = 0; j < message.args.length; ++j) + object.args[j] = $root.google.firestore.v1.Value.toObject(message.args[j], options, q + 1); + } + var keys2; + if (message.options && (keys2 = Object.keys(message.options)).length) { + object.options = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.options, keys2[j]); + object.options[keys2[j]] = $root.google.firestore.v1.Value.toObject(message.options[keys2[j]], options, q + 1); + } + } + return object; + }; + + /** + * Converts this Function to JSON. + * @function toJSON + * @memberof google.firestore.v1.Function + * @instance + * @returns {Object.} JSON object + */ + Function.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Function + * @function getTypeUrl + * @memberof google.firestore.v1.Function + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Function.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Function"; + }; + + return Function; + })(); + + v1.Pipeline = (function() { + + /** + * Properties of a Pipeline. + * @memberof google.firestore.v1 + * @interface IPipeline + * @property {Array.|null} [stages] Pipeline stages + */ + + /** + * Constructs a new Pipeline. + * @memberof google.firestore.v1 + * @classdesc Represents a Pipeline. + * @implements IPipeline + * @constructor + * @param {google.firestore.v1.IPipeline=} [properties] Properties to set + */ + function Pipeline(properties) { + this.stages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Pipeline stages. + * @member {Array.} stages + * @memberof google.firestore.v1.Pipeline + * @instance + */ + Pipeline.prototype.stages = $util.emptyArray; + + /** + * Creates a new Pipeline instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Pipeline + * @static + * @param {google.firestore.v1.IPipeline=} [properties] Properties to set + * @returns {google.firestore.v1.Pipeline} Pipeline instance + */ + Pipeline.create = function create(properties) { + return new Pipeline(properties); + }; + + /** + * Encodes the specified Pipeline message. Does not implicitly {@link google.firestore.v1.Pipeline.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Pipeline + * @static + * @param {google.firestore.v1.IPipeline} message Pipeline message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pipeline.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.stages != null && message.stages.length) + for (var i = 0; i < message.stages.length; ++i) + $root.google.firestore.v1.Pipeline.Stage.encode(message.stages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Pipeline message, length delimited. Does not implicitly {@link google.firestore.v1.Pipeline.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Pipeline + * @static + * @param {google.firestore.v1.IPipeline} message Pipeline message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pipeline.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Pipeline message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Pipeline + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Pipeline} Pipeline + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pipeline.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Pipeline(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.stages && message.stages.length)) + message.stages = []; + message.stages.push($root.google.firestore.v1.Pipeline.Stage.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Pipeline message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Pipeline + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Pipeline} Pipeline + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pipeline.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Pipeline message. + * @function verify + * @memberof google.firestore.v1.Pipeline + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Pipeline.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.stages != null && Object.hasOwnProperty.call(message, "stages")) { + if (!Array.isArray(message.stages)) + return "stages: array expected"; + for (var i = 0; i < message.stages.length; ++i) { + var error = $root.google.firestore.v1.Pipeline.Stage.verify(message.stages[i], long + 1); + if (error) + return "stages." + error; + } + } + return null; + }; + + /** + * Creates a Pipeline message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Pipeline + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Pipeline} Pipeline + */ + Pipeline.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Pipeline) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Pipeline: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Pipeline(); + if (object.stages) { + if (!Array.isArray(object.stages)) + throw TypeError(".google.firestore.v1.Pipeline.stages: array expected"); + message.stages = []; + for (var i = 0; i < object.stages.length; ++i) { + if (!$util.isObject(object.stages[i])) + throw TypeError(".google.firestore.v1.Pipeline.stages: object expected"); + message.stages[i] = $root.google.firestore.v1.Pipeline.Stage.fromObject(object.stages[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a Pipeline message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Pipeline + * @static + * @param {google.firestore.v1.Pipeline} message Pipeline + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Pipeline.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.stages = []; + if (message.stages && message.stages.length) { + object.stages = []; + for (var j = 0; j < message.stages.length; ++j) + object.stages[j] = $root.google.firestore.v1.Pipeline.Stage.toObject(message.stages[j], options, q + 1); + } + return object; + }; + + /** + * Converts this Pipeline to JSON. + * @function toJSON + * @memberof google.firestore.v1.Pipeline + * @instance + * @returns {Object.} JSON object + */ + Pipeline.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Pipeline + * @function getTypeUrl + * @memberof google.firestore.v1.Pipeline + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Pipeline.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Pipeline"; + }; + + Pipeline.Stage = (function() { + + /** + * Properties of a Stage. + * @memberof google.firestore.v1.Pipeline + * @interface IStage + * @property {string|null} [name] Stage name + * @property {Array.|null} [args] Stage args + * @property {Object.|null} [options] Stage options + */ + + /** + * Constructs a new Stage. + * @memberof google.firestore.v1.Pipeline + * @classdesc Represents a Stage. + * @implements IStage + * @constructor + * @param {google.firestore.v1.Pipeline.IStage=} [properties] Properties to set + */ + function Stage(properties) { + this.args = []; + this.options = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Stage name. + * @member {string} name + * @memberof google.firestore.v1.Pipeline.Stage + * @instance + */ + Stage.prototype.name = ""; + + /** + * Stage args. + * @member {Array.} args + * @memberof google.firestore.v1.Pipeline.Stage + * @instance + */ + Stage.prototype.args = $util.emptyArray; + + /** + * Stage options. + * @member {Object.} options + * @memberof google.firestore.v1.Pipeline.Stage + * @instance + */ + Stage.prototype.options = $util.emptyObject; + + /** + * Creates a new Stage instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Pipeline.Stage + * @static + * @param {google.firestore.v1.Pipeline.IStage=} [properties] Properties to set + * @returns {google.firestore.v1.Pipeline.Stage} Stage instance + */ + Stage.create = function create(properties) { + return new Stage(properties); + }; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.firestore.v1.Pipeline.Stage.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Pipeline.Stage + * @static + * @param {google.firestore.v1.Pipeline.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.args != null && message.args.length) + for (var i = 0; i < message.args.length; ++i) + $root.google.firestore.v1.Value.encode(message.args[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + for (var keys = Object.keys(message.options), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.firestore.v1.Value.encode(message.options[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.firestore.v1.Pipeline.Stage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Pipeline.Stage + * @static + * @param {google.firestore.v1.Pipeline.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Pipeline.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Pipeline.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Pipeline.Stage(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.args && message.args.length)) + message.args = []; + message.args.push($root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + if (message.options === $util.emptyObject) + message.options = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.options, key); + message.options[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Pipeline.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Pipeline.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Stage message. + * @function verify + * @memberof google.firestore.v1.Pipeline.Stage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Stage.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.args != null && Object.hasOwnProperty.call(message, "args")) { + if (!Array.isArray(message.args)) + return "args: array expected"; + for (var i = 0; i < message.args.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.args[i], long + 1); + if (error) + return "args." + error; + } + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + if (!$util.isObject(message.options)) + return "options: object expected"; + var key = Object.keys(message.options); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.options[key[i]], long + 1); + if (error) + return "options." + error; + } + } + return null; + }; + + /** + * Creates a Stage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Pipeline.Stage + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Pipeline.Stage} Stage + */ + Stage.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Pipeline.Stage) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Pipeline.Stage: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Pipeline.Stage(); + if (object.name != null) + message.name = String(object.name); + if (object.args) { + if (!Array.isArray(object.args)) + throw TypeError(".google.firestore.v1.Pipeline.Stage.args: array expected"); + message.args = []; + for (var i = 0; i < object.args.length; ++i) { + if (!$util.isObject(object.args[i])) + throw TypeError(".google.firestore.v1.Pipeline.Stage.args: object expected"); + message.args[i] = $root.google.firestore.v1.Value.fromObject(object.args[i], long + 1); + } + } + if (object.options) { + if (!$util.isObject(object.options)) + throw TypeError(".google.firestore.v1.Pipeline.Stage.options: object expected"); + message.options = {}; + for (var keys = Object.keys(object.options), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.options, keys[i]); + if (!$util.isObject(object.options[keys[i]])) + throw TypeError(".google.firestore.v1.Pipeline.Stage.options: object expected"); + message.options[keys[i]] = $root.google.firestore.v1.Value.fromObject(object.options[keys[i]], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Pipeline.Stage + * @static + * @param {google.firestore.v1.Pipeline.Stage} message Stage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Stage.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.args = []; + if (options.objects || options.defaults) + object.options = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.args && message.args.length) { + object.args = []; + for (var j = 0; j < message.args.length; ++j) + object.args[j] = $root.google.firestore.v1.Value.toObject(message.args[j], options, q + 1); + } + var keys2; + if (message.options && (keys2 = Object.keys(message.options)).length) { + object.options = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.options, keys2[j]); + object.options[keys2[j]] = $root.google.firestore.v1.Value.toObject(message.options[keys2[j]], options, q + 1); + } + } + return object; + }; + + /** + * Converts this Stage to JSON. + * @function toJSON + * @memberof google.firestore.v1.Pipeline.Stage + * @instance + * @returns {Object.} JSON object + */ + Stage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Stage + * @function getTypeUrl + * @memberof google.firestore.v1.Pipeline.Stage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Stage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Pipeline.Stage"; + }; + + return Stage; + })(); + + return Pipeline; + })(); + + v1.BitSequence = (function() { + + /** + * Properties of a BitSequence. + * @memberof google.firestore.v1 + * @interface IBitSequence + * @property {Uint8Array|null} [bitmap] BitSequence bitmap + * @property {number|null} [padding] BitSequence padding + */ + + /** + * Constructs a new BitSequence. + * @memberof google.firestore.v1 + * @classdesc Represents a BitSequence. + * @implements IBitSequence + * @constructor + * @param {google.firestore.v1.IBitSequence=} [properties] Properties to set + */ + function BitSequence(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BitSequence bitmap. + * @member {Uint8Array} bitmap + * @memberof google.firestore.v1.BitSequence + * @instance + */ + BitSequence.prototype.bitmap = $util.newBuffer([]); + + /** + * BitSequence padding. + * @member {number} padding + * @memberof google.firestore.v1.BitSequence + * @instance + */ + BitSequence.prototype.padding = 0; + + /** + * Creates a new BitSequence instance using the specified properties. + * @function create + * @memberof google.firestore.v1.BitSequence + * @static + * @param {google.firestore.v1.IBitSequence=} [properties] Properties to set + * @returns {google.firestore.v1.BitSequence} BitSequence instance + */ + BitSequence.create = function create(properties) { + return new BitSequence(properties); + }; + + /** + * Encodes the specified BitSequence message. Does not implicitly {@link google.firestore.v1.BitSequence.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.BitSequence + * @static + * @param {google.firestore.v1.IBitSequence} message BitSequence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BitSequence.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.bitmap != null && Object.hasOwnProperty.call(message, "bitmap")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.bitmap); + if (message.padding != null && Object.hasOwnProperty.call(message, "padding")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.padding); + return writer; + }; + + /** + * Encodes the specified BitSequence message, length delimited. Does not implicitly {@link google.firestore.v1.BitSequence.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.BitSequence + * @static + * @param {google.firestore.v1.IBitSequence} message BitSequence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BitSequence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BitSequence message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.BitSequence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.BitSequence} BitSequence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BitSequence.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.BitSequence(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.bitmap = reader.bytes(); + break; + } + case 2: { + message.padding = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BitSequence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.BitSequence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.BitSequence} BitSequence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BitSequence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BitSequence message. + * @function verify + * @memberof google.firestore.v1.BitSequence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BitSequence.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.bitmap != null && Object.hasOwnProperty.call(message, "bitmap")) + if (!(message.bitmap && typeof message.bitmap.length === "number" || $util.isString(message.bitmap))) + return "bitmap: buffer expected"; + if (message.padding != null && Object.hasOwnProperty.call(message, "padding")) + if (!$util.isInteger(message.padding)) + return "padding: integer expected"; + return null; + }; + + /** + * Creates a BitSequence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.BitSequence + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.BitSequence} BitSequence + */ + BitSequence.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.BitSequence) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.BitSequence: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.BitSequence(); + if (object.bitmap != null) + if (typeof object.bitmap === "string") + $util.base64.decode(object.bitmap, message.bitmap = $util.newBuffer($util.base64.length(object.bitmap)), 0); + else if (object.bitmap.length >= 0) + message.bitmap = object.bitmap; + if (object.padding != null) + message.padding = object.padding | 0; + return message; + }; + + /** + * Creates a plain object from a BitSequence message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.BitSequence + * @static + * @param {google.firestore.v1.BitSequence} message BitSequence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BitSequence.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.bitmap = ""; + else { + object.bitmap = []; + if (options.bytes !== Array) + object.bitmap = $util.newBuffer(object.bitmap); + } + object.padding = 0; + } + if (message.bitmap != null && Object.hasOwnProperty.call(message, "bitmap")) + object.bitmap = options.bytes === String ? $util.base64.encode(message.bitmap, 0, message.bitmap.length) : options.bytes === Array ? Array.prototype.slice.call(message.bitmap) : message.bitmap; + if (message.padding != null && Object.hasOwnProperty.call(message, "padding")) + object.padding = message.padding; + return object; + }; + + /** + * Converts this BitSequence to JSON. + * @function toJSON + * @memberof google.firestore.v1.BitSequence + * @instance + * @returns {Object.} JSON object + */ + BitSequence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BitSequence + * @function getTypeUrl + * @memberof google.firestore.v1.BitSequence + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BitSequence.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.BitSequence"; + }; + + return BitSequence; + })(); + + v1.BloomFilter = (function() { + + /** + * Properties of a BloomFilter. + * @memberof google.firestore.v1 + * @interface IBloomFilter + * @property {google.firestore.v1.IBitSequence|null} [bits] BloomFilter bits + * @property {number|null} [hashCount] BloomFilter hashCount + */ + + /** + * Constructs a new BloomFilter. + * @memberof google.firestore.v1 + * @classdesc Represents a BloomFilter. + * @implements IBloomFilter + * @constructor + * @param {google.firestore.v1.IBloomFilter=} [properties] Properties to set + */ + function BloomFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BloomFilter bits. + * @member {google.firestore.v1.IBitSequence|null|undefined} bits + * @memberof google.firestore.v1.BloomFilter + * @instance + */ + BloomFilter.prototype.bits = null; + + /** + * BloomFilter hashCount. + * @member {number} hashCount + * @memberof google.firestore.v1.BloomFilter + * @instance + */ + BloomFilter.prototype.hashCount = 0; + + /** + * Creates a new BloomFilter instance using the specified properties. + * @function create + * @memberof google.firestore.v1.BloomFilter + * @static + * @param {google.firestore.v1.IBloomFilter=} [properties] Properties to set + * @returns {google.firestore.v1.BloomFilter} BloomFilter instance + */ + BloomFilter.create = function create(properties) { + return new BloomFilter(properties); + }; + + /** + * Encodes the specified BloomFilter message. Does not implicitly {@link google.firestore.v1.BloomFilter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.BloomFilter + * @static + * @param {google.firestore.v1.IBloomFilter} message BloomFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BloomFilter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.bits != null && Object.hasOwnProperty.call(message, "bits")) + $root.google.firestore.v1.BitSequence.encode(message.bits, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.hashCount != null && Object.hasOwnProperty.call(message, "hashCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.hashCount); + return writer; + }; + + /** + * Encodes the specified BloomFilter message, length delimited. Does not implicitly {@link google.firestore.v1.BloomFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.BloomFilter + * @static + * @param {google.firestore.v1.IBloomFilter} message BloomFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BloomFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BloomFilter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.BloomFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.BloomFilter} BloomFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BloomFilter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.BloomFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.bits = $root.google.firestore.v1.BitSequence.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.hashCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BloomFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.BloomFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.BloomFilter} BloomFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BloomFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BloomFilter message. + * @function verify + * @memberof google.firestore.v1.BloomFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BloomFilter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.bits != null && Object.hasOwnProperty.call(message, "bits")) { + var error = $root.google.firestore.v1.BitSequence.verify(message.bits, long + 1); + if (error) + return "bits." + error; + } + if (message.hashCount != null && Object.hasOwnProperty.call(message, "hashCount")) + if (!$util.isInteger(message.hashCount)) + return "hashCount: integer expected"; + return null; + }; + + /** + * Creates a BloomFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.BloomFilter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.BloomFilter} BloomFilter + */ + BloomFilter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.BloomFilter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.BloomFilter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.BloomFilter(); + if (object.bits != null) { + if (!$util.isObject(object.bits)) + throw TypeError(".google.firestore.v1.BloomFilter.bits: object expected"); + message.bits = $root.google.firestore.v1.BitSequence.fromObject(object.bits, long + 1); + } + if (object.hashCount != null) + message.hashCount = object.hashCount | 0; + return message; + }; + + /** + * Creates a plain object from a BloomFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.BloomFilter + * @static + * @param {google.firestore.v1.BloomFilter} message BloomFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BloomFilter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.bits = null; + object.hashCount = 0; + } + if (message.bits != null && Object.hasOwnProperty.call(message, "bits")) + object.bits = $root.google.firestore.v1.BitSequence.toObject(message.bits, options, q + 1); + if (message.hashCount != null && Object.hasOwnProperty.call(message, "hashCount")) + object.hashCount = message.hashCount; + return object; + }; + + /** + * Converts this BloomFilter to JSON. + * @function toJSON + * @memberof google.firestore.v1.BloomFilter + * @instance + * @returns {Object.} JSON object + */ + BloomFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BloomFilter + * @function getTypeUrl + * @memberof google.firestore.v1.BloomFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BloomFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.BloomFilter"; + }; + + return BloomFilter; + })(); + + v1.DocumentMask = (function() { + + /** + * Properties of a DocumentMask. + * @memberof google.firestore.v1 + * @interface IDocumentMask + * @property {Array.|null} [fieldPaths] DocumentMask fieldPaths + */ + + /** + * Constructs a new DocumentMask. + * @memberof google.firestore.v1 + * @classdesc Represents a DocumentMask. + * @implements IDocumentMask + * @constructor + * @param {google.firestore.v1.IDocumentMask=} [properties] Properties to set + */ + function DocumentMask(properties) { + this.fieldPaths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentMask fieldPaths. + * @member {Array.} fieldPaths + * @memberof google.firestore.v1.DocumentMask + * @instance + */ + DocumentMask.prototype.fieldPaths = $util.emptyArray; + + /** + * Creates a new DocumentMask instance using the specified properties. + * @function create + * @memberof google.firestore.v1.DocumentMask + * @static + * @param {google.firestore.v1.IDocumentMask=} [properties] Properties to set + * @returns {google.firestore.v1.DocumentMask} DocumentMask instance + */ + DocumentMask.create = function create(properties) { + return new DocumentMask(properties); + }; + + /** + * Encodes the specified DocumentMask message. Does not implicitly {@link google.firestore.v1.DocumentMask.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.DocumentMask + * @static + * @param {google.firestore.v1.IDocumentMask} message DocumentMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentMask.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fieldPaths != null && message.fieldPaths.length) + for (var i = 0; i < message.fieldPaths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fieldPaths[i]); + return writer; + }; + + /** + * Encodes the specified DocumentMask message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.DocumentMask + * @static + * @param {google.firestore.v1.IDocumentMask} message DocumentMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentMask message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.DocumentMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.DocumentMask} DocumentMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentMask.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.DocumentMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.fieldPaths && message.fieldPaths.length)) + message.fieldPaths = []; + message.fieldPaths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.DocumentMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.DocumentMask} DocumentMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentMask message. + * @function verify + * @memberof google.firestore.v1.DocumentMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentMask.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fieldPaths != null && Object.hasOwnProperty.call(message, "fieldPaths")) { + if (!Array.isArray(message.fieldPaths)) + return "fieldPaths: array expected"; + for (var i = 0; i < message.fieldPaths.length; ++i) + if (!$util.isString(message.fieldPaths[i])) + return "fieldPaths: string[] expected"; + } + return null; + }; + + /** + * Creates a DocumentMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.DocumentMask + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.DocumentMask} DocumentMask + */ + DocumentMask.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.DocumentMask) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.DocumentMask: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.DocumentMask(); + if (object.fieldPaths) { + if (!Array.isArray(object.fieldPaths)) + throw TypeError(".google.firestore.v1.DocumentMask.fieldPaths: array expected"); + message.fieldPaths = []; + for (var i = 0; i < object.fieldPaths.length; ++i) + message.fieldPaths[i] = String(object.fieldPaths[i]); + } + return message; + }; + + /** + * Creates a plain object from a DocumentMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.DocumentMask + * @static + * @param {google.firestore.v1.DocumentMask} message DocumentMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentMask.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.fieldPaths = []; + if (message.fieldPaths && message.fieldPaths.length) { + object.fieldPaths = []; + for (var j = 0; j < message.fieldPaths.length; ++j) + object.fieldPaths[j] = message.fieldPaths[j]; + } + return object; + }; + + /** + * Converts this DocumentMask to JSON. + * @function toJSON + * @memberof google.firestore.v1.DocumentMask + * @instance + * @returns {Object.} JSON object + */ + DocumentMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentMask + * @function getTypeUrl + * @memberof google.firestore.v1.DocumentMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.DocumentMask"; + }; + + return DocumentMask; + })(); + + v1.Precondition = (function() { + + /** + * Properties of a Precondition. + * @memberof google.firestore.v1 + * @interface IPrecondition + * @property {boolean|null} [exists] Precondition exists + * @property {google.protobuf.ITimestamp|null} [updateTime] Precondition updateTime + */ + + /** + * Constructs a new Precondition. + * @memberof google.firestore.v1 + * @classdesc Represents a Precondition. + * @implements IPrecondition + * @constructor + * @param {google.firestore.v1.IPrecondition=} [properties] Properties to set + */ + function Precondition(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Precondition exists. + * @member {boolean|null|undefined} exists + * @memberof google.firestore.v1.Precondition + * @instance + */ + Precondition.prototype.exists = null; + + /** + * Precondition updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.firestore.v1.Precondition + * @instance + */ + Precondition.prototype.updateTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Precondition conditionType. + * @member {"exists"|"updateTime"|undefined} conditionType + * @memberof google.firestore.v1.Precondition + * @instance + */ + Object.defineProperty(Precondition.prototype, "conditionType", { + get: $util.oneOfGetter($oneOfFields = ["exists", "updateTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Precondition instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Precondition + * @static + * @param {google.firestore.v1.IPrecondition=} [properties] Properties to set + * @returns {google.firestore.v1.Precondition} Precondition instance + */ + Precondition.create = function create(properties) { + return new Precondition(properties); + }; + + /** + * Encodes the specified Precondition message. Does not implicitly {@link google.firestore.v1.Precondition.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Precondition + * @static + * @param {google.firestore.v1.IPrecondition} message Precondition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Precondition.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.exists != null && Object.hasOwnProperty.call(message, "exists")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.exists); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Precondition message, length delimited. Does not implicitly {@link google.firestore.v1.Precondition.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Precondition + * @static + * @param {google.firestore.v1.IPrecondition} message Precondition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Precondition.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Precondition message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Precondition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Precondition} Precondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Precondition.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Precondition(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.exists = reader.bool(); + break; + } + case 2: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Precondition message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Precondition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Precondition} Precondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Precondition.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Precondition message. + * @function verify + * @memberof google.firestore.v1.Precondition + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Precondition.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.exists != null && Object.hasOwnProperty.call(message, "exists")) { + properties.conditionType = 1; + if (typeof message.exists !== "boolean") + return "exists: boolean expected"; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + if (properties.conditionType === 1) + return "conditionType: multiple values"; + properties.conditionType = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime, long + 1); + if (error) + return "updateTime." + error; + } + } + return null; + }; + + /** + * Creates a Precondition message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Precondition + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Precondition} Precondition + */ + Precondition.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Precondition) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Precondition: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Precondition(); + if (object.exists != null) + message.exists = Boolean(object.exists); + if (object.updateTime != null) { + if (!$util.isObject(object.updateTime)) + throw TypeError(".google.firestore.v1.Precondition.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Precondition message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Precondition + * @static + * @param {google.firestore.v1.Precondition} message Precondition + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Precondition.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.exists != null && Object.hasOwnProperty.call(message, "exists")) { + object.exists = message.exists; + if (options.oneofs) + object.conditionType = "exists"; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options, q + 1); + if (options.oneofs) + object.conditionType = "updateTime"; + } + return object; + }; + + /** + * Converts this Precondition to JSON. + * @function toJSON + * @memberof google.firestore.v1.Precondition + * @instance + * @returns {Object.} JSON object + */ + Precondition.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Precondition + * @function getTypeUrl + * @memberof google.firestore.v1.Precondition + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Precondition.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Precondition"; + }; + + return Precondition; + })(); + + v1.TransactionOptions = (function() { + + /** + * Properties of a TransactionOptions. + * @memberof google.firestore.v1 + * @interface ITransactionOptions + * @property {google.firestore.v1.TransactionOptions.IReadOnly|null} [readOnly] TransactionOptions readOnly + * @property {google.firestore.v1.TransactionOptions.IReadWrite|null} [readWrite] TransactionOptions readWrite + */ + + /** + * Constructs a new TransactionOptions. + * @memberof google.firestore.v1 + * @classdesc Represents a TransactionOptions. + * @implements ITransactionOptions + * @constructor + * @param {google.firestore.v1.ITransactionOptions=} [properties] Properties to set + */ + function TransactionOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * TransactionOptions readOnly. + * @member {google.firestore.v1.TransactionOptions.IReadOnly|null|undefined} readOnly + * @memberof google.firestore.v1.TransactionOptions + * @instance + */ + TransactionOptions.prototype.readOnly = null; + + /** + * TransactionOptions readWrite. + * @member {google.firestore.v1.TransactionOptions.IReadWrite|null|undefined} readWrite + * @memberof google.firestore.v1.TransactionOptions + * @instance + */ + TransactionOptions.prototype.readWrite = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * TransactionOptions mode. + * @member {"readOnly"|"readWrite"|undefined} mode + * @memberof google.firestore.v1.TransactionOptions + * @instance + */ + Object.defineProperty(TransactionOptions.prototype, "mode", { + get: $util.oneOfGetter($oneOfFields = ["readOnly", "readWrite"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TransactionOptions instance using the specified properties. + * @function create + * @memberof google.firestore.v1.TransactionOptions + * @static + * @param {google.firestore.v1.ITransactionOptions=} [properties] Properties to set + * @returns {google.firestore.v1.TransactionOptions} TransactionOptions instance + */ + TransactionOptions.create = function create(properties) { + return new TransactionOptions(properties); + }; + + /** + * Encodes the specified TransactionOptions message. Does not implicitly {@link google.firestore.v1.TransactionOptions.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.TransactionOptions + * @static + * @param {google.firestore.v1.ITransactionOptions} message TransactionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.readOnly != null && Object.hasOwnProperty.call(message, "readOnly")) + $root.google.firestore.v1.TransactionOptions.ReadOnly.encode(message.readOnly, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.readWrite != null && Object.hasOwnProperty.call(message, "readWrite")) + $root.google.firestore.v1.TransactionOptions.ReadWrite.encode(message.readWrite, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified TransactionOptions message, length delimited. Does not implicitly {@link google.firestore.v1.TransactionOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.TransactionOptions + * @static + * @param {google.firestore.v1.ITransactionOptions} message TransactionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a TransactionOptions message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.TransactionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.TransactionOptions} TransactionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.TransactionOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.readOnly = $root.google.firestore.v1.TransactionOptions.ReadOnly.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.readWrite = $root.google.firestore.v1.TransactionOptions.ReadWrite.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a TransactionOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.TransactionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.TransactionOptions} TransactionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransactionOptions message. + * @function verify + * @memberof google.firestore.v1.TransactionOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransactionOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.readOnly != null && Object.hasOwnProperty.call(message, "readOnly")) { + properties.mode = 1; + { + var error = $root.google.firestore.v1.TransactionOptions.ReadOnly.verify(message.readOnly, long + 1); + if (error) + return "readOnly." + error; + } + } + if (message.readWrite != null && Object.hasOwnProperty.call(message, "readWrite")) { + if (properties.mode === 1) + return "mode: multiple values"; + properties.mode = 1; + { + var error = $root.google.firestore.v1.TransactionOptions.ReadWrite.verify(message.readWrite, long + 1); + if (error) + return "readWrite." + error; + } + } + return null; + }; + + /** + * Creates a TransactionOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.TransactionOptions + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.TransactionOptions} TransactionOptions + */ + TransactionOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.TransactionOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.TransactionOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.TransactionOptions(); + if (object.readOnly != null) { + if (!$util.isObject(object.readOnly)) + throw TypeError(".google.firestore.v1.TransactionOptions.readOnly: object expected"); + message.readOnly = $root.google.firestore.v1.TransactionOptions.ReadOnly.fromObject(object.readOnly, long + 1); + } + if (object.readWrite != null) { + if (!$util.isObject(object.readWrite)) + throw TypeError(".google.firestore.v1.TransactionOptions.readWrite: object expected"); + message.readWrite = $root.google.firestore.v1.TransactionOptions.ReadWrite.fromObject(object.readWrite, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a TransactionOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.TransactionOptions + * @static + * @param {google.firestore.v1.TransactionOptions} message TransactionOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransactionOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.readOnly != null && Object.hasOwnProperty.call(message, "readOnly")) { + object.readOnly = $root.google.firestore.v1.TransactionOptions.ReadOnly.toObject(message.readOnly, options, q + 1); + if (options.oneofs) + object.mode = "readOnly"; + } + if (message.readWrite != null && Object.hasOwnProperty.call(message, "readWrite")) { + object.readWrite = $root.google.firestore.v1.TransactionOptions.ReadWrite.toObject(message.readWrite, options, q + 1); + if (options.oneofs) + object.mode = "readWrite"; + } + return object; + }; + + /** + * Converts this TransactionOptions to JSON. + * @function toJSON + * @memberof google.firestore.v1.TransactionOptions + * @instance + * @returns {Object.} JSON object + */ + TransactionOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TransactionOptions + * @function getTypeUrl + * @memberof google.firestore.v1.TransactionOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TransactionOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.TransactionOptions"; + }; + + /** + * ConcurrencyMode enum. + * @name google.firestore.v1.TransactionOptions.ConcurrencyMode + * @enum {number} + * @property {number} CONCURRENCY_MODE_UNSPECIFIED=0 CONCURRENCY_MODE_UNSPECIFIED value + * @property {number} OPTIMISTIC=1 OPTIMISTIC value + * @property {number} PESSIMISTIC=2 PESSIMISTIC value + */ + TransactionOptions.ConcurrencyMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONCURRENCY_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIMISTIC"] = 1; + values[valuesById[2] = "PESSIMISTIC"] = 2; + return values; + })(); + + TransactionOptions.ReadWrite = (function() { + + /** + * Properties of a ReadWrite. + * @memberof google.firestore.v1.TransactionOptions + * @interface IReadWrite + * @property {Uint8Array|null} [retryTransaction] ReadWrite retryTransaction + * @property {google.firestore.v1.TransactionOptions.ConcurrencyMode|null} [concurrencyMode] ReadWrite concurrencyMode + */ + + /** + * Constructs a new ReadWrite. + * @memberof google.firestore.v1.TransactionOptions + * @classdesc Represents a ReadWrite. + * @implements IReadWrite + * @constructor + * @param {google.firestore.v1.TransactionOptions.IReadWrite=} [properties] Properties to set + */ + function ReadWrite(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReadWrite retryTransaction. + * @member {Uint8Array} retryTransaction + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @instance + */ + ReadWrite.prototype.retryTransaction = $util.newBuffer([]); + + /** + * ReadWrite concurrencyMode. + * @member {google.firestore.v1.TransactionOptions.ConcurrencyMode} concurrencyMode + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @instance + */ + ReadWrite.prototype.concurrencyMode = 0; + + /** + * Creates a new ReadWrite instance using the specified properties. + * @function create + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @static + * @param {google.firestore.v1.TransactionOptions.IReadWrite=} [properties] Properties to set + * @returns {google.firestore.v1.TransactionOptions.ReadWrite} ReadWrite instance + */ + ReadWrite.create = function create(properties) { + return new ReadWrite(properties); + }; + + /** + * Encodes the specified ReadWrite message. Does not implicitly {@link google.firestore.v1.TransactionOptions.ReadWrite.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @static + * @param {google.firestore.v1.TransactionOptions.IReadWrite} message ReadWrite message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadWrite.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.retryTransaction != null && Object.hasOwnProperty.call(message, "retryTransaction")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.retryTransaction); + if (message.concurrencyMode != null && Object.hasOwnProperty.call(message, "concurrencyMode")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.concurrencyMode); + return writer; + }; + + /** + * Encodes the specified ReadWrite message, length delimited. Does not implicitly {@link google.firestore.v1.TransactionOptions.ReadWrite.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @static + * @param {google.firestore.v1.TransactionOptions.IReadWrite} message ReadWrite message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadWrite.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ReadWrite message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.TransactionOptions.ReadWrite} ReadWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadWrite.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.TransactionOptions.ReadWrite(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.retryTransaction = reader.bytes(); + break; + } + case 2: { + message.concurrencyMode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ReadWrite message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.TransactionOptions.ReadWrite} ReadWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadWrite.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReadWrite message. + * @function verify + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadWrite.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.retryTransaction != null && Object.hasOwnProperty.call(message, "retryTransaction")) + if (!(message.retryTransaction && typeof message.retryTransaction.length === "number" || $util.isString(message.retryTransaction))) + return "retryTransaction: buffer expected"; + if (message.concurrencyMode != null && Object.hasOwnProperty.call(message, "concurrencyMode")) + switch (message.concurrencyMode) { + default: + return "concurrencyMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a ReadWrite message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.TransactionOptions.ReadWrite} ReadWrite + */ + ReadWrite.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.TransactionOptions.ReadWrite) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.TransactionOptions.ReadWrite: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.TransactionOptions.ReadWrite(); + if (object.retryTransaction != null) + if (typeof object.retryTransaction === "string") + $util.base64.decode(object.retryTransaction, message.retryTransaction = $util.newBuffer($util.base64.length(object.retryTransaction)), 0); + else if (object.retryTransaction.length >= 0) + message.retryTransaction = object.retryTransaction; + switch (object.concurrencyMode) { + default: + if (typeof object.concurrencyMode === "number") { + message.concurrencyMode = object.concurrencyMode; + break; + } + break; + case "CONCURRENCY_MODE_UNSPECIFIED": + case 0: + message.concurrencyMode = 0; + break; + case "OPTIMISTIC": + case 1: + message.concurrencyMode = 1; + break; + case "PESSIMISTIC": + case 2: + message.concurrencyMode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a ReadWrite message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @static + * @param {google.firestore.v1.TransactionOptions.ReadWrite} message ReadWrite + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadWrite.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.retryTransaction = ""; + else { + object.retryTransaction = []; + if (options.bytes !== Array) + object.retryTransaction = $util.newBuffer(object.retryTransaction); + } + object.concurrencyMode = options.enums === String ? "CONCURRENCY_MODE_UNSPECIFIED" : 0; + } + if (message.retryTransaction != null && Object.hasOwnProperty.call(message, "retryTransaction")) + object.retryTransaction = options.bytes === String ? $util.base64.encode(message.retryTransaction, 0, message.retryTransaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.retryTransaction) : message.retryTransaction; + if (message.concurrencyMode != null && Object.hasOwnProperty.call(message, "concurrencyMode")) + object.concurrencyMode = options.enums === String ? $root.google.firestore.v1.TransactionOptions.ConcurrencyMode[message.concurrencyMode] === undefined ? message.concurrencyMode : $root.google.firestore.v1.TransactionOptions.ConcurrencyMode[message.concurrencyMode] : message.concurrencyMode; + return object; + }; + + /** + * Converts this ReadWrite to JSON. + * @function toJSON + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @instance + * @returns {Object.} JSON object + */ + ReadWrite.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadWrite + * @function getTypeUrl + * @memberof google.firestore.v1.TransactionOptions.ReadWrite + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadWrite.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.TransactionOptions.ReadWrite"; + }; + + return ReadWrite; + })(); + + TransactionOptions.ReadOnly = (function() { + + /** + * Properties of a ReadOnly. + * @memberof google.firestore.v1.TransactionOptions + * @interface IReadOnly + * @property {google.protobuf.ITimestamp|null} [readTime] ReadOnly readTime + */ + + /** + * Constructs a new ReadOnly. + * @memberof google.firestore.v1.TransactionOptions + * @classdesc Represents a ReadOnly. + * @implements IReadOnly + * @constructor + * @param {google.firestore.v1.TransactionOptions.IReadOnly=} [properties] Properties to set + */ + function ReadOnly(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReadOnly readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @instance + */ + ReadOnly.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReadOnly consistencySelector. + * @member {"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @instance + */ + Object.defineProperty(ReadOnly.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReadOnly instance using the specified properties. + * @function create + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @static + * @param {google.firestore.v1.TransactionOptions.IReadOnly=} [properties] Properties to set + * @returns {google.firestore.v1.TransactionOptions.ReadOnly} ReadOnly instance + */ + ReadOnly.create = function create(properties) { + return new ReadOnly(properties); + }; + + /** + * Encodes the specified ReadOnly message. Does not implicitly {@link google.firestore.v1.TransactionOptions.ReadOnly.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @static + * @param {google.firestore.v1.TransactionOptions.IReadOnly} message ReadOnly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadOnly.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReadOnly message, length delimited. Does not implicitly {@link google.firestore.v1.TransactionOptions.ReadOnly.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @static + * @param {google.firestore.v1.TransactionOptions.IReadOnly} message ReadOnly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadOnly.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ReadOnly message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.TransactionOptions.ReadOnly} ReadOnly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadOnly.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.TransactionOptions.ReadOnly(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ReadOnly message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.TransactionOptions.ReadOnly} ReadOnly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadOnly.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReadOnly message. + * @function verify + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadOnly.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + return null; + }; + + /** + * Creates a ReadOnly message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.TransactionOptions.ReadOnly} ReadOnly + */ + ReadOnly.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.TransactionOptions.ReadOnly) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.TransactionOptions.ReadOnly: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.TransactionOptions.ReadOnly(); + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.TransactionOptions.ReadOnly.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a ReadOnly message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @static + * @param {google.firestore.v1.TransactionOptions.ReadOnly} message ReadOnly + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadOnly.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + return object; + }; + + /** + * Converts this ReadOnly to JSON. + * @function toJSON + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @instance + * @returns {Object.} JSON object + */ + ReadOnly.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadOnly + * @function getTypeUrl + * @memberof google.firestore.v1.TransactionOptions.ReadOnly + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadOnly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.TransactionOptions.ReadOnly"; + }; + + return ReadOnly; + })(); + + return TransactionOptions; + })(); + + v1.ExplainStats = (function() { + + /** + * Properties of an ExplainStats. + * @memberof google.firestore.v1 + * @interface IExplainStats + * @property {google.protobuf.IAny|null} [data] ExplainStats data + */ + + /** + * Constructs a new ExplainStats. + * @memberof google.firestore.v1 + * @classdesc Represents an ExplainStats. + * @implements IExplainStats + * @constructor + * @param {google.firestore.v1.IExplainStats=} [properties] Properties to set + */ + function ExplainStats(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExplainStats data. + * @member {google.protobuf.IAny|null|undefined} data + * @memberof google.firestore.v1.ExplainStats + * @instance + */ + ExplainStats.prototype.data = null; + + /** + * Creates a new ExplainStats instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ExplainStats + * @static + * @param {google.firestore.v1.IExplainStats=} [properties] Properties to set + * @returns {google.firestore.v1.ExplainStats} ExplainStats instance + */ + ExplainStats.create = function create(properties) { + return new ExplainStats(properties); + }; + + /** + * Encodes the specified ExplainStats message. Does not implicitly {@link google.firestore.v1.ExplainStats.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ExplainStats + * @static + * @param {google.firestore.v1.IExplainStats} message ExplainStats message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExplainStats.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + $root.google.protobuf.Any.encode(message.data, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExplainStats message, length delimited. Does not implicitly {@link google.firestore.v1.ExplainStats.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ExplainStats + * @static + * @param {google.firestore.v1.IExplainStats} message ExplainStats message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExplainStats.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExplainStats message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ExplainStats + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ExplainStats} ExplainStats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExplainStats.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ExplainStats(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.data = $root.google.protobuf.Any.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExplainStats message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ExplainStats + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ExplainStats} ExplainStats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExplainStats.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExplainStats message. + * @function verify + * @memberof google.firestore.v1.ExplainStats + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExplainStats.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.data != null && Object.hasOwnProperty.call(message, "data")) { + var error = $root.google.protobuf.Any.verify(message.data, long + 1); + if (error) + return "data." + error; + } + return null; + }; + + /** + * Creates an ExplainStats message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ExplainStats + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ExplainStats} ExplainStats + */ + ExplainStats.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ExplainStats) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ExplainStats: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ExplainStats(); + if (object.data != null) { + if (!$util.isObject(object.data)) + throw TypeError(".google.firestore.v1.ExplainStats.data: object expected"); + message.data = $root.google.protobuf.Any.fromObject(object.data, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an ExplainStats message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ExplainStats + * @static + * @param {google.firestore.v1.ExplainStats} message ExplainStats + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExplainStats.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.data = null; + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + object.data = $root.google.protobuf.Any.toObject(message.data, options, q + 1); + return object; + }; + + /** + * Converts this ExplainStats to JSON. + * @function toJSON + * @memberof google.firestore.v1.ExplainStats + * @instance + * @returns {Object.} JSON object + */ + ExplainStats.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExplainStats + * @function getTypeUrl + * @memberof google.firestore.v1.ExplainStats + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExplainStats.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ExplainStats"; + }; + + return ExplainStats; + })(); + + v1.Firestore = (function() { + + /** + * Constructs a new Firestore service. + * @memberof google.firestore.v1 + * @classdesc Represents a Firestore + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Firestore(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Firestore.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Firestore; + + /** + * Creates new Firestore service using the specified rpc implementation. + * @function create + * @memberof google.firestore.v1.Firestore + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Firestore} RPC service. Useful where requests and/or responses are streamed. + */ + Firestore.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.firestore.v1.Firestore|getDocument}. + * @memberof google.firestore.v1.Firestore + * @typedef GetDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.Document} [response] Document + */ + + /** + * Calls GetDocument. + * @function getDocument + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IGetDocumentRequest} request GetDocumentRequest message or plain object + * @param {google.firestore.v1.Firestore.GetDocumentCallback} callback Node-style callback called with the error, if any, and Document + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.getDocument = function getDocument(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getDocument, $root.google.firestore.v1.GetDocumentRequest, $root.google.firestore.v1.Document, request, callback); + }, "name", { value: "GetDocument" }); + + /** + * Calls GetDocument. + * @function getDocument + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IGetDocumentRequest} request GetDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|listDocuments}. + * @memberof google.firestore.v1.Firestore + * @typedef ListDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.ListDocumentsResponse} [response] ListDocumentsResponse + */ + + /** + * Calls ListDocuments. + * @function listDocuments + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IListDocumentsRequest} request ListDocumentsRequest message or plain object + * @param {google.firestore.v1.Firestore.ListDocumentsCallback} callback Node-style callback called with the error, if any, and ListDocumentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.listDocuments = function listDocuments(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listDocuments, $root.google.firestore.v1.ListDocumentsRequest, $root.google.firestore.v1.ListDocumentsResponse, request, callback); + }, "name", { value: "ListDocuments" }); + + /** + * Calls ListDocuments. + * @function listDocuments + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IListDocumentsRequest} request ListDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|updateDocument}. + * @memberof google.firestore.v1.Firestore + * @typedef UpdateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.Document} [response] Document + */ + + /** + * Calls UpdateDocument. + * @function updateDocument + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IUpdateDocumentRequest} request UpdateDocumentRequest message or plain object + * @param {google.firestore.v1.Firestore.UpdateDocumentCallback} callback Node-style callback called with the error, if any, and Document + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.updateDocument = function updateDocument(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, updateDocument, $root.google.firestore.v1.UpdateDocumentRequest, $root.google.firestore.v1.Document, request, callback); + }, "name", { value: "UpdateDocument" }); + + /** + * Calls UpdateDocument. + * @function updateDocument + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IUpdateDocumentRequest} request UpdateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|deleteDocument}. + * @memberof google.firestore.v1.Firestore + * @typedef DeleteDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteDocument. + * @function deleteDocument + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IDeleteDocumentRequest} request DeleteDocumentRequest message or plain object + * @param {google.firestore.v1.Firestore.DeleteDocumentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.deleteDocument = function deleteDocument(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteDocument, $root.google.firestore.v1.DeleteDocumentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteDocument" }); + + /** + * Calls DeleteDocument. + * @function deleteDocument + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IDeleteDocumentRequest} request DeleteDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|batchGetDocuments}. + * @memberof google.firestore.v1.Firestore + * @typedef BatchGetDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.BatchGetDocumentsResponse} [response] BatchGetDocumentsResponse + */ + + /** + * Calls BatchGetDocuments. + * @function batchGetDocuments + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IBatchGetDocumentsRequest} request BatchGetDocumentsRequest message or plain object + * @param {google.firestore.v1.Firestore.BatchGetDocumentsCallback} callback Node-style callback called with the error, if any, and BatchGetDocumentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.batchGetDocuments = function batchGetDocuments(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, batchGetDocuments, $root.google.firestore.v1.BatchGetDocumentsRequest, $root.google.firestore.v1.BatchGetDocumentsResponse, request, callback); + }, "name", { value: "BatchGetDocuments" }); + + /** + * Calls BatchGetDocuments. + * @function batchGetDocuments + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IBatchGetDocumentsRequest} request BatchGetDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|beginTransaction}. + * @memberof google.firestore.v1.Firestore + * @typedef BeginTransactionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.BeginTransactionResponse} [response] BeginTransactionResponse + */ + + /** + * Calls BeginTransaction. + * @function beginTransaction + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IBeginTransactionRequest} request BeginTransactionRequest message or plain object + * @param {google.firestore.v1.Firestore.BeginTransactionCallback} callback Node-style callback called with the error, if any, and BeginTransactionResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.beginTransaction = function beginTransaction(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, beginTransaction, $root.google.firestore.v1.BeginTransactionRequest, $root.google.firestore.v1.BeginTransactionResponse, request, callback); + }, "name", { value: "BeginTransaction" }); + + /** + * Calls BeginTransaction. + * @function beginTransaction + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IBeginTransactionRequest} request BeginTransactionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|commit}. + * @memberof google.firestore.v1.Firestore + * @typedef CommitCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.CommitResponse} [response] CommitResponse + */ + + /** + * Calls Commit. + * @function commit + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.ICommitRequest} request CommitRequest message or plain object + * @param {google.firestore.v1.Firestore.CommitCallback} callback Node-style callback called with the error, if any, and CommitResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.commit = function commit(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, commit, $root.google.firestore.v1.CommitRequest, $root.google.firestore.v1.CommitResponse, request, callback); + }, "name", { value: "Commit" }); + + /** + * Calls Commit. + * @function commit + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.ICommitRequest} request CommitRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|rollback}. + * @memberof google.firestore.v1.Firestore + * @typedef RollbackCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls Rollback. + * @function rollback + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IRollbackRequest} request RollbackRequest message or plain object + * @param {google.firestore.v1.Firestore.RollbackCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.rollback = function rollback(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, rollback, $root.google.firestore.v1.RollbackRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "Rollback" }); + + /** + * Calls Rollback. + * @function rollback + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IRollbackRequest} request RollbackRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|runQuery}. + * @memberof google.firestore.v1.Firestore + * @typedef RunQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.RunQueryResponse} [response] RunQueryResponse + */ + + /** + * Calls RunQuery. + * @function runQuery + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IRunQueryRequest} request RunQueryRequest message or plain object + * @param {google.firestore.v1.Firestore.RunQueryCallback} callback Node-style callback called with the error, if any, and RunQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.runQuery = function runQuery(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, runQuery, $root.google.firestore.v1.RunQueryRequest, $root.google.firestore.v1.RunQueryResponse, request, callback); + }, "name", { value: "RunQuery" }); + + /** + * Calls RunQuery. + * @function runQuery + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IRunQueryRequest} request RunQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|executePipeline}. + * @memberof google.firestore.v1.Firestore + * @typedef ExecutePipelineCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.ExecutePipelineResponse} [response] ExecutePipelineResponse + */ + + /** + * Calls ExecutePipeline. + * @function executePipeline + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IExecutePipelineRequest} request ExecutePipelineRequest message or plain object + * @param {google.firestore.v1.Firestore.ExecutePipelineCallback} callback Node-style callback called with the error, if any, and ExecutePipelineResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.executePipeline = function executePipeline(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, executePipeline, $root.google.firestore.v1.ExecutePipelineRequest, $root.google.firestore.v1.ExecutePipelineResponse, request, callback); + }, "name", { value: "ExecutePipeline" }); + + /** + * Calls ExecutePipeline. + * @function executePipeline + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IExecutePipelineRequest} request ExecutePipelineRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|runAggregationQuery}. + * @memberof google.firestore.v1.Firestore + * @typedef RunAggregationQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.RunAggregationQueryResponse} [response] RunAggregationQueryResponse + */ + + /** + * Calls RunAggregationQuery. + * @function runAggregationQuery + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IRunAggregationQueryRequest} request RunAggregationQueryRequest message or plain object + * @param {google.firestore.v1.Firestore.RunAggregationQueryCallback} callback Node-style callback called with the error, if any, and RunAggregationQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.runAggregationQuery = function runAggregationQuery(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, runAggregationQuery, $root.google.firestore.v1.RunAggregationQueryRequest, $root.google.firestore.v1.RunAggregationQueryResponse, request, callback); + }, "name", { value: "RunAggregationQuery" }); + + /** + * Calls RunAggregationQuery. + * @function runAggregationQuery + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IRunAggregationQueryRequest} request RunAggregationQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|partitionQuery}. + * @memberof google.firestore.v1.Firestore + * @typedef PartitionQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.PartitionQueryResponse} [response] PartitionQueryResponse + */ + + /** + * Calls PartitionQuery. + * @function partitionQuery + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IPartitionQueryRequest} request PartitionQueryRequest message or plain object + * @param {google.firestore.v1.Firestore.PartitionQueryCallback} callback Node-style callback called with the error, if any, and PartitionQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.partitionQuery = function partitionQuery(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, partitionQuery, $root.google.firestore.v1.PartitionQueryRequest, $root.google.firestore.v1.PartitionQueryResponse, request, callback); + }, "name", { value: "PartitionQuery" }); + + /** + * Calls PartitionQuery. + * @function partitionQuery + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IPartitionQueryRequest} request PartitionQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|write}. + * @memberof google.firestore.v1.Firestore + * @typedef WriteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.WriteResponse} [response] WriteResponse + */ + + /** + * Calls Write. + * @function write + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IWriteRequest} request WriteRequest message or plain object + * @param {google.firestore.v1.Firestore.WriteCallback} callback Node-style callback called with the error, if any, and WriteResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.write = function write(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, write, $root.google.firestore.v1.WriteRequest, $root.google.firestore.v1.WriteResponse, request, callback); + }, "name", { value: "Write" }); + + /** + * Calls Write. + * @function write + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IWriteRequest} request WriteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|listen}. + * @memberof google.firestore.v1.Firestore + * @typedef ListenCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.ListenResponse} [response] ListenResponse + */ + + /** + * Calls Listen. + * @function listen + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IListenRequest} request ListenRequest message or plain object + * @param {google.firestore.v1.Firestore.ListenCallback} callback Node-style callback called with the error, if any, and ListenResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.listen = function listen(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listen, $root.google.firestore.v1.ListenRequest, $root.google.firestore.v1.ListenResponse, request, callback); + }, "name", { value: "Listen" }); + + /** + * Calls Listen. + * @function listen + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IListenRequest} request ListenRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|listCollectionIds}. + * @memberof google.firestore.v1.Firestore + * @typedef ListCollectionIdsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.ListCollectionIdsResponse} [response] ListCollectionIdsResponse + */ + + /** + * Calls ListCollectionIds. + * @function listCollectionIds + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IListCollectionIdsRequest} request ListCollectionIdsRequest message or plain object + * @param {google.firestore.v1.Firestore.ListCollectionIdsCallback} callback Node-style callback called with the error, if any, and ListCollectionIdsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.listCollectionIds = function listCollectionIds(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listCollectionIds, $root.google.firestore.v1.ListCollectionIdsRequest, $root.google.firestore.v1.ListCollectionIdsResponse, request, callback); + }, "name", { value: "ListCollectionIds" }); + + /** + * Calls ListCollectionIds. + * @function listCollectionIds + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IListCollectionIdsRequest} request ListCollectionIdsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|batchWrite}. + * @memberof google.firestore.v1.Firestore + * @typedef BatchWriteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.BatchWriteResponse} [response] BatchWriteResponse + */ + + /** + * Calls BatchWrite. + * @function batchWrite + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IBatchWriteRequest} request BatchWriteRequest message or plain object + * @param {google.firestore.v1.Firestore.BatchWriteCallback} callback Node-style callback called with the error, if any, and BatchWriteResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.batchWrite = function batchWrite(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, batchWrite, $root.google.firestore.v1.BatchWriteRequest, $root.google.firestore.v1.BatchWriteResponse, request, callback); + }, "name", { value: "BatchWrite" }); + + /** + * Calls BatchWrite. + * @function batchWrite + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.IBatchWriteRequest} request BatchWriteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1.Firestore|createDocument}. + * @memberof google.firestore.v1.Firestore + * @typedef CreateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1.Document} [response] Document + */ + + /** + * Calls CreateDocument. + * @function createDocument + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.ICreateDocumentRequest} request CreateDocumentRequest message or plain object + * @param {google.firestore.v1.Firestore.CreateDocumentCallback} callback Node-style callback called with the error, if any, and Document + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.createDocument = function createDocument(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createDocument, $root.google.firestore.v1.CreateDocumentRequest, $root.google.firestore.v1.Document, request, callback); + }, "name", { value: "CreateDocument" }); + + /** + * Calls CreateDocument. + * @function createDocument + * @memberof google.firestore.v1.Firestore + * @instance + * @param {google.firestore.v1.ICreateDocumentRequest} request CreateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Firestore; + })(); + + v1.GetDocumentRequest = (function() { + + /** + * Properties of a GetDocumentRequest. + * @memberof google.firestore.v1 + * @interface IGetDocumentRequest + * @property {string|null} [name] GetDocumentRequest name + * @property {google.firestore.v1.IDocumentMask|null} [mask] GetDocumentRequest mask + * @property {Uint8Array|null} [transaction] GetDocumentRequest transaction + * @property {google.protobuf.ITimestamp|null} [readTime] GetDocumentRequest readTime + */ + + /** + * Constructs a new GetDocumentRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a GetDocumentRequest. + * @implements IGetDocumentRequest + * @constructor + * @param {google.firestore.v1.IGetDocumentRequest=} [properties] Properties to set + */ + function GetDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDocumentRequest name. + * @member {string} name + * @memberof google.firestore.v1.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.name = ""; + + /** + * GetDocumentRequest mask. + * @member {google.firestore.v1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.mask = null; + + /** + * GetDocumentRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.transaction = null; + + /** + * GetDocumentRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetDocumentRequest consistencySelector. + * @member {"transaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1.GetDocumentRequest + * @instance + */ + Object.defineProperty(GetDocumentRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetDocumentRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.GetDocumentRequest + * @static + * @param {google.firestore.v1.IGetDocumentRequest=} [properties] Properties to set + * @returns {google.firestore.v1.GetDocumentRequest} GetDocumentRequest instance + */ + GetDocumentRequest.create = function create(properties) { + return new GetDocumentRequest(properties); + }; + + /** + * Encodes the specified GetDocumentRequest message. Does not implicitly {@link google.firestore.v1.GetDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.GetDocumentRequest + * @static + * @param {google.firestore.v1.IGetDocumentRequest} message GetDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1.DocumentMask.encode(message.mask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.transaction); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1.GetDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.GetDocumentRequest + * @static + * @param {google.firestore.v1.IGetDocumentRequest} message GetDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.GetDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.GetDocumentRequest} GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.GetDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.mask = $root.google.firestore.v1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.transaction = reader.bytes(); + break; + } + case 5: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.GetDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.GetDocumentRequest} GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDocumentRequest message. + * @function verify + * @memberof google.firestore.v1.GetDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDocumentRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + return null; + }; + + /** + * Creates a GetDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.GetDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.GetDocumentRequest} GetDocumentRequest + */ + GetDocumentRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.GetDocumentRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.GetDocumentRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.GetDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1.GetDocumentRequest.mask: object expected"); + message.mask = $root.google.firestore.v1.DocumentMask.fromObject(object.mask, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.GetDocumentRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a GetDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.GetDocumentRequest + * @static + * @param {google.firestore.v1.GetDocumentRequest} message GetDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDocumentRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.mask = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1.DocumentMask.toObject(message.mask, options, q + 1); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + return object; + }; + + /** + * Converts this GetDocumentRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.GetDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + GetDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetDocumentRequest + * @function getTypeUrl + * @memberof google.firestore.v1.GetDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.GetDocumentRequest"; + }; + + return GetDocumentRequest; + })(); + + v1.ListDocumentsRequest = (function() { + + /** + * Properties of a ListDocumentsRequest. + * @memberof google.firestore.v1 + * @interface IListDocumentsRequest + * @property {string|null} [parent] ListDocumentsRequest parent + * @property {string|null} [collectionId] ListDocumentsRequest collectionId + * @property {number|null} [pageSize] ListDocumentsRequest pageSize + * @property {string|null} [pageToken] ListDocumentsRequest pageToken + * @property {string|null} [orderBy] ListDocumentsRequest orderBy + * @property {google.firestore.v1.IDocumentMask|null} [mask] ListDocumentsRequest mask + * @property {Uint8Array|null} [transaction] ListDocumentsRequest transaction + * @property {google.protobuf.ITimestamp|null} [readTime] ListDocumentsRequest readTime + * @property {boolean|null} [showMissing] ListDocumentsRequest showMissing + */ + + /** + * Constructs a new ListDocumentsRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a ListDocumentsRequest. + * @implements IListDocumentsRequest + * @constructor + * @param {google.firestore.v1.IListDocumentsRequest=} [properties] Properties to set + */ + function ListDocumentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDocumentsRequest parent. + * @member {string} parent + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.parent = ""; + + /** + * ListDocumentsRequest collectionId. + * @member {string} collectionId + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.collectionId = ""; + + /** + * ListDocumentsRequest pageSize. + * @member {number} pageSize + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.pageSize = 0; + + /** + * ListDocumentsRequest pageToken. + * @member {string} pageToken + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.pageToken = ""; + + /** + * ListDocumentsRequest orderBy. + * @member {string} orderBy + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.orderBy = ""; + + /** + * ListDocumentsRequest mask. + * @member {google.firestore.v1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.mask = null; + + /** + * ListDocumentsRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.transaction = null; + + /** + * ListDocumentsRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.readTime = null; + + /** + * ListDocumentsRequest showMissing. + * @member {boolean} showMissing + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.showMissing = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ListDocumentsRequest consistencySelector. + * @member {"transaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + */ + Object.defineProperty(ListDocumentsRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ListDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ListDocumentsRequest + * @static + * @param {google.firestore.v1.IListDocumentsRequest=} [properties] Properties to set + * @returns {google.firestore.v1.ListDocumentsRequest} ListDocumentsRequest instance + */ + ListDocumentsRequest.create = function create(properties) { + return new ListDocumentsRequest(properties); + }; + + /** + * Encodes the specified ListDocumentsRequest message. Does not implicitly {@link google.firestore.v1.ListDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ListDocumentsRequest + * @static + * @param {google.firestore.v1.IListDocumentsRequest} message ListDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.collectionId); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1.DocumentMask.encode(message.mask, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.transaction); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 10, wireType 2 =*/82).fork(), q + 1).ldelim(); + if (message.showMissing != null && Object.hasOwnProperty.call(message, "showMissing")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.showMissing); + return writer; + }; + + /** + * Encodes the specified ListDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.v1.ListDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ListDocumentsRequest + * @static + * @param {google.firestore.v1.IListDocumentsRequest} message ListDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ListDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ListDocumentsRequest} ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ListDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.collectionId = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 6: { + message.orderBy = reader.string(); + break; + } + case 7: { + message.mask = $root.google.firestore.v1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 8: { + message.transaction = reader.bytes(); + break; + } + case 10: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 12: { + message.showMissing = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ListDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ListDocumentsRequest} ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDocumentsRequest message. + * @function verify + * @memberof google.firestore.v1.ListDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDocumentsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + if (!$util.isString(message.collectionId)) + return "collectionId: string expected"; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + if (message.showMissing != null && Object.hasOwnProperty.call(message, "showMissing")) + if (typeof message.showMissing !== "boolean") + return "showMissing: boolean expected"; + return null; + }; + + /** + * Creates a ListDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ListDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ListDocumentsRequest} ListDocumentsRequest + */ + ListDocumentsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ListDocumentsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ListDocumentsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ListDocumentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.collectionId != null) + message.collectionId = String(object.collectionId); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1.ListDocumentsRequest.mask: object expected"); + message.mask = $root.google.firestore.v1.DocumentMask.fromObject(object.mask, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.ListDocumentsRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.showMissing != null) + message.showMissing = Boolean(object.showMissing); + return message; + }; + + /** + * Creates a plain object from a ListDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ListDocumentsRequest + * @static + * @param {google.firestore.v1.ListDocumentsRequest} message ListDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDocumentsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.collectionId = ""; + object.pageSize = 0; + object.pageToken = ""; + object.orderBy = ""; + object.mask = null; + object.showMissing = false; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + object.collectionId = message.collectionId; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + object.pageToken = message.pageToken; + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + object.orderBy = message.orderBy; + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1.DocumentMask.toObject(message.mask, options, q + 1); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + if (message.showMissing != null && Object.hasOwnProperty.call(message, "showMissing")) + object.showMissing = message.showMissing; + return object; + }; + + /** + * Converts this ListDocumentsRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.ListDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDocumentsRequest + * @function getTypeUrl + * @memberof google.firestore.v1.ListDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ListDocumentsRequest"; + }; + + return ListDocumentsRequest; + })(); + + v1.ListDocumentsResponse = (function() { + + /** + * Properties of a ListDocumentsResponse. + * @memberof google.firestore.v1 + * @interface IListDocumentsResponse + * @property {Array.|null} [documents] ListDocumentsResponse documents + * @property {string|null} [nextPageToken] ListDocumentsResponse nextPageToken + */ + + /** + * Constructs a new ListDocumentsResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a ListDocumentsResponse. + * @implements IListDocumentsResponse + * @constructor + * @param {google.firestore.v1.IListDocumentsResponse=} [properties] Properties to set + */ + function ListDocumentsResponse(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDocumentsResponse documents. + * @member {Array.} documents + * @memberof google.firestore.v1.ListDocumentsResponse + * @instance + */ + ListDocumentsResponse.prototype.documents = $util.emptyArray; + + /** + * ListDocumentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.firestore.v1.ListDocumentsResponse + * @instance + */ + ListDocumentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ListDocumentsResponse + * @static + * @param {google.firestore.v1.IListDocumentsResponse=} [properties] Properties to set + * @returns {google.firestore.v1.ListDocumentsResponse} ListDocumentsResponse instance + */ + ListDocumentsResponse.create = function create(properties) { + return new ListDocumentsResponse(properties); + }; + + /** + * Encodes the specified ListDocumentsResponse message. Does not implicitly {@link google.firestore.v1.ListDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ListDocumentsResponse + * @static + * @param {google.firestore.v1.IListDocumentsResponse} message ListDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + $root.google.firestore.v1.Document.encode(message.documents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.v1.ListDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ListDocumentsResponse + * @static + * @param {google.firestore.v1.IListDocumentsResponse} message ListDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ListDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ListDocumentsResponse} ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ListDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push($root.google.firestore.v1.Document.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ListDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ListDocumentsResponse} ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDocumentsResponse message. + * @function verify + * @memberof google.firestore.v1.ListDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDocumentsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) { + var error = $root.google.firestore.v1.Document.verify(message.documents[i], long + 1); + if (error) + return "documents." + error; + } + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ListDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ListDocumentsResponse} ListDocumentsResponse + */ + ListDocumentsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ListDocumentsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ListDocumentsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ListDocumentsResponse(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.firestore.v1.ListDocumentsResponse.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) { + if (!$util.isObject(object.documents[i])) + throw TypeError(".google.firestore.v1.ListDocumentsResponse.documents: object expected"); + message.documents[i] = $root.google.firestore.v1.Document.fromObject(object.documents[i], long + 1); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ListDocumentsResponse + * @static + * @param {google.firestore.v1.ListDocumentsResponse} message ListDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDocumentsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = $root.google.firestore.v1.Document.toObject(message.documents[j], options, q + 1); + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListDocumentsResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.ListDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDocumentsResponse + * @function getTypeUrl + * @memberof google.firestore.v1.ListDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ListDocumentsResponse"; + }; + + return ListDocumentsResponse; + })(); + + v1.CreateDocumentRequest = (function() { + + /** + * Properties of a CreateDocumentRequest. + * @memberof google.firestore.v1 + * @interface ICreateDocumentRequest + * @property {string|null} [parent] CreateDocumentRequest parent + * @property {string|null} [collectionId] CreateDocumentRequest collectionId + * @property {string|null} [documentId] CreateDocumentRequest documentId + * @property {google.firestore.v1.IDocument|null} [document] CreateDocumentRequest document + * @property {google.firestore.v1.IDocumentMask|null} [mask] CreateDocumentRequest mask + */ + + /** + * Constructs a new CreateDocumentRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a CreateDocumentRequest. + * @implements ICreateDocumentRequest + * @constructor + * @param {google.firestore.v1.ICreateDocumentRequest=} [properties] Properties to set + */ + function CreateDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateDocumentRequest parent. + * @member {string} parent + * @memberof google.firestore.v1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.parent = ""; + + /** + * CreateDocumentRequest collectionId. + * @member {string} collectionId + * @memberof google.firestore.v1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.collectionId = ""; + + /** + * CreateDocumentRequest documentId. + * @member {string} documentId + * @memberof google.firestore.v1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.documentId = ""; + + /** + * CreateDocumentRequest document. + * @member {google.firestore.v1.IDocument|null|undefined} document + * @memberof google.firestore.v1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.document = null; + + /** + * CreateDocumentRequest mask. + * @member {google.firestore.v1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.mask = null; + + /** + * Creates a new CreateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.CreateDocumentRequest + * @static + * @param {google.firestore.v1.ICreateDocumentRequest=} [properties] Properties to set + * @returns {google.firestore.v1.CreateDocumentRequest} CreateDocumentRequest instance + */ + CreateDocumentRequest.create = function create(properties) { + return new CreateDocumentRequest(properties); + }; + + /** + * Encodes the specified CreateDocumentRequest message. Does not implicitly {@link google.firestore.v1.CreateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.CreateDocumentRequest + * @static + * @param {google.firestore.v1.ICreateDocumentRequest} message CreateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDocumentRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.collectionId); + if (message.documentId != null && Object.hasOwnProperty.call(message, "documentId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentId); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.firestore.v1.Document.encode(message.document, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1.DocumentMask.encode(message.mask, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1.CreateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.CreateDocumentRequest + * @static + * @param {google.firestore.v1.ICreateDocumentRequest} message CreateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.CreateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.CreateDocumentRequest} CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDocumentRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.CreateDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.collectionId = reader.string(); + break; + } + case 3: { + message.documentId = reader.string(); + break; + } + case 4: { + message.document = $root.google.firestore.v1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.mask = $root.google.firestore.v1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.CreateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.CreateDocumentRequest} CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateDocumentRequest message. + * @function verify + * @memberof google.firestore.v1.CreateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateDocumentRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + if (!$util.isString(message.collectionId)) + return "collectionId: string expected"; + if (message.documentId != null && Object.hasOwnProperty.call(message, "documentId")) + if (!$util.isString(message.documentId)) + return "documentId: string expected"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) { + var error = $root.google.firestore.v1.Document.verify(message.document, long + 1); + if (error) + return "document." + error; + } + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + return null; + }; + + /** + * Creates a CreateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.CreateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.CreateDocumentRequest} CreateDocumentRequest + */ + CreateDocumentRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.CreateDocumentRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.CreateDocumentRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.CreateDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.collectionId != null) + message.collectionId = String(object.collectionId); + if (object.documentId != null) + message.documentId = String(object.documentId); + if (object.document != null) { + if (!$util.isObject(object.document)) + throw TypeError(".google.firestore.v1.CreateDocumentRequest.document: object expected"); + message.document = $root.google.firestore.v1.Document.fromObject(object.document, long + 1); + } + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1.CreateDocumentRequest.mask: object expected"); + message.mask = $root.google.firestore.v1.DocumentMask.fromObject(object.mask, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a CreateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.CreateDocumentRequest + * @static + * @param {google.firestore.v1.CreateDocumentRequest} message CreateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateDocumentRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.collectionId = ""; + object.documentId = ""; + object.document = null; + object.mask = null; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + object.collectionId = message.collectionId; + if (message.documentId != null && Object.hasOwnProperty.call(message, "documentId")) + object.documentId = message.documentId; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = $root.google.firestore.v1.Document.toObject(message.document, options, q + 1); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1.DocumentMask.toObject(message.mask, options, q + 1); + return object; + }; + + /** + * Converts this CreateDocumentRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.CreateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateDocumentRequest + * @function getTypeUrl + * @memberof google.firestore.v1.CreateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.CreateDocumentRequest"; + }; + + return CreateDocumentRequest; + })(); + + v1.UpdateDocumentRequest = (function() { + + /** + * Properties of an UpdateDocumentRequest. + * @memberof google.firestore.v1 + * @interface IUpdateDocumentRequest + * @property {google.firestore.v1.IDocument|null} [document] UpdateDocumentRequest document + * @property {google.firestore.v1.IDocumentMask|null} [updateMask] UpdateDocumentRequest updateMask + * @property {google.firestore.v1.IDocumentMask|null} [mask] UpdateDocumentRequest mask + * @property {google.firestore.v1.IPrecondition|null} [currentDocument] UpdateDocumentRequest currentDocument + */ + + /** + * Constructs a new UpdateDocumentRequest. + * @memberof google.firestore.v1 + * @classdesc Represents an UpdateDocumentRequest. + * @implements IUpdateDocumentRequest + * @constructor + * @param {google.firestore.v1.IUpdateDocumentRequest=} [properties] Properties to set + */ + function UpdateDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateDocumentRequest document. + * @member {google.firestore.v1.IDocument|null|undefined} document + * @memberof google.firestore.v1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.document = null; + + /** + * UpdateDocumentRequest updateMask. + * @member {google.firestore.v1.IDocumentMask|null|undefined} updateMask + * @memberof google.firestore.v1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.updateMask = null; + + /** + * UpdateDocumentRequest mask. + * @member {google.firestore.v1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.mask = null; + + /** + * UpdateDocumentRequest currentDocument. + * @member {google.firestore.v1.IPrecondition|null|undefined} currentDocument + * @memberof google.firestore.v1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.currentDocument = null; + + /** + * Creates a new UpdateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.UpdateDocumentRequest + * @static + * @param {google.firestore.v1.IUpdateDocumentRequest=} [properties] Properties to set + * @returns {google.firestore.v1.UpdateDocumentRequest} UpdateDocumentRequest instance + */ + UpdateDocumentRequest.create = function create(properties) { + return new UpdateDocumentRequest(properties); + }; + + /** + * Encodes the specified UpdateDocumentRequest message. Does not implicitly {@link google.firestore.v1.UpdateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.UpdateDocumentRequest + * @static + * @param {google.firestore.v1.IUpdateDocumentRequest} message UpdateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDocumentRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.firestore.v1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.firestore.v1.DocumentMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1.DocumentMask.encode(message.mask, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + $root.google.firestore.v1.Precondition.encode(message.currentDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1.UpdateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.UpdateDocumentRequest + * @static + * @param {google.firestore.v1.IUpdateDocumentRequest} message UpdateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.UpdateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.UpdateDocumentRequest} UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDocumentRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.UpdateDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = $root.google.firestore.v1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.updateMask = $root.google.firestore.v1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.mask = $root.google.firestore.v1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.currentDocument = $root.google.firestore.v1.Precondition.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.UpdateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.UpdateDocumentRequest} UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateDocumentRequest message. + * @function verify + * @memberof google.firestore.v1.UpdateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateDocumentRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) { + var error = $root.google.firestore.v1.Document.verify(message.document, long + 1); + if (error) + return "document." + error; + } + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { + var error = $root.google.firestore.v1.DocumentMask.verify(message.updateMask, long + 1); + if (error) + return "updateMask." + error; + } + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) { + var error = $root.google.firestore.v1.Precondition.verify(message.currentDocument, long + 1); + if (error) + return "currentDocument." + error; + } + return null; + }; + + /** + * Creates an UpdateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.UpdateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.UpdateDocumentRequest} UpdateDocumentRequest + */ + UpdateDocumentRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.UpdateDocumentRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.UpdateDocumentRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.UpdateDocumentRequest(); + if (object.document != null) { + if (!$util.isObject(object.document)) + throw TypeError(".google.firestore.v1.UpdateDocumentRequest.document: object expected"); + message.document = $root.google.firestore.v1.Document.fromObject(object.document, long + 1); + } + if (object.updateMask != null) { + if (!$util.isObject(object.updateMask)) + throw TypeError(".google.firestore.v1.UpdateDocumentRequest.updateMask: object expected"); + message.updateMask = $root.google.firestore.v1.DocumentMask.fromObject(object.updateMask, long + 1); + } + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1.UpdateDocumentRequest.mask: object expected"); + message.mask = $root.google.firestore.v1.DocumentMask.fromObject(object.mask, long + 1); + } + if (object.currentDocument != null) { + if (!$util.isObject(object.currentDocument)) + throw TypeError(".google.firestore.v1.UpdateDocumentRequest.currentDocument: object expected"); + message.currentDocument = $root.google.firestore.v1.Precondition.fromObject(object.currentDocument, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an UpdateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.UpdateDocumentRequest + * @static + * @param {google.firestore.v1.UpdateDocumentRequest} message UpdateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateDocumentRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.document = null; + object.updateMask = null; + object.mask = null; + object.currentDocument = null; + } + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = $root.google.firestore.v1.Document.toObject(message.document, options, q + 1); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.firestore.v1.DocumentMask.toObject(message.updateMask, options, q + 1); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1.DocumentMask.toObject(message.mask, options, q + 1); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + object.currentDocument = $root.google.firestore.v1.Precondition.toObject(message.currentDocument, options, q + 1); + return object; + }; + + /** + * Converts this UpdateDocumentRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.UpdateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateDocumentRequest + * @function getTypeUrl + * @memberof google.firestore.v1.UpdateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.UpdateDocumentRequest"; + }; + + return UpdateDocumentRequest; + })(); + + v1.DeleteDocumentRequest = (function() { + + /** + * Properties of a DeleteDocumentRequest. + * @memberof google.firestore.v1 + * @interface IDeleteDocumentRequest + * @property {string|null} [name] DeleteDocumentRequest name + * @property {google.firestore.v1.IPrecondition|null} [currentDocument] DeleteDocumentRequest currentDocument + */ + + /** + * Constructs a new DeleteDocumentRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a DeleteDocumentRequest. + * @implements IDeleteDocumentRequest + * @constructor + * @param {google.firestore.v1.IDeleteDocumentRequest=} [properties] Properties to set + */ + function DeleteDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteDocumentRequest name. + * @member {string} name + * @memberof google.firestore.v1.DeleteDocumentRequest + * @instance + */ + DeleteDocumentRequest.prototype.name = ""; + + /** + * DeleteDocumentRequest currentDocument. + * @member {google.firestore.v1.IPrecondition|null|undefined} currentDocument + * @memberof google.firestore.v1.DeleteDocumentRequest + * @instance + */ + DeleteDocumentRequest.prototype.currentDocument = null; + + /** + * Creates a new DeleteDocumentRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.DeleteDocumentRequest + * @static + * @param {google.firestore.v1.IDeleteDocumentRequest=} [properties] Properties to set + * @returns {google.firestore.v1.DeleteDocumentRequest} DeleteDocumentRequest instance + */ + DeleteDocumentRequest.create = function create(properties) { + return new DeleteDocumentRequest(properties); + }; + + /** + * Encodes the specified DeleteDocumentRequest message. Does not implicitly {@link google.firestore.v1.DeleteDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.DeleteDocumentRequest + * @static + * @param {google.firestore.v1.IDeleteDocumentRequest} message DeleteDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDocumentRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + $root.google.firestore.v1.Precondition.encode(message.currentDocument, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1.DeleteDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.DeleteDocumentRequest + * @static + * @param {google.firestore.v1.IDeleteDocumentRequest} message DeleteDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.DeleteDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.DeleteDocumentRequest} DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDocumentRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.DeleteDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.currentDocument = $root.google.firestore.v1.Precondition.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.DeleteDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.DeleteDocumentRequest} DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteDocumentRequest message. + * @function verify + * @memberof google.firestore.v1.DeleteDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteDocumentRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) { + var error = $root.google.firestore.v1.Precondition.verify(message.currentDocument, long + 1); + if (error) + return "currentDocument." + error; + } + return null; + }; + + /** + * Creates a DeleteDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.DeleteDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.DeleteDocumentRequest} DeleteDocumentRequest + */ + DeleteDocumentRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.DeleteDocumentRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.DeleteDocumentRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.DeleteDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.currentDocument != null) { + if (!$util.isObject(object.currentDocument)) + throw TypeError(".google.firestore.v1.DeleteDocumentRequest.currentDocument: object expected"); + message.currentDocument = $root.google.firestore.v1.Precondition.fromObject(object.currentDocument, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a DeleteDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.DeleteDocumentRequest + * @static + * @param {google.firestore.v1.DeleteDocumentRequest} message DeleteDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteDocumentRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.currentDocument = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + object.currentDocument = $root.google.firestore.v1.Precondition.toObject(message.currentDocument, options, q + 1); + return object; + }; + + /** + * Converts this DeleteDocumentRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.DeleteDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteDocumentRequest + * @function getTypeUrl + * @memberof google.firestore.v1.DeleteDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.DeleteDocumentRequest"; + }; + + return DeleteDocumentRequest; + })(); + + v1.BatchGetDocumentsRequest = (function() { + + /** + * Properties of a BatchGetDocumentsRequest. + * @memberof google.firestore.v1 + * @interface IBatchGetDocumentsRequest + * @property {string|null} [database] BatchGetDocumentsRequest database + * @property {Array.|null} [documents] BatchGetDocumentsRequest documents + * @property {google.firestore.v1.IDocumentMask|null} [mask] BatchGetDocumentsRequest mask + * @property {Uint8Array|null} [transaction] BatchGetDocumentsRequest transaction + * @property {google.firestore.v1.ITransactionOptions|null} [newTransaction] BatchGetDocumentsRequest newTransaction + * @property {google.protobuf.ITimestamp|null} [readTime] BatchGetDocumentsRequest readTime + */ + + /** + * Constructs a new BatchGetDocumentsRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a BatchGetDocumentsRequest. + * @implements IBatchGetDocumentsRequest + * @constructor + * @param {google.firestore.v1.IBatchGetDocumentsRequest=} [properties] Properties to set + */ + function BatchGetDocumentsRequest(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchGetDocumentsRequest database. + * @member {string} database + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.database = ""; + + /** + * BatchGetDocumentsRequest documents. + * @member {Array.} documents + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.documents = $util.emptyArray; + + /** + * BatchGetDocumentsRequest mask. + * @member {google.firestore.v1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.mask = null; + + /** + * BatchGetDocumentsRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.transaction = null; + + /** + * BatchGetDocumentsRequest newTransaction. + * @member {google.firestore.v1.ITransactionOptions|null|undefined} newTransaction + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.newTransaction = null; + + /** + * BatchGetDocumentsRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchGetDocumentsRequest consistencySelector. + * @member {"transaction"|"newTransaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @instance + */ + Object.defineProperty(BatchGetDocumentsRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "newTransaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchGetDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @static + * @param {google.firestore.v1.IBatchGetDocumentsRequest=} [properties] Properties to set + * @returns {google.firestore.v1.BatchGetDocumentsRequest} BatchGetDocumentsRequest instance + */ + BatchGetDocumentsRequest.create = function create(properties) { + return new BatchGetDocumentsRequest(properties); + }; + + /** + * Encodes the specified BatchGetDocumentsRequest message. Does not implicitly {@link google.firestore.v1.BatchGetDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @static + * @param {google.firestore.v1.IBatchGetDocumentsRequest} message BatchGetDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetDocumentsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documents[i]); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1.DocumentMask.encode(message.mask, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.transaction); + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) + $root.google.firestore.v1.TransactionOptions.encode(message.newTransaction, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchGetDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.v1.BatchGetDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @static + * @param {google.firestore.v1.IBatchGetDocumentsRequest} message BatchGetDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BatchGetDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.BatchGetDocumentsRequest} BatchGetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetDocumentsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.BatchGetDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push(reader.string()); + break; + } + case 3: { + message.mask = $root.google.firestore.v1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.transaction = reader.bytes(); + break; + } + case 5: { + message.newTransaction = $root.google.firestore.v1.TransactionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BatchGetDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.BatchGetDocumentsRequest} BatchGetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchGetDocumentsRequest message. + * @function verify + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchGetDocumentsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) + if (!$util.isString(message.documents[i])) + return "documents: string[] expected"; + } + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.firestore.v1.TransactionOptions.verify(message.newTransaction, long + 1); + if (error) + return "newTransaction." + error; + } + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + return null; + }; + + /** + * Creates a BatchGetDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.BatchGetDocumentsRequest} BatchGetDocumentsRequest + */ + BatchGetDocumentsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.BatchGetDocumentsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.BatchGetDocumentsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.BatchGetDocumentsRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.firestore.v1.BatchGetDocumentsRequest.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) + message.documents[i] = String(object.documents[i]); + } + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1.BatchGetDocumentsRequest.mask: object expected"); + message.mask = $root.google.firestore.v1.DocumentMask.fromObject(object.mask, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.newTransaction != null) { + if (!$util.isObject(object.newTransaction)) + throw TypeError(".google.firestore.v1.BatchGetDocumentsRequest.newTransaction: object expected"); + message.newTransaction = $root.google.firestore.v1.TransactionOptions.fromObject(object.newTransaction, long + 1); + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.BatchGetDocumentsRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a BatchGetDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @static + * @param {google.firestore.v1.BatchGetDocumentsRequest} message BatchGetDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchGetDocumentsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (options.defaults) { + object.database = ""; + object.mask = null; + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = message.documents[j]; + } + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1.DocumentMask.toObject(message.mask, options, q + 1); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + object.newTransaction = $root.google.firestore.v1.TransactionOptions.toObject(message.newTransaction, options, q + 1); + if (options.oneofs) + object.consistencySelector = "newTransaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + return object; + }; + + /** + * Converts this BatchGetDocumentsRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + BatchGetDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchGetDocumentsRequest + * @function getTypeUrl + * @memberof google.firestore.v1.BatchGetDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchGetDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.BatchGetDocumentsRequest"; + }; + + return BatchGetDocumentsRequest; + })(); + + v1.BatchGetDocumentsResponse = (function() { + + /** + * Properties of a BatchGetDocumentsResponse. + * @memberof google.firestore.v1 + * @interface IBatchGetDocumentsResponse + * @property {google.firestore.v1.IDocument|null} [found] BatchGetDocumentsResponse found + * @property {string|null} [missing] BatchGetDocumentsResponse missing + * @property {Uint8Array|null} [transaction] BatchGetDocumentsResponse transaction + * @property {google.protobuf.ITimestamp|null} [readTime] BatchGetDocumentsResponse readTime + */ + + /** + * Constructs a new BatchGetDocumentsResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a BatchGetDocumentsResponse. + * @implements IBatchGetDocumentsResponse + * @constructor + * @param {google.firestore.v1.IBatchGetDocumentsResponse=} [properties] Properties to set + */ + function BatchGetDocumentsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchGetDocumentsResponse found. + * @member {google.firestore.v1.IDocument|null|undefined} found + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @instance + */ + BatchGetDocumentsResponse.prototype.found = null; + + /** + * BatchGetDocumentsResponse missing. + * @member {string|null|undefined} missing + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @instance + */ + BatchGetDocumentsResponse.prototype.missing = null; + + /** + * BatchGetDocumentsResponse transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @instance + */ + BatchGetDocumentsResponse.prototype.transaction = $util.newBuffer([]); + + /** + * BatchGetDocumentsResponse readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @instance + */ + BatchGetDocumentsResponse.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchGetDocumentsResponse result. + * @member {"found"|"missing"|undefined} result + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @instance + */ + Object.defineProperty(BatchGetDocumentsResponse.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["found", "missing"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchGetDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @static + * @param {google.firestore.v1.IBatchGetDocumentsResponse=} [properties] Properties to set + * @returns {google.firestore.v1.BatchGetDocumentsResponse} BatchGetDocumentsResponse instance + */ + BatchGetDocumentsResponse.create = function create(properties) { + return new BatchGetDocumentsResponse(properties); + }; + + /** + * Encodes the specified BatchGetDocumentsResponse message. Does not implicitly {@link google.firestore.v1.BatchGetDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @static + * @param {google.firestore.v1.IBatchGetDocumentsResponse} message BatchGetDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetDocumentsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.found != null && Object.hasOwnProperty.call(message, "found")) + $root.google.firestore.v1.Document.encode(message.found, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.missing != null && Object.hasOwnProperty.call(message, "missing")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.missing); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.transaction); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchGetDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.v1.BatchGetDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @static + * @param {google.firestore.v1.IBatchGetDocumentsResponse} message BatchGetDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BatchGetDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.BatchGetDocumentsResponse} BatchGetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetDocumentsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.BatchGetDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.found = $root.google.firestore.v1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.missing = reader.string(); + break; + } + case 3: { + message.transaction = reader.bytes(); + break; + } + case 4: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BatchGetDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.BatchGetDocumentsResponse} BatchGetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchGetDocumentsResponse message. + * @function verify + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchGetDocumentsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.found != null && Object.hasOwnProperty.call(message, "found")) { + properties.result = 1; + { + var error = $root.google.firestore.v1.Document.verify(message.found, long + 1); + if (error) + return "found." + error; + } + } + if (message.missing != null && Object.hasOwnProperty.call(message, "missing")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + if (!$util.isString(message.missing)) + return "missing: string expected"; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a BatchGetDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.BatchGetDocumentsResponse} BatchGetDocumentsResponse + */ + BatchGetDocumentsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.BatchGetDocumentsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.BatchGetDocumentsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.BatchGetDocumentsResponse(); + if (object.found != null) { + if (!$util.isObject(object.found)) + throw TypeError(".google.firestore.v1.BatchGetDocumentsResponse.found: object expected"); + message.found = $root.google.firestore.v1.Document.fromObject(object.found, long + 1); + } + if (object.missing != null) + message.missing = String(object.missing); + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.BatchGetDocumentsResponse.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a BatchGetDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @static + * @param {google.firestore.v1.BatchGetDocumentsResponse} message BatchGetDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchGetDocumentsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + object.readTime = null; + } + if (message.found != null && Object.hasOwnProperty.call(message, "found")) { + object.found = $root.google.firestore.v1.Document.toObject(message.found, options, q + 1); + if (options.oneofs) + object.result = "found"; + } + if (message.missing != null && Object.hasOwnProperty.call(message, "missing")) { + object.missing = message.missing; + if (options.oneofs) + object.result = "missing"; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + return object; + }; + + /** + * Converts this BatchGetDocumentsResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + BatchGetDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchGetDocumentsResponse + * @function getTypeUrl + * @memberof google.firestore.v1.BatchGetDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchGetDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.BatchGetDocumentsResponse"; + }; + + return BatchGetDocumentsResponse; + })(); + + v1.BeginTransactionRequest = (function() { + + /** + * Properties of a BeginTransactionRequest. + * @memberof google.firestore.v1 + * @interface IBeginTransactionRequest + * @property {string|null} [database] BeginTransactionRequest database + * @property {google.firestore.v1.ITransactionOptions|null} [options] BeginTransactionRequest options + */ + + /** + * Constructs a new BeginTransactionRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a BeginTransactionRequest. + * @implements IBeginTransactionRequest + * @constructor + * @param {google.firestore.v1.IBeginTransactionRequest=} [properties] Properties to set + */ + function BeginTransactionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BeginTransactionRequest database. + * @member {string} database + * @memberof google.firestore.v1.BeginTransactionRequest + * @instance + */ + BeginTransactionRequest.prototype.database = ""; + + /** + * BeginTransactionRequest options. + * @member {google.firestore.v1.ITransactionOptions|null|undefined} options + * @memberof google.firestore.v1.BeginTransactionRequest + * @instance + */ + BeginTransactionRequest.prototype.options = null; + + /** + * Creates a new BeginTransactionRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.BeginTransactionRequest + * @static + * @param {google.firestore.v1.IBeginTransactionRequest=} [properties] Properties to set + * @returns {google.firestore.v1.BeginTransactionRequest} BeginTransactionRequest instance + */ + BeginTransactionRequest.create = function create(properties) { + return new BeginTransactionRequest(properties); + }; + + /** + * Encodes the specified BeginTransactionRequest message. Does not implicitly {@link google.firestore.v1.BeginTransactionRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.BeginTransactionRequest + * @static + * @param {google.firestore.v1.IBeginTransactionRequest} message BeginTransactionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BeginTransactionRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.firestore.v1.TransactionOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BeginTransactionRequest message, length delimited. Does not implicitly {@link google.firestore.v1.BeginTransactionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.BeginTransactionRequest + * @static + * @param {google.firestore.v1.IBeginTransactionRequest} message BeginTransactionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BeginTransactionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BeginTransactionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.BeginTransactionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.BeginTransactionRequest} BeginTransactionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BeginTransactionRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.BeginTransactionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.options = $root.google.firestore.v1.TransactionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BeginTransactionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.BeginTransactionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.BeginTransactionRequest} BeginTransactionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BeginTransactionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BeginTransactionRequest message. + * @function verify + * @memberof google.firestore.v1.BeginTransactionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BeginTransactionRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.firestore.v1.TransactionOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a BeginTransactionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.BeginTransactionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.BeginTransactionRequest} BeginTransactionRequest + */ + BeginTransactionRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.BeginTransactionRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.BeginTransactionRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.BeginTransactionRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.firestore.v1.BeginTransactionRequest.options: object expected"); + message.options = $root.google.firestore.v1.TransactionOptions.fromObject(object.options, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a BeginTransactionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.BeginTransactionRequest + * @static + * @param {google.firestore.v1.BeginTransactionRequest} message BeginTransactionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BeginTransactionRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.database = ""; + object.options = null; + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.firestore.v1.TransactionOptions.toObject(message.options, options, q + 1); + return object; + }; + + /** + * Converts this BeginTransactionRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.BeginTransactionRequest + * @instance + * @returns {Object.} JSON object + */ + BeginTransactionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BeginTransactionRequest + * @function getTypeUrl + * @memberof google.firestore.v1.BeginTransactionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BeginTransactionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.BeginTransactionRequest"; + }; + + return BeginTransactionRequest; + })(); + + v1.BeginTransactionResponse = (function() { + + /** + * Properties of a BeginTransactionResponse. + * @memberof google.firestore.v1 + * @interface IBeginTransactionResponse + * @property {Uint8Array|null} [transaction] BeginTransactionResponse transaction + */ + + /** + * Constructs a new BeginTransactionResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a BeginTransactionResponse. + * @implements IBeginTransactionResponse + * @constructor + * @param {google.firestore.v1.IBeginTransactionResponse=} [properties] Properties to set + */ + function BeginTransactionResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BeginTransactionResponse transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1.BeginTransactionResponse + * @instance + */ + BeginTransactionResponse.prototype.transaction = $util.newBuffer([]); + + /** + * Creates a new BeginTransactionResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.BeginTransactionResponse + * @static + * @param {google.firestore.v1.IBeginTransactionResponse=} [properties] Properties to set + * @returns {google.firestore.v1.BeginTransactionResponse} BeginTransactionResponse instance + */ + BeginTransactionResponse.create = function create(properties) { + return new BeginTransactionResponse(properties); + }; + + /** + * Encodes the specified BeginTransactionResponse message. Does not implicitly {@link google.firestore.v1.BeginTransactionResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.BeginTransactionResponse + * @static + * @param {google.firestore.v1.IBeginTransactionResponse} message BeginTransactionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BeginTransactionResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.transaction); + return writer; + }; + + /** + * Encodes the specified BeginTransactionResponse message, length delimited. Does not implicitly {@link google.firestore.v1.BeginTransactionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.BeginTransactionResponse + * @static + * @param {google.firestore.v1.IBeginTransactionResponse} message BeginTransactionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BeginTransactionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BeginTransactionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.BeginTransactionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.BeginTransactionResponse} BeginTransactionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BeginTransactionResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.BeginTransactionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.transaction = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BeginTransactionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.BeginTransactionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.BeginTransactionResponse} BeginTransactionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BeginTransactionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BeginTransactionResponse message. + * @function verify + * @memberof google.firestore.v1.BeginTransactionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BeginTransactionResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + return null; + }; + + /** + * Creates a BeginTransactionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.BeginTransactionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.BeginTransactionResponse} BeginTransactionResponse + */ + BeginTransactionResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.BeginTransactionResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.BeginTransactionResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.BeginTransactionResponse(); + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + return message; + }; + + /** + * Creates a plain object from a BeginTransactionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.BeginTransactionResponse + * @static + * @param {google.firestore.v1.BeginTransactionResponse} message BeginTransactionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BeginTransactionResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + return object; + }; + + /** + * Converts this BeginTransactionResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.BeginTransactionResponse + * @instance + * @returns {Object.} JSON object + */ + BeginTransactionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BeginTransactionResponse + * @function getTypeUrl + * @memberof google.firestore.v1.BeginTransactionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BeginTransactionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.BeginTransactionResponse"; + }; + + return BeginTransactionResponse; + })(); + + v1.CommitRequest = (function() { + + /** + * Properties of a CommitRequest. + * @memberof google.firestore.v1 + * @interface ICommitRequest + * @property {string|null} [database] CommitRequest database + * @property {Array.|null} [writes] CommitRequest writes + * @property {Uint8Array|null} [transaction] CommitRequest transaction + */ + + /** + * Constructs a new CommitRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a CommitRequest. + * @implements ICommitRequest + * @constructor + * @param {google.firestore.v1.ICommitRequest=} [properties] Properties to set + */ + function CommitRequest(properties) { + this.writes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommitRequest database. + * @member {string} database + * @memberof google.firestore.v1.CommitRequest + * @instance + */ + CommitRequest.prototype.database = ""; + + /** + * CommitRequest writes. + * @member {Array.} writes + * @memberof google.firestore.v1.CommitRequest + * @instance + */ + CommitRequest.prototype.writes = $util.emptyArray; + + /** + * CommitRequest transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1.CommitRequest + * @instance + */ + CommitRequest.prototype.transaction = $util.newBuffer([]); + + /** + * Creates a new CommitRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.CommitRequest + * @static + * @param {google.firestore.v1.ICommitRequest=} [properties] Properties to set + * @returns {google.firestore.v1.CommitRequest} CommitRequest instance + */ + CommitRequest.create = function create(properties) { + return new CommitRequest(properties); + }; + + /** + * Encodes the specified CommitRequest message. Does not implicitly {@link google.firestore.v1.CommitRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.CommitRequest + * @static + * @param {google.firestore.v1.ICommitRequest} message CommitRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.writes != null && message.writes.length) + for (var i = 0; i < message.writes.length; ++i) + $root.google.firestore.v1.Write.encode(message.writes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.transaction); + return writer; + }; + + /** + * Encodes the specified CommitRequest message, length delimited. Does not implicitly {@link google.firestore.v1.CommitRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.CommitRequest + * @static + * @param {google.firestore.v1.ICommitRequest} message CommitRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CommitRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.CommitRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.CommitRequest} CommitRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.CommitRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + if (!(message.writes && message.writes.length)) + message.writes = []; + message.writes.push($root.google.firestore.v1.Write.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + message.transaction = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CommitRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.CommitRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.CommitRequest} CommitRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommitRequest message. + * @function verify + * @memberof google.firestore.v1.CommitRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommitRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.writes != null && Object.hasOwnProperty.call(message, "writes")) { + if (!Array.isArray(message.writes)) + return "writes: array expected"; + for (var i = 0; i < message.writes.length; ++i) { + var error = $root.google.firestore.v1.Write.verify(message.writes[i], long + 1); + if (error) + return "writes." + error; + } + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + return null; + }; + + /** + * Creates a CommitRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.CommitRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.CommitRequest} CommitRequest + */ + CommitRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.CommitRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.CommitRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.CommitRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.writes) { + if (!Array.isArray(object.writes)) + throw TypeError(".google.firestore.v1.CommitRequest.writes: array expected"); + message.writes = []; + for (var i = 0; i < object.writes.length; ++i) { + if (!$util.isObject(object.writes[i])) + throw TypeError(".google.firestore.v1.CommitRequest.writes: object expected"); + message.writes[i] = $root.google.firestore.v1.Write.fromObject(object.writes[i], long + 1); + } + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + return message; + }; + + /** + * Creates a plain object from a CommitRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.CommitRequest + * @static + * @param {google.firestore.v1.CommitRequest} message CommitRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommitRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writes = []; + if (options.defaults) { + object.database = ""; + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.writes && message.writes.length) { + object.writes = []; + for (var j = 0; j < message.writes.length; ++j) + object.writes[j] = $root.google.firestore.v1.Write.toObject(message.writes[j], options, q + 1); + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + return object; + }; + + /** + * Converts this CommitRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.CommitRequest + * @instance + * @returns {Object.} JSON object + */ + CommitRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CommitRequest + * @function getTypeUrl + * @memberof google.firestore.v1.CommitRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CommitRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.CommitRequest"; + }; + + return CommitRequest; + })(); + + v1.CommitResponse = (function() { + + /** + * Properties of a CommitResponse. + * @memberof google.firestore.v1 + * @interface ICommitResponse + * @property {Array.|null} [writeResults] CommitResponse writeResults + * @property {google.protobuf.ITimestamp|null} [commitTime] CommitResponse commitTime + */ + + /** + * Constructs a new CommitResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a CommitResponse. + * @implements ICommitResponse + * @constructor + * @param {google.firestore.v1.ICommitResponse=} [properties] Properties to set + */ + function CommitResponse(properties) { + this.writeResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommitResponse writeResults. + * @member {Array.} writeResults + * @memberof google.firestore.v1.CommitResponse + * @instance + */ + CommitResponse.prototype.writeResults = $util.emptyArray; + + /** + * CommitResponse commitTime. + * @member {google.protobuf.ITimestamp|null|undefined} commitTime + * @memberof google.firestore.v1.CommitResponse + * @instance + */ + CommitResponse.prototype.commitTime = null; + + /** + * Creates a new CommitResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.CommitResponse + * @static + * @param {google.firestore.v1.ICommitResponse=} [properties] Properties to set + * @returns {google.firestore.v1.CommitResponse} CommitResponse instance + */ + CommitResponse.create = function create(properties) { + return new CommitResponse(properties); + }; + + /** + * Encodes the specified CommitResponse message. Does not implicitly {@link google.firestore.v1.CommitResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.CommitResponse + * @static + * @param {google.firestore.v1.ICommitResponse} message CommitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.writeResults != null && message.writeResults.length) + for (var i = 0; i < message.writeResults.length; ++i) + $root.google.firestore.v1.WriteResult.encode(message.writeResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) + $root.google.protobuf.Timestamp.encode(message.commitTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommitResponse message, length delimited. Does not implicitly {@link google.firestore.v1.CommitResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.CommitResponse + * @static + * @param {google.firestore.v1.ICommitResponse} message CommitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CommitResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.CommitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.CommitResponse} CommitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.CommitResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.writeResults && message.writeResults.length)) + message.writeResults = []; + message.writeResults.push($root.google.firestore.v1.WriteResult.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.commitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CommitResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.CommitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.CommitResponse} CommitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommitResponse message. + * @function verify + * @memberof google.firestore.v1.CommitResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommitResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.writeResults != null && Object.hasOwnProperty.call(message, "writeResults")) { + if (!Array.isArray(message.writeResults)) + return "writeResults: array expected"; + for (var i = 0; i < message.writeResults.length; ++i) { + var error = $root.google.firestore.v1.WriteResult.verify(message.writeResults[i], long + 1); + if (error) + return "writeResults." + error; + } + } + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.commitTime, long + 1); + if (error) + return "commitTime." + error; + } + return null; + }; + + /** + * Creates a CommitResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.CommitResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.CommitResponse} CommitResponse + */ + CommitResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.CommitResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.CommitResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.CommitResponse(); + if (object.writeResults) { + if (!Array.isArray(object.writeResults)) + throw TypeError(".google.firestore.v1.CommitResponse.writeResults: array expected"); + message.writeResults = []; + for (var i = 0; i < object.writeResults.length; ++i) { + if (!$util.isObject(object.writeResults[i])) + throw TypeError(".google.firestore.v1.CommitResponse.writeResults: object expected"); + message.writeResults[i] = $root.google.firestore.v1.WriteResult.fromObject(object.writeResults[i], long + 1); + } + } + if (object.commitTime != null) { + if (!$util.isObject(object.commitTime)) + throw TypeError(".google.firestore.v1.CommitResponse.commitTime: object expected"); + message.commitTime = $root.google.protobuf.Timestamp.fromObject(object.commitTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a CommitResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.CommitResponse + * @static + * @param {google.firestore.v1.CommitResponse} message CommitResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommitResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writeResults = []; + if (options.defaults) + object.commitTime = null; + if (message.writeResults && message.writeResults.length) { + object.writeResults = []; + for (var j = 0; j < message.writeResults.length; ++j) + object.writeResults[j] = $root.google.firestore.v1.WriteResult.toObject(message.writeResults[j], options, q + 1); + } + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) + object.commitTime = $root.google.protobuf.Timestamp.toObject(message.commitTime, options, q + 1); + return object; + }; + + /** + * Converts this CommitResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.CommitResponse + * @instance + * @returns {Object.} JSON object + */ + CommitResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CommitResponse + * @function getTypeUrl + * @memberof google.firestore.v1.CommitResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CommitResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.CommitResponse"; + }; + + return CommitResponse; + })(); + + v1.RollbackRequest = (function() { + + /** + * Properties of a RollbackRequest. + * @memberof google.firestore.v1 + * @interface IRollbackRequest + * @property {string|null} [database] RollbackRequest database + * @property {Uint8Array|null} [transaction] RollbackRequest transaction + */ + + /** + * Constructs a new RollbackRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a RollbackRequest. + * @implements IRollbackRequest + * @constructor + * @param {google.firestore.v1.IRollbackRequest=} [properties] Properties to set + */ + function RollbackRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RollbackRequest database. + * @member {string} database + * @memberof google.firestore.v1.RollbackRequest + * @instance + */ + RollbackRequest.prototype.database = ""; + + /** + * RollbackRequest transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1.RollbackRequest + * @instance + */ + RollbackRequest.prototype.transaction = $util.newBuffer([]); + + /** + * Creates a new RollbackRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.RollbackRequest + * @static + * @param {google.firestore.v1.IRollbackRequest=} [properties] Properties to set + * @returns {google.firestore.v1.RollbackRequest} RollbackRequest instance + */ + RollbackRequest.create = function create(properties) { + return new RollbackRequest(properties); + }; + + /** + * Encodes the specified RollbackRequest message. Does not implicitly {@link google.firestore.v1.RollbackRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.RollbackRequest + * @static + * @param {google.firestore.v1.IRollbackRequest} message RollbackRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RollbackRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.transaction); + return writer; + }; + + /** + * Encodes the specified RollbackRequest message, length delimited. Does not implicitly {@link google.firestore.v1.RollbackRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.RollbackRequest + * @static + * @param {google.firestore.v1.IRollbackRequest} message RollbackRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RollbackRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RollbackRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.RollbackRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.RollbackRequest} RollbackRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RollbackRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.RollbackRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.transaction = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RollbackRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.RollbackRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.RollbackRequest} RollbackRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RollbackRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RollbackRequest message. + * @function verify + * @memberof google.firestore.v1.RollbackRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RollbackRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + return null; + }; + + /** + * Creates a RollbackRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.RollbackRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.RollbackRequest} RollbackRequest + */ + RollbackRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.RollbackRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.RollbackRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.RollbackRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + return message; + }; + + /** + * Creates a plain object from a RollbackRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.RollbackRequest + * @static + * @param {google.firestore.v1.RollbackRequest} message RollbackRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RollbackRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.database = ""; + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + return object; + }; + + /** + * Converts this RollbackRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.RollbackRequest + * @instance + * @returns {Object.} JSON object + */ + RollbackRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RollbackRequest + * @function getTypeUrl + * @memberof google.firestore.v1.RollbackRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RollbackRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.RollbackRequest"; + }; + + return RollbackRequest; + })(); + + v1.RunQueryRequest = (function() { + + /** + * Properties of a RunQueryRequest. + * @memberof google.firestore.v1 + * @interface IRunQueryRequest + * @property {string|null} [parent] RunQueryRequest parent + * @property {google.firestore.v1.IStructuredQuery|null} [structuredQuery] RunQueryRequest structuredQuery + * @property {Uint8Array|null} [transaction] RunQueryRequest transaction + * @property {google.firestore.v1.ITransactionOptions|null} [newTransaction] RunQueryRequest newTransaction + * @property {google.protobuf.ITimestamp|null} [readTime] RunQueryRequest readTime + * @property {google.firestore.v1.IExplainOptions|null} [explainOptions] RunQueryRequest explainOptions + */ + + /** + * Constructs a new RunQueryRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a RunQueryRequest. + * @implements IRunQueryRequest + * @constructor + * @param {google.firestore.v1.IRunQueryRequest=} [properties] Properties to set + */ + function RunQueryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RunQueryRequest parent. + * @member {string} parent + * @memberof google.firestore.v1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.parent = ""; + + /** + * RunQueryRequest structuredQuery. + * @member {google.firestore.v1.IStructuredQuery|null|undefined} structuredQuery + * @memberof google.firestore.v1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.structuredQuery = null; + + /** + * RunQueryRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.transaction = null; + + /** + * RunQueryRequest newTransaction. + * @member {google.firestore.v1.ITransactionOptions|null|undefined} newTransaction + * @memberof google.firestore.v1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.newTransaction = null; + + /** + * RunQueryRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.readTime = null; + + /** + * RunQueryRequest explainOptions. + * @member {google.firestore.v1.IExplainOptions|null|undefined} explainOptions + * @memberof google.firestore.v1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.explainOptions = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RunQueryRequest queryType. + * @member {"structuredQuery"|undefined} queryType + * @memberof google.firestore.v1.RunQueryRequest + * @instance + */ + Object.defineProperty(RunQueryRequest.prototype, "queryType", { + get: $util.oneOfGetter($oneOfFields = ["structuredQuery"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * RunQueryRequest consistencySelector. + * @member {"transaction"|"newTransaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1.RunQueryRequest + * @instance + */ + Object.defineProperty(RunQueryRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "newTransaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RunQueryRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.RunQueryRequest + * @static + * @param {google.firestore.v1.IRunQueryRequest=} [properties] Properties to set + * @returns {google.firestore.v1.RunQueryRequest} RunQueryRequest instance + */ + RunQueryRequest.create = function create(properties) { + return new RunQueryRequest(properties); + }; + + /** + * Encodes the specified RunQueryRequest message. Does not implicitly {@link google.firestore.v1.RunQueryRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.RunQueryRequest + * @static + * @param {google.firestore.v1.IRunQueryRequest} message RunQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunQueryRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) + $root.google.firestore.v1.StructuredQuery.encode(message.structuredQuery, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.transaction); + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) + $root.google.firestore.v1.TransactionOptions.encode(message.newTransaction, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.explainOptions != null && Object.hasOwnProperty.call(message, "explainOptions")) + $root.google.firestore.v1.ExplainOptions.encode(message.explainOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified RunQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1.RunQueryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.RunQueryRequest + * @static + * @param {google.firestore.v1.IRunQueryRequest} message RunQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RunQueryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.RunQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.RunQueryRequest} RunQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunQueryRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.RunQueryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.structuredQuery = $root.google.firestore.v1.StructuredQuery.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.transaction = reader.bytes(); + break; + } + case 6: { + message.newTransaction = $root.google.firestore.v1.TransactionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 10: { + message.explainOptions = $root.google.firestore.v1.ExplainOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RunQueryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.RunQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.RunQueryRequest} RunQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunQueryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RunQueryRequest message. + * @function verify + * @memberof google.firestore.v1.RunQueryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RunQueryRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + properties.queryType = 1; + { + var error = $root.google.firestore.v1.StructuredQuery.verify(message.structuredQuery, long + 1); + if (error) + return "structuredQuery." + error; + } + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.firestore.v1.TransactionOptions.verify(message.newTransaction, long + 1); + if (error) + return "newTransaction." + error; + } + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + if (message.explainOptions != null && Object.hasOwnProperty.call(message, "explainOptions")) { + var error = $root.google.firestore.v1.ExplainOptions.verify(message.explainOptions, long + 1); + if (error) + return "explainOptions." + error; + } + return null; + }; + + /** + * Creates a RunQueryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.RunQueryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.RunQueryRequest} RunQueryRequest + */ + RunQueryRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.RunQueryRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.RunQueryRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.RunQueryRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.structuredQuery != null) { + if (!$util.isObject(object.structuredQuery)) + throw TypeError(".google.firestore.v1.RunQueryRequest.structuredQuery: object expected"); + message.structuredQuery = $root.google.firestore.v1.StructuredQuery.fromObject(object.structuredQuery, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.newTransaction != null) { + if (!$util.isObject(object.newTransaction)) + throw TypeError(".google.firestore.v1.RunQueryRequest.newTransaction: object expected"); + message.newTransaction = $root.google.firestore.v1.TransactionOptions.fromObject(object.newTransaction, long + 1); + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.RunQueryRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.explainOptions != null) { + if (!$util.isObject(object.explainOptions)) + throw TypeError(".google.firestore.v1.RunQueryRequest.explainOptions: object expected"); + message.explainOptions = $root.google.firestore.v1.ExplainOptions.fromObject(object.explainOptions, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a RunQueryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.RunQueryRequest + * @static + * @param {google.firestore.v1.RunQueryRequest} message RunQueryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RunQueryRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.explainOptions = null; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + object.structuredQuery = $root.google.firestore.v1.StructuredQuery.toObject(message.structuredQuery, options, q + 1); + if (options.oneofs) + object.queryType = "structuredQuery"; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + object.newTransaction = $root.google.firestore.v1.TransactionOptions.toObject(message.newTransaction, options, q + 1); + if (options.oneofs) + object.consistencySelector = "newTransaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + if (message.explainOptions != null && Object.hasOwnProperty.call(message, "explainOptions")) + object.explainOptions = $root.google.firestore.v1.ExplainOptions.toObject(message.explainOptions, options, q + 1); + return object; + }; + + /** + * Converts this RunQueryRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.RunQueryRequest + * @instance + * @returns {Object.} JSON object + */ + RunQueryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RunQueryRequest + * @function getTypeUrl + * @memberof google.firestore.v1.RunQueryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RunQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.RunQueryRequest"; + }; + + return RunQueryRequest; + })(); + + v1.RunQueryResponse = (function() { + + /** + * Properties of a RunQueryResponse. + * @memberof google.firestore.v1 + * @interface IRunQueryResponse + * @property {Uint8Array|null} [transaction] RunQueryResponse transaction + * @property {google.firestore.v1.IDocument|null} [document] RunQueryResponse document + * @property {google.protobuf.ITimestamp|null} [readTime] RunQueryResponse readTime + * @property {number|null} [skippedResults] RunQueryResponse skippedResults + * @property {boolean|null} [done] RunQueryResponse done + * @property {google.firestore.v1.IExplainMetrics|null} [explainMetrics] RunQueryResponse explainMetrics + */ + + /** + * Constructs a new RunQueryResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a RunQueryResponse. + * @implements IRunQueryResponse + * @constructor + * @param {google.firestore.v1.IRunQueryResponse=} [properties] Properties to set + */ + function RunQueryResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RunQueryResponse transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.transaction = $util.newBuffer([]); + + /** + * RunQueryResponse document. + * @member {google.firestore.v1.IDocument|null|undefined} document + * @memberof google.firestore.v1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.document = null; + + /** + * RunQueryResponse readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.readTime = null; + + /** + * RunQueryResponse skippedResults. + * @member {number} skippedResults + * @memberof google.firestore.v1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.skippedResults = 0; + + /** + * RunQueryResponse done. + * @member {boolean|null|undefined} done + * @memberof google.firestore.v1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.done = null; + + /** + * RunQueryResponse explainMetrics. + * @member {google.firestore.v1.IExplainMetrics|null|undefined} explainMetrics + * @memberof google.firestore.v1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.explainMetrics = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RunQueryResponse continuationSelector. + * @member {"done"|undefined} continuationSelector + * @memberof google.firestore.v1.RunQueryResponse + * @instance + */ + Object.defineProperty(RunQueryResponse.prototype, "continuationSelector", { + get: $util.oneOfGetter($oneOfFields = ["done"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RunQueryResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.RunQueryResponse + * @static + * @param {google.firestore.v1.IRunQueryResponse=} [properties] Properties to set + * @returns {google.firestore.v1.RunQueryResponse} RunQueryResponse instance + */ + RunQueryResponse.create = function create(properties) { + return new RunQueryResponse(properties); + }; + + /** + * Encodes the specified RunQueryResponse message. Does not implicitly {@link google.firestore.v1.RunQueryResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.RunQueryResponse + * @static + * @param {google.firestore.v1.IRunQueryResponse} message RunQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunQueryResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.firestore.v1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.transaction); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.skippedResults != null && Object.hasOwnProperty.call(message, "skippedResults")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.skippedResults); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.done); + if (message.explainMetrics != null && Object.hasOwnProperty.call(message, "explainMetrics")) + $root.google.firestore.v1.ExplainMetrics.encode(message.explainMetrics, writer.uint32(/* id 11, wireType 2 =*/90).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified RunQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1.RunQueryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.RunQueryResponse + * @static + * @param {google.firestore.v1.IRunQueryResponse} message RunQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RunQueryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.RunQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.RunQueryResponse} RunQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunQueryResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.RunQueryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.transaction = reader.bytes(); + break; + } + case 1: { + message.document = $root.google.firestore.v1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.skippedResults = reader.int32(); + break; + } + case 6: { + message.done = reader.bool(); + break; + } + case 11: { + message.explainMetrics = $root.google.firestore.v1.ExplainMetrics.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RunQueryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.RunQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.RunQueryResponse} RunQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunQueryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RunQueryResponse message. + * @function verify + * @memberof google.firestore.v1.RunQueryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RunQueryResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) { + var error = $root.google.firestore.v1.Document.verify(message.document, long + 1); + if (error) + return "document." + error; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + if (message.skippedResults != null && Object.hasOwnProperty.call(message, "skippedResults")) + if (!$util.isInteger(message.skippedResults)) + return "skippedResults: integer expected"; + if (message.done != null && Object.hasOwnProperty.call(message, "done")) { + properties.continuationSelector = 1; + if (typeof message.done !== "boolean") + return "done: boolean expected"; + } + if (message.explainMetrics != null && Object.hasOwnProperty.call(message, "explainMetrics")) { + var error = $root.google.firestore.v1.ExplainMetrics.verify(message.explainMetrics, long + 1); + if (error) + return "explainMetrics." + error; + } + return null; + }; + + /** + * Creates a RunQueryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.RunQueryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.RunQueryResponse} RunQueryResponse + */ + RunQueryResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.RunQueryResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.RunQueryResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.RunQueryResponse(); + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.document != null) { + if (!$util.isObject(object.document)) + throw TypeError(".google.firestore.v1.RunQueryResponse.document: object expected"); + message.document = $root.google.firestore.v1.Document.fromObject(object.document, long + 1); + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.RunQueryResponse.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.skippedResults != null) + message.skippedResults = object.skippedResults | 0; + if (object.done != null) + message.done = Boolean(object.done); + if (object.explainMetrics != null) { + if (!$util.isObject(object.explainMetrics)) + throw TypeError(".google.firestore.v1.RunQueryResponse.explainMetrics: object expected"); + message.explainMetrics = $root.google.firestore.v1.ExplainMetrics.fromObject(object.explainMetrics, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a RunQueryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.RunQueryResponse + * @static + * @param {google.firestore.v1.RunQueryResponse} message RunQueryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RunQueryResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.document = null; + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + object.readTime = null; + object.skippedResults = 0; + object.explainMetrics = null; + } + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = $root.google.firestore.v1.Document.toObject(message.document, options, q + 1); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (message.skippedResults != null && Object.hasOwnProperty.call(message, "skippedResults")) + object.skippedResults = message.skippedResults; + if (message.done != null && Object.hasOwnProperty.call(message, "done")) { + object.done = message.done; + if (options.oneofs) + object.continuationSelector = "done"; + } + if (message.explainMetrics != null && Object.hasOwnProperty.call(message, "explainMetrics")) + object.explainMetrics = $root.google.firestore.v1.ExplainMetrics.toObject(message.explainMetrics, options, q + 1); + return object; + }; + + /** + * Converts this RunQueryResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.RunQueryResponse + * @instance + * @returns {Object.} JSON object + */ + RunQueryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RunQueryResponse + * @function getTypeUrl + * @memberof google.firestore.v1.RunQueryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RunQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.RunQueryResponse"; + }; + + return RunQueryResponse; + })(); + + v1.ExecutePipelineRequest = (function() { + + /** + * Properties of an ExecutePipelineRequest. + * @memberof google.firestore.v1 + * @interface IExecutePipelineRequest + * @property {string|null} [database] ExecutePipelineRequest database + * @property {google.firestore.v1.IStructuredPipeline|null} [structuredPipeline] ExecutePipelineRequest structuredPipeline + * @property {Uint8Array|null} [transaction] ExecutePipelineRequest transaction + * @property {google.firestore.v1.ITransactionOptions|null} [newTransaction] ExecutePipelineRequest newTransaction + * @property {google.protobuf.ITimestamp|null} [readTime] ExecutePipelineRequest readTime + * @property {boolean|null} [autoCommitTransaction] ExecutePipelineRequest autoCommitTransaction + */ + + /** + * Constructs a new ExecutePipelineRequest. + * @memberof google.firestore.v1 + * @classdesc Represents an ExecutePipelineRequest. + * @implements IExecutePipelineRequest + * @constructor + * @param {google.firestore.v1.IExecutePipelineRequest=} [properties] Properties to set + */ + function ExecutePipelineRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExecutePipelineRequest database. + * @member {string} database + * @memberof google.firestore.v1.ExecutePipelineRequest + * @instance + */ + ExecutePipelineRequest.prototype.database = ""; + + /** + * ExecutePipelineRequest structuredPipeline. + * @member {google.firestore.v1.IStructuredPipeline|null|undefined} structuredPipeline + * @memberof google.firestore.v1.ExecutePipelineRequest + * @instance + */ + ExecutePipelineRequest.prototype.structuredPipeline = null; + + /** + * ExecutePipelineRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1.ExecutePipelineRequest + * @instance + */ + ExecutePipelineRequest.prototype.transaction = null; + + /** + * ExecutePipelineRequest newTransaction. + * @member {google.firestore.v1.ITransactionOptions|null|undefined} newTransaction + * @memberof google.firestore.v1.ExecutePipelineRequest + * @instance + */ + ExecutePipelineRequest.prototype.newTransaction = null; + + /** + * ExecutePipelineRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.ExecutePipelineRequest + * @instance + */ + ExecutePipelineRequest.prototype.readTime = null; + + /** + * ExecutePipelineRequest autoCommitTransaction. + * @member {boolean} autoCommitTransaction + * @memberof google.firestore.v1.ExecutePipelineRequest + * @instance + */ + ExecutePipelineRequest.prototype.autoCommitTransaction = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExecutePipelineRequest pipelineType. + * @member {"structuredPipeline"|undefined} pipelineType + * @memberof google.firestore.v1.ExecutePipelineRequest + * @instance + */ + Object.defineProperty(ExecutePipelineRequest.prototype, "pipelineType", { + get: $util.oneOfGetter($oneOfFields = ["structuredPipeline"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * ExecutePipelineRequest consistencySelector. + * @member {"transaction"|"newTransaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1.ExecutePipelineRequest + * @instance + */ + Object.defineProperty(ExecutePipelineRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "newTransaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExecutePipelineRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ExecutePipelineRequest + * @static + * @param {google.firestore.v1.IExecutePipelineRequest=} [properties] Properties to set + * @returns {google.firestore.v1.ExecutePipelineRequest} ExecutePipelineRequest instance + */ + ExecutePipelineRequest.create = function create(properties) { + return new ExecutePipelineRequest(properties); + }; + + /** + * Encodes the specified ExecutePipelineRequest message. Does not implicitly {@link google.firestore.v1.ExecutePipelineRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ExecutePipelineRequest + * @static + * @param {google.firestore.v1.IExecutePipelineRequest} message ExecutePipelineRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecutePipelineRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.structuredPipeline != null && Object.hasOwnProperty.call(message, "structuredPipeline")) + $root.google.firestore.v1.StructuredPipeline.encode(message.structuredPipeline, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.transaction); + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) + $root.google.firestore.v1.TransactionOptions.encode(message.newTransaction, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.autoCommitTransaction != null && Object.hasOwnProperty.call(message, "autoCommitTransaction")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.autoCommitTransaction); + return writer; + }; + + /** + * Encodes the specified ExecutePipelineRequest message, length delimited. Does not implicitly {@link google.firestore.v1.ExecutePipelineRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ExecutePipelineRequest + * @static + * @param {google.firestore.v1.IExecutePipelineRequest} message ExecutePipelineRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecutePipelineRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExecutePipelineRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ExecutePipelineRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ExecutePipelineRequest} ExecutePipelineRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecutePipelineRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ExecutePipelineRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.structuredPipeline = $root.google.firestore.v1.StructuredPipeline.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.transaction = reader.bytes(); + break; + } + case 6: { + message.newTransaction = $root.google.firestore.v1.TransactionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 9: { + message.autoCommitTransaction = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExecutePipelineRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ExecutePipelineRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ExecutePipelineRequest} ExecutePipelineRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecutePipelineRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExecutePipelineRequest message. + * @function verify + * @memberof google.firestore.v1.ExecutePipelineRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExecutePipelineRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.structuredPipeline != null && Object.hasOwnProperty.call(message, "structuredPipeline")) { + properties.pipelineType = 1; + { + var error = $root.google.firestore.v1.StructuredPipeline.verify(message.structuredPipeline, long + 1); + if (error) + return "structuredPipeline." + error; + } + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.firestore.v1.TransactionOptions.verify(message.newTransaction, long + 1); + if (error) + return "newTransaction." + error; + } + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + if (message.autoCommitTransaction != null && Object.hasOwnProperty.call(message, "autoCommitTransaction")) + if (typeof message.autoCommitTransaction !== "boolean") + return "autoCommitTransaction: boolean expected"; + return null; + }; + + /** + * Creates an ExecutePipelineRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ExecutePipelineRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ExecutePipelineRequest} ExecutePipelineRequest + */ + ExecutePipelineRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ExecutePipelineRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ExecutePipelineRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ExecutePipelineRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.structuredPipeline != null) { + if (!$util.isObject(object.structuredPipeline)) + throw TypeError(".google.firestore.v1.ExecutePipelineRequest.structuredPipeline: object expected"); + message.structuredPipeline = $root.google.firestore.v1.StructuredPipeline.fromObject(object.structuredPipeline, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.newTransaction != null) { + if (!$util.isObject(object.newTransaction)) + throw TypeError(".google.firestore.v1.ExecutePipelineRequest.newTransaction: object expected"); + message.newTransaction = $root.google.firestore.v1.TransactionOptions.fromObject(object.newTransaction, long + 1); + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.ExecutePipelineRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.autoCommitTransaction != null) + message.autoCommitTransaction = Boolean(object.autoCommitTransaction); + return message; + }; + + /** + * Creates a plain object from an ExecutePipelineRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ExecutePipelineRequest + * @static + * @param {google.firestore.v1.ExecutePipelineRequest} message ExecutePipelineRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExecutePipelineRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.database = ""; + object.autoCommitTransaction = false; + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.structuredPipeline != null && Object.hasOwnProperty.call(message, "structuredPipeline")) { + object.structuredPipeline = $root.google.firestore.v1.StructuredPipeline.toObject(message.structuredPipeline, options, q + 1); + if (options.oneofs) + object.pipelineType = "structuredPipeline"; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + object.newTransaction = $root.google.firestore.v1.TransactionOptions.toObject(message.newTransaction, options, q + 1); + if (options.oneofs) + object.consistencySelector = "newTransaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + if (message.autoCommitTransaction != null && Object.hasOwnProperty.call(message, "autoCommitTransaction")) + object.autoCommitTransaction = message.autoCommitTransaction; + return object; + }; + + /** + * Converts this ExecutePipelineRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.ExecutePipelineRequest + * @instance + * @returns {Object.} JSON object + */ + ExecutePipelineRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExecutePipelineRequest + * @function getTypeUrl + * @memberof google.firestore.v1.ExecutePipelineRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExecutePipelineRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ExecutePipelineRequest"; + }; + + return ExecutePipelineRequest; + })(); + + v1.ExecutePipelineResponse = (function() { + + /** + * Properties of an ExecutePipelineResponse. + * @memberof google.firestore.v1 + * @interface IExecutePipelineResponse + * @property {Uint8Array|null} [transaction] ExecutePipelineResponse transaction + * @property {Array.|null} [results] ExecutePipelineResponse results + * @property {google.protobuf.ITimestamp|null} [executionTime] ExecutePipelineResponse executionTime + * @property {google.firestore.v1.IExplainStats|null} [explainStats] ExecutePipelineResponse explainStats + */ + + /** + * Constructs a new ExecutePipelineResponse. + * @memberof google.firestore.v1 + * @classdesc Represents an ExecutePipelineResponse. + * @implements IExecutePipelineResponse + * @constructor + * @param {google.firestore.v1.IExecutePipelineResponse=} [properties] Properties to set + */ + function ExecutePipelineResponse(properties) { + this.results = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExecutePipelineResponse transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1.ExecutePipelineResponse + * @instance + */ + ExecutePipelineResponse.prototype.transaction = $util.newBuffer([]); + + /** + * ExecutePipelineResponse results. + * @member {Array.} results + * @memberof google.firestore.v1.ExecutePipelineResponse + * @instance + */ + ExecutePipelineResponse.prototype.results = $util.emptyArray; + + /** + * ExecutePipelineResponse executionTime. + * @member {google.protobuf.ITimestamp|null|undefined} executionTime + * @memberof google.firestore.v1.ExecutePipelineResponse + * @instance + */ + ExecutePipelineResponse.prototype.executionTime = null; + + /** + * ExecutePipelineResponse explainStats. + * @member {google.firestore.v1.IExplainStats|null|undefined} explainStats + * @memberof google.firestore.v1.ExecutePipelineResponse + * @instance + */ + ExecutePipelineResponse.prototype.explainStats = null; + + /** + * Creates a new ExecutePipelineResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ExecutePipelineResponse + * @static + * @param {google.firestore.v1.IExecutePipelineResponse=} [properties] Properties to set + * @returns {google.firestore.v1.ExecutePipelineResponse} ExecutePipelineResponse instance + */ + ExecutePipelineResponse.create = function create(properties) { + return new ExecutePipelineResponse(properties); + }; + + /** + * Encodes the specified ExecutePipelineResponse message. Does not implicitly {@link google.firestore.v1.ExecutePipelineResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ExecutePipelineResponse + * @static + * @param {google.firestore.v1.IExecutePipelineResponse} message ExecutePipelineResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecutePipelineResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.transaction); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.firestore.v1.Document.encode(message.results[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.executionTime != null && Object.hasOwnProperty.call(message, "executionTime")) + $root.google.protobuf.Timestamp.encode(message.executionTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.explainStats != null && Object.hasOwnProperty.call(message, "explainStats")) + $root.google.firestore.v1.ExplainStats.encode(message.explainStats, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExecutePipelineResponse message, length delimited. Does not implicitly {@link google.firestore.v1.ExecutePipelineResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ExecutePipelineResponse + * @static + * @param {google.firestore.v1.IExecutePipelineResponse} message ExecutePipelineResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecutePipelineResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExecutePipelineResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ExecutePipelineResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ExecutePipelineResponse} ExecutePipelineResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecutePipelineResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ExecutePipelineResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.transaction = reader.bytes(); + break; + } + case 2: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.firestore.v1.Document.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + message.executionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.explainStats = $root.google.firestore.v1.ExplainStats.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExecutePipelineResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ExecutePipelineResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ExecutePipelineResponse} ExecutePipelineResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecutePipelineResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExecutePipelineResponse message. + * @function verify + * @memberof google.firestore.v1.ExecutePipelineResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExecutePipelineResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + if (message.results != null && Object.hasOwnProperty.call(message, "results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.firestore.v1.Document.verify(message.results[i], long + 1); + if (error) + return "results." + error; + } + } + if (message.executionTime != null && Object.hasOwnProperty.call(message, "executionTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.executionTime, long + 1); + if (error) + return "executionTime." + error; + } + if (message.explainStats != null && Object.hasOwnProperty.call(message, "explainStats")) { + var error = $root.google.firestore.v1.ExplainStats.verify(message.explainStats, long + 1); + if (error) + return "explainStats." + error; + } + return null; + }; + + /** + * Creates an ExecutePipelineResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ExecutePipelineResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ExecutePipelineResponse} ExecutePipelineResponse + */ + ExecutePipelineResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ExecutePipelineResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ExecutePipelineResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ExecutePipelineResponse(); + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.firestore.v1.ExecutePipelineResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (!$util.isObject(object.results[i])) + throw TypeError(".google.firestore.v1.ExecutePipelineResponse.results: object expected"); + message.results[i] = $root.google.firestore.v1.Document.fromObject(object.results[i], long + 1); + } + } + if (object.executionTime != null) { + if (!$util.isObject(object.executionTime)) + throw TypeError(".google.firestore.v1.ExecutePipelineResponse.executionTime: object expected"); + message.executionTime = $root.google.protobuf.Timestamp.fromObject(object.executionTime, long + 1); + } + if (object.explainStats != null) { + if (!$util.isObject(object.explainStats)) + throw TypeError(".google.firestore.v1.ExecutePipelineResponse.explainStats: object expected"); + message.explainStats = $root.google.firestore.v1.ExplainStats.fromObject(object.explainStats, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an ExecutePipelineResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ExecutePipelineResponse + * @static + * @param {google.firestore.v1.ExecutePipelineResponse} message ExecutePipelineResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExecutePipelineResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.results = []; + if (options.defaults) { + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + object.executionTime = null; + object.explainStats = null; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.firestore.v1.Document.toObject(message.results[j], options, q + 1); + } + if (message.executionTime != null && Object.hasOwnProperty.call(message, "executionTime")) + object.executionTime = $root.google.protobuf.Timestamp.toObject(message.executionTime, options, q + 1); + if (message.explainStats != null && Object.hasOwnProperty.call(message, "explainStats")) + object.explainStats = $root.google.firestore.v1.ExplainStats.toObject(message.explainStats, options, q + 1); + return object; + }; + + /** + * Converts this ExecutePipelineResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.ExecutePipelineResponse + * @instance + * @returns {Object.} JSON object + */ + ExecutePipelineResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExecutePipelineResponse + * @function getTypeUrl + * @memberof google.firestore.v1.ExecutePipelineResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExecutePipelineResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ExecutePipelineResponse"; + }; + + return ExecutePipelineResponse; + })(); + + v1.RunAggregationQueryRequest = (function() { + + /** + * Properties of a RunAggregationQueryRequest. + * @memberof google.firestore.v1 + * @interface IRunAggregationQueryRequest + * @property {string|null} [parent] RunAggregationQueryRequest parent + * @property {google.firestore.v1.IStructuredAggregationQuery|null} [structuredAggregationQuery] RunAggregationQueryRequest structuredAggregationQuery + * @property {Uint8Array|null} [transaction] RunAggregationQueryRequest transaction + * @property {google.firestore.v1.ITransactionOptions|null} [newTransaction] RunAggregationQueryRequest newTransaction + * @property {google.protobuf.ITimestamp|null} [readTime] RunAggregationQueryRequest readTime + * @property {google.firestore.v1.IExplainOptions|null} [explainOptions] RunAggregationQueryRequest explainOptions + */ + + /** + * Constructs a new RunAggregationQueryRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a RunAggregationQueryRequest. + * @implements IRunAggregationQueryRequest + * @constructor + * @param {google.firestore.v1.IRunAggregationQueryRequest=} [properties] Properties to set + */ + function RunAggregationQueryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RunAggregationQueryRequest parent. + * @member {string} parent + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @instance + */ + RunAggregationQueryRequest.prototype.parent = ""; + + /** + * RunAggregationQueryRequest structuredAggregationQuery. + * @member {google.firestore.v1.IStructuredAggregationQuery|null|undefined} structuredAggregationQuery + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @instance + */ + RunAggregationQueryRequest.prototype.structuredAggregationQuery = null; + + /** + * RunAggregationQueryRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @instance + */ + RunAggregationQueryRequest.prototype.transaction = null; + + /** + * RunAggregationQueryRequest newTransaction. + * @member {google.firestore.v1.ITransactionOptions|null|undefined} newTransaction + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @instance + */ + RunAggregationQueryRequest.prototype.newTransaction = null; + + /** + * RunAggregationQueryRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @instance + */ + RunAggregationQueryRequest.prototype.readTime = null; + + /** + * RunAggregationQueryRequest explainOptions. + * @member {google.firestore.v1.IExplainOptions|null|undefined} explainOptions + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @instance + */ + RunAggregationQueryRequest.prototype.explainOptions = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RunAggregationQueryRequest queryType. + * @member {"structuredAggregationQuery"|undefined} queryType + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @instance + */ + Object.defineProperty(RunAggregationQueryRequest.prototype, "queryType", { + get: $util.oneOfGetter($oneOfFields = ["structuredAggregationQuery"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * RunAggregationQueryRequest consistencySelector. + * @member {"transaction"|"newTransaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @instance + */ + Object.defineProperty(RunAggregationQueryRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "newTransaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RunAggregationQueryRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @static + * @param {google.firestore.v1.IRunAggregationQueryRequest=} [properties] Properties to set + * @returns {google.firestore.v1.RunAggregationQueryRequest} RunAggregationQueryRequest instance + */ + RunAggregationQueryRequest.create = function create(properties) { + return new RunAggregationQueryRequest(properties); + }; + + /** + * Encodes the specified RunAggregationQueryRequest message. Does not implicitly {@link google.firestore.v1.RunAggregationQueryRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @static + * @param {google.firestore.v1.IRunAggregationQueryRequest} message RunAggregationQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunAggregationQueryRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.structuredAggregationQuery != null && Object.hasOwnProperty.call(message, "structuredAggregationQuery")) + $root.google.firestore.v1.StructuredAggregationQuery.encode(message.structuredAggregationQuery, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.transaction); + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) + $root.google.firestore.v1.TransactionOptions.encode(message.newTransaction, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.explainOptions != null && Object.hasOwnProperty.call(message, "explainOptions")) + $root.google.firestore.v1.ExplainOptions.encode(message.explainOptions, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified RunAggregationQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1.RunAggregationQueryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @static + * @param {google.firestore.v1.IRunAggregationQueryRequest} message RunAggregationQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunAggregationQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RunAggregationQueryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.RunAggregationQueryRequest} RunAggregationQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunAggregationQueryRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.RunAggregationQueryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.structuredAggregationQuery = $root.google.firestore.v1.StructuredAggregationQuery.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.transaction = reader.bytes(); + break; + } + case 5: { + message.newTransaction = $root.google.firestore.v1.TransactionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 8: { + message.explainOptions = $root.google.firestore.v1.ExplainOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RunAggregationQueryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.RunAggregationQueryRequest} RunAggregationQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunAggregationQueryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RunAggregationQueryRequest message. + * @function verify + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RunAggregationQueryRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.structuredAggregationQuery != null && Object.hasOwnProperty.call(message, "structuredAggregationQuery")) { + properties.queryType = 1; + { + var error = $root.google.firestore.v1.StructuredAggregationQuery.verify(message.structuredAggregationQuery, long + 1); + if (error) + return "structuredAggregationQuery." + error; + } + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.firestore.v1.TransactionOptions.verify(message.newTransaction, long + 1); + if (error) + return "newTransaction." + error; + } + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + if (message.explainOptions != null && Object.hasOwnProperty.call(message, "explainOptions")) { + var error = $root.google.firestore.v1.ExplainOptions.verify(message.explainOptions, long + 1); + if (error) + return "explainOptions." + error; + } + return null; + }; + + /** + * Creates a RunAggregationQueryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.RunAggregationQueryRequest} RunAggregationQueryRequest + */ + RunAggregationQueryRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.RunAggregationQueryRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.RunAggregationQueryRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.RunAggregationQueryRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.structuredAggregationQuery != null) { + if (!$util.isObject(object.structuredAggregationQuery)) + throw TypeError(".google.firestore.v1.RunAggregationQueryRequest.structuredAggregationQuery: object expected"); + message.structuredAggregationQuery = $root.google.firestore.v1.StructuredAggregationQuery.fromObject(object.structuredAggregationQuery, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.newTransaction != null) { + if (!$util.isObject(object.newTransaction)) + throw TypeError(".google.firestore.v1.RunAggregationQueryRequest.newTransaction: object expected"); + message.newTransaction = $root.google.firestore.v1.TransactionOptions.fromObject(object.newTransaction, long + 1); + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.RunAggregationQueryRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.explainOptions != null) { + if (!$util.isObject(object.explainOptions)) + throw TypeError(".google.firestore.v1.RunAggregationQueryRequest.explainOptions: object expected"); + message.explainOptions = $root.google.firestore.v1.ExplainOptions.fromObject(object.explainOptions, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a RunAggregationQueryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @static + * @param {google.firestore.v1.RunAggregationQueryRequest} message RunAggregationQueryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RunAggregationQueryRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.explainOptions = null; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.structuredAggregationQuery != null && Object.hasOwnProperty.call(message, "structuredAggregationQuery")) { + object.structuredAggregationQuery = $root.google.firestore.v1.StructuredAggregationQuery.toObject(message.structuredAggregationQuery, options, q + 1); + if (options.oneofs) + object.queryType = "structuredAggregationQuery"; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + object.newTransaction = $root.google.firestore.v1.TransactionOptions.toObject(message.newTransaction, options, q + 1); + if (options.oneofs) + object.consistencySelector = "newTransaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + if (message.explainOptions != null && Object.hasOwnProperty.call(message, "explainOptions")) + object.explainOptions = $root.google.firestore.v1.ExplainOptions.toObject(message.explainOptions, options, q + 1); + return object; + }; + + /** + * Converts this RunAggregationQueryRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @instance + * @returns {Object.} JSON object + */ + RunAggregationQueryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RunAggregationQueryRequest + * @function getTypeUrl + * @memberof google.firestore.v1.RunAggregationQueryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RunAggregationQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.RunAggregationQueryRequest"; + }; + + return RunAggregationQueryRequest; + })(); + + v1.RunAggregationQueryResponse = (function() { + + /** + * Properties of a RunAggregationQueryResponse. + * @memberof google.firestore.v1 + * @interface IRunAggregationQueryResponse + * @property {google.firestore.v1.IAggregationResult|null} [result] RunAggregationQueryResponse result + * @property {Uint8Array|null} [transaction] RunAggregationQueryResponse transaction + * @property {google.protobuf.ITimestamp|null} [readTime] RunAggregationQueryResponse readTime + * @property {google.firestore.v1.IExplainMetrics|null} [explainMetrics] RunAggregationQueryResponse explainMetrics + */ + + /** + * Constructs a new RunAggregationQueryResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a RunAggregationQueryResponse. + * @implements IRunAggregationQueryResponse + * @constructor + * @param {google.firestore.v1.IRunAggregationQueryResponse=} [properties] Properties to set + */ + function RunAggregationQueryResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RunAggregationQueryResponse result. + * @member {google.firestore.v1.IAggregationResult|null|undefined} result + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @instance + */ + RunAggregationQueryResponse.prototype.result = null; + + /** + * RunAggregationQueryResponse transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @instance + */ + RunAggregationQueryResponse.prototype.transaction = $util.newBuffer([]); + + /** + * RunAggregationQueryResponse readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @instance + */ + RunAggregationQueryResponse.prototype.readTime = null; + + /** + * RunAggregationQueryResponse explainMetrics. + * @member {google.firestore.v1.IExplainMetrics|null|undefined} explainMetrics + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @instance + */ + RunAggregationQueryResponse.prototype.explainMetrics = null; + + /** + * Creates a new RunAggregationQueryResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @static + * @param {google.firestore.v1.IRunAggregationQueryResponse=} [properties] Properties to set + * @returns {google.firestore.v1.RunAggregationQueryResponse} RunAggregationQueryResponse instance + */ + RunAggregationQueryResponse.create = function create(properties) { + return new RunAggregationQueryResponse(properties); + }; + + /** + * Encodes the specified RunAggregationQueryResponse message. Does not implicitly {@link google.firestore.v1.RunAggregationQueryResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @static + * @param {google.firestore.v1.IRunAggregationQueryResponse} message RunAggregationQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunAggregationQueryResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + $root.google.firestore.v1.AggregationResult.encode(message.result, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.transaction); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.explainMetrics != null && Object.hasOwnProperty.call(message, "explainMetrics")) + $root.google.firestore.v1.ExplainMetrics.encode(message.explainMetrics, writer.uint32(/* id 10, wireType 2 =*/82).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified RunAggregationQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1.RunAggregationQueryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @static + * @param {google.firestore.v1.IRunAggregationQueryResponse} message RunAggregationQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunAggregationQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RunAggregationQueryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.RunAggregationQueryResponse} RunAggregationQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunAggregationQueryResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.RunAggregationQueryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.result = $root.google.firestore.v1.AggregationResult.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.transaction = reader.bytes(); + break; + } + case 3: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 10: { + message.explainMetrics = $root.google.firestore.v1.ExplainMetrics.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RunAggregationQueryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.RunAggregationQueryResponse} RunAggregationQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunAggregationQueryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RunAggregationQueryResponse message. + * @function verify + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RunAggregationQueryResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.result != null && Object.hasOwnProperty.call(message, "result")) { + var error = $root.google.firestore.v1.AggregationResult.verify(message.result, long + 1); + if (error) + return "result." + error; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + if (message.explainMetrics != null && Object.hasOwnProperty.call(message, "explainMetrics")) { + var error = $root.google.firestore.v1.ExplainMetrics.verify(message.explainMetrics, long + 1); + if (error) + return "explainMetrics." + error; + } + return null; + }; + + /** + * Creates a RunAggregationQueryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.RunAggregationQueryResponse} RunAggregationQueryResponse + */ + RunAggregationQueryResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.RunAggregationQueryResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.RunAggregationQueryResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.RunAggregationQueryResponse(); + if (object.result != null) { + if (!$util.isObject(object.result)) + throw TypeError(".google.firestore.v1.RunAggregationQueryResponse.result: object expected"); + message.result = $root.google.firestore.v1.AggregationResult.fromObject(object.result, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.RunAggregationQueryResponse.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.explainMetrics != null) { + if (!$util.isObject(object.explainMetrics)) + throw TypeError(".google.firestore.v1.RunAggregationQueryResponse.explainMetrics: object expected"); + message.explainMetrics = $root.google.firestore.v1.ExplainMetrics.fromObject(object.explainMetrics, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a RunAggregationQueryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @static + * @param {google.firestore.v1.RunAggregationQueryResponse} message RunAggregationQueryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RunAggregationQueryResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.result = null; + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + object.readTime = null; + object.explainMetrics = null; + } + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + object.result = $root.google.firestore.v1.AggregationResult.toObject(message.result, options, q + 1); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (message.explainMetrics != null && Object.hasOwnProperty.call(message, "explainMetrics")) + object.explainMetrics = $root.google.firestore.v1.ExplainMetrics.toObject(message.explainMetrics, options, q + 1); + return object; + }; + + /** + * Converts this RunAggregationQueryResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @instance + * @returns {Object.} JSON object + */ + RunAggregationQueryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RunAggregationQueryResponse + * @function getTypeUrl + * @memberof google.firestore.v1.RunAggregationQueryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RunAggregationQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.RunAggregationQueryResponse"; + }; + + return RunAggregationQueryResponse; + })(); + + v1.PartitionQueryRequest = (function() { + + /** + * Properties of a PartitionQueryRequest. + * @memberof google.firestore.v1 + * @interface IPartitionQueryRequest + * @property {string|null} [parent] PartitionQueryRequest parent + * @property {google.firestore.v1.IStructuredQuery|null} [structuredQuery] PartitionQueryRequest structuredQuery + * @property {number|Long|null} [partitionCount] PartitionQueryRequest partitionCount + * @property {string|null} [pageToken] PartitionQueryRequest pageToken + * @property {number|null} [pageSize] PartitionQueryRequest pageSize + * @property {google.protobuf.ITimestamp|null} [readTime] PartitionQueryRequest readTime + */ + + /** + * Constructs a new PartitionQueryRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a PartitionQueryRequest. + * @implements IPartitionQueryRequest + * @constructor + * @param {google.firestore.v1.IPartitionQueryRequest=} [properties] Properties to set + */ + function PartitionQueryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * PartitionQueryRequest parent. + * @member {string} parent + * @memberof google.firestore.v1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.parent = ""; + + /** + * PartitionQueryRequest structuredQuery. + * @member {google.firestore.v1.IStructuredQuery|null|undefined} structuredQuery + * @memberof google.firestore.v1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.structuredQuery = null; + + /** + * PartitionQueryRequest partitionCount. + * @member {number|Long} partitionCount + * @memberof google.firestore.v1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.partitionCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * PartitionQueryRequest pageToken. + * @member {string} pageToken + * @memberof google.firestore.v1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.pageToken = ""; + + /** + * PartitionQueryRequest pageSize. + * @member {number} pageSize + * @memberof google.firestore.v1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.pageSize = 0; + + /** + * PartitionQueryRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * PartitionQueryRequest queryType. + * @member {"structuredQuery"|undefined} queryType + * @memberof google.firestore.v1.PartitionQueryRequest + * @instance + */ + Object.defineProperty(PartitionQueryRequest.prototype, "queryType", { + get: $util.oneOfGetter($oneOfFields = ["structuredQuery"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * PartitionQueryRequest consistencySelector. + * @member {"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1.PartitionQueryRequest + * @instance + */ + Object.defineProperty(PartitionQueryRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PartitionQueryRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.PartitionQueryRequest + * @static + * @param {google.firestore.v1.IPartitionQueryRequest=} [properties] Properties to set + * @returns {google.firestore.v1.PartitionQueryRequest} PartitionQueryRequest instance + */ + PartitionQueryRequest.create = function create(properties) { + return new PartitionQueryRequest(properties); + }; + + /** + * Encodes the specified PartitionQueryRequest message. Does not implicitly {@link google.firestore.v1.PartitionQueryRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.PartitionQueryRequest + * @static + * @param {google.firestore.v1.IPartitionQueryRequest} message PartitionQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartitionQueryRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) + $root.google.firestore.v1.StructuredQuery.encode(message.structuredQuery, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.partitionCount != null && Object.hasOwnProperty.call(message, "partitionCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.partitionCount); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.pageSize); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified PartitionQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1.PartitionQueryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.PartitionQueryRequest + * @static + * @param {google.firestore.v1.IPartitionQueryRequest} message PartitionQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartitionQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a PartitionQueryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.PartitionQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.PartitionQueryRequest} PartitionQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartitionQueryRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.PartitionQueryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.structuredQuery = $root.google.firestore.v1.StructuredQuery.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.partitionCount = reader.int64(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.pageSize = reader.int32(); + break; + } + case 6: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a PartitionQueryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.PartitionQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.PartitionQueryRequest} PartitionQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartitionQueryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PartitionQueryRequest message. + * @function verify + * @memberof google.firestore.v1.PartitionQueryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PartitionQueryRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + properties.queryType = 1; + { + var error = $root.google.firestore.v1.StructuredQuery.verify(message.structuredQuery, long + 1); + if (error) + return "structuredQuery." + error; + } + } + if (message.partitionCount != null && Object.hasOwnProperty.call(message, "partitionCount")) + if (!$util.isInteger(message.partitionCount) && !(message.partitionCount && $util.isInteger(message.partitionCount.low) && $util.isInteger(message.partitionCount.high))) + return "partitionCount: integer|Long expected"; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + return null; + }; + + /** + * Creates a PartitionQueryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.PartitionQueryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.PartitionQueryRequest} PartitionQueryRequest + */ + PartitionQueryRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.PartitionQueryRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.PartitionQueryRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.PartitionQueryRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.structuredQuery != null) { + if (!$util.isObject(object.structuredQuery)) + throw TypeError(".google.firestore.v1.PartitionQueryRequest.structuredQuery: object expected"); + message.structuredQuery = $root.google.firestore.v1.StructuredQuery.fromObject(object.structuredQuery, long + 1); + } + if (object.partitionCount != null) + if ($util.Long) + message.partitionCount = $util.Long.fromValue(object.partitionCount, false); + else if (typeof object.partitionCount === "string") + message.partitionCount = parseInt(object.partitionCount, 10); + else if (typeof object.partitionCount === "number") + message.partitionCount = object.partitionCount; + else if (typeof object.partitionCount === "object") + message.partitionCount = new $util.LongBits(object.partitionCount.low >>> 0, object.partitionCount.high >>> 0).toNumber(); + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.PartitionQueryRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a PartitionQueryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.PartitionQueryRequest + * @static + * @param {google.firestore.v1.PartitionQueryRequest} message PartitionQueryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PartitionQueryRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.partitionCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.partitionCount = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + object.pageToken = ""; + object.pageSize = 0; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + object.structuredQuery = $root.google.firestore.v1.StructuredQuery.toObject(message.structuredQuery, options, q + 1); + if (options.oneofs) + object.queryType = "structuredQuery"; + } + if (message.partitionCount != null && Object.hasOwnProperty.call(message, "partitionCount")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.partitionCount = typeof message.partitionCount === "number" ? BigInt(message.partitionCount) : $util.Long.fromBits(message.partitionCount.low >>> 0, message.partitionCount.high >>> 0, false).toBigInt(); + else if (typeof message.partitionCount === "number") + object.partitionCount = options.longs === String ? String(message.partitionCount) : message.partitionCount; + else + object.partitionCount = options.longs === String ? $util.Long.prototype.toString.call(message.partitionCount) : options.longs === Number ? new $util.LongBits(message.partitionCount.low >>> 0, message.partitionCount.high >>> 0).toNumber() : message.partitionCount; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + object.pageToken = message.pageToken; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + object.pageSize = message.pageSize; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + return object; + }; + + /** + * Converts this PartitionQueryRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.PartitionQueryRequest + * @instance + * @returns {Object.} JSON object + */ + PartitionQueryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PartitionQueryRequest + * @function getTypeUrl + * @memberof google.firestore.v1.PartitionQueryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PartitionQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.PartitionQueryRequest"; + }; + + return PartitionQueryRequest; + })(); + + v1.PartitionQueryResponse = (function() { + + /** + * Properties of a PartitionQueryResponse. + * @memberof google.firestore.v1 + * @interface IPartitionQueryResponse + * @property {Array.|null} [partitions] PartitionQueryResponse partitions + * @property {string|null} [nextPageToken] PartitionQueryResponse nextPageToken + */ + + /** + * Constructs a new PartitionQueryResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a PartitionQueryResponse. + * @implements IPartitionQueryResponse + * @constructor + * @param {google.firestore.v1.IPartitionQueryResponse=} [properties] Properties to set + */ + function PartitionQueryResponse(properties) { + this.partitions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * PartitionQueryResponse partitions. + * @member {Array.} partitions + * @memberof google.firestore.v1.PartitionQueryResponse + * @instance + */ + PartitionQueryResponse.prototype.partitions = $util.emptyArray; + + /** + * PartitionQueryResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.firestore.v1.PartitionQueryResponse + * @instance + */ + PartitionQueryResponse.prototype.nextPageToken = ""; + + /** + * Creates a new PartitionQueryResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.PartitionQueryResponse + * @static + * @param {google.firestore.v1.IPartitionQueryResponse=} [properties] Properties to set + * @returns {google.firestore.v1.PartitionQueryResponse} PartitionQueryResponse instance + */ + PartitionQueryResponse.create = function create(properties) { + return new PartitionQueryResponse(properties); + }; + + /** + * Encodes the specified PartitionQueryResponse message. Does not implicitly {@link google.firestore.v1.PartitionQueryResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.PartitionQueryResponse + * @static + * @param {google.firestore.v1.IPartitionQueryResponse} message PartitionQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartitionQueryResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.partitions != null && message.partitions.length) + for (var i = 0; i < message.partitions.length; ++i) + $root.google.firestore.v1.Cursor.encode(message.partitions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified PartitionQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1.PartitionQueryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.PartitionQueryResponse + * @static + * @param {google.firestore.v1.IPartitionQueryResponse} message PartitionQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartitionQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a PartitionQueryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.PartitionQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.PartitionQueryResponse} PartitionQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartitionQueryResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.PartitionQueryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.partitions && message.partitions.length)) + message.partitions = []; + message.partitions.push($root.google.firestore.v1.Cursor.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a PartitionQueryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.PartitionQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.PartitionQueryResponse} PartitionQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartitionQueryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PartitionQueryResponse message. + * @function verify + * @memberof google.firestore.v1.PartitionQueryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PartitionQueryResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.partitions != null && Object.hasOwnProperty.call(message, "partitions")) { + if (!Array.isArray(message.partitions)) + return "partitions: array expected"; + for (var i = 0; i < message.partitions.length; ++i) { + var error = $root.google.firestore.v1.Cursor.verify(message.partitions[i], long + 1); + if (error) + return "partitions." + error; + } + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a PartitionQueryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.PartitionQueryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.PartitionQueryResponse} PartitionQueryResponse + */ + PartitionQueryResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.PartitionQueryResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.PartitionQueryResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.PartitionQueryResponse(); + if (object.partitions) { + if (!Array.isArray(object.partitions)) + throw TypeError(".google.firestore.v1.PartitionQueryResponse.partitions: array expected"); + message.partitions = []; + for (var i = 0; i < object.partitions.length; ++i) { + if (!$util.isObject(object.partitions[i])) + throw TypeError(".google.firestore.v1.PartitionQueryResponse.partitions: object expected"); + message.partitions[i] = $root.google.firestore.v1.Cursor.fromObject(object.partitions[i], long + 1); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a PartitionQueryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.PartitionQueryResponse + * @static + * @param {google.firestore.v1.PartitionQueryResponse} message PartitionQueryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PartitionQueryResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.partitions = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.partitions && message.partitions.length) { + object.partitions = []; + for (var j = 0; j < message.partitions.length; ++j) + object.partitions[j] = $root.google.firestore.v1.Cursor.toObject(message.partitions[j], options, q + 1); + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this PartitionQueryResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.PartitionQueryResponse + * @instance + * @returns {Object.} JSON object + */ + PartitionQueryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PartitionQueryResponse + * @function getTypeUrl + * @memberof google.firestore.v1.PartitionQueryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PartitionQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.PartitionQueryResponse"; + }; + + return PartitionQueryResponse; + })(); + + v1.WriteRequest = (function() { + + /** + * Properties of a WriteRequest. + * @memberof google.firestore.v1 + * @interface IWriteRequest + * @property {string|null} [database] WriteRequest database + * @property {string|null} [streamId] WriteRequest streamId + * @property {Array.|null} [writes] WriteRequest writes + * @property {Uint8Array|null} [streamToken] WriteRequest streamToken + * @property {Object.|null} [labels] WriteRequest labels + */ + + /** + * Constructs a new WriteRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a WriteRequest. + * @implements IWriteRequest + * @constructor + * @param {google.firestore.v1.IWriteRequest=} [properties] Properties to set + */ + function WriteRequest(properties) { + this.writes = []; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteRequest database. + * @member {string} database + * @memberof google.firestore.v1.WriteRequest + * @instance + */ + WriteRequest.prototype.database = ""; + + /** + * WriteRequest streamId. + * @member {string} streamId + * @memberof google.firestore.v1.WriteRequest + * @instance + */ + WriteRequest.prototype.streamId = ""; + + /** + * WriteRequest writes. + * @member {Array.} writes + * @memberof google.firestore.v1.WriteRequest + * @instance + */ + WriteRequest.prototype.writes = $util.emptyArray; + + /** + * WriteRequest streamToken. + * @member {Uint8Array} streamToken + * @memberof google.firestore.v1.WriteRequest + * @instance + */ + WriteRequest.prototype.streamToken = $util.newBuffer([]); + + /** + * WriteRequest labels. + * @member {Object.} labels + * @memberof google.firestore.v1.WriteRequest + * @instance + */ + WriteRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new WriteRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.WriteRequest + * @static + * @param {google.firestore.v1.IWriteRequest=} [properties] Properties to set + * @returns {google.firestore.v1.WriteRequest} WriteRequest instance + */ + WriteRequest.create = function create(properties) { + return new WriteRequest(properties); + }; + + /** + * Encodes the specified WriteRequest message. Does not implicitly {@link google.firestore.v1.WriteRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.WriteRequest + * @static + * @param {google.firestore.v1.IWriteRequest} message WriteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.streamId); + if (message.writes != null && message.writes.length) + for (var i = 0; i < message.writes.length; ++i) + $root.google.firestore.v1.Write.encode(message.writes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.streamToken); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteRequest message, length delimited. Does not implicitly {@link google.firestore.v1.WriteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.WriteRequest + * @static + * @param {google.firestore.v1.IWriteRequest} message WriteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a WriteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.WriteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.WriteRequest} WriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.WriteRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.streamId = reader.string(); + break; + } + case 3: { + if (!(message.writes && message.writes.length)) + message.writes = []; + message.writes.push($root.google.firestore.v1.Write.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 4: { + message.streamToken = reader.bytes(); + break; + } + case 5: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.labels, key); + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a WriteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.WriteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.WriteRequest} WriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteRequest message. + * @function verify + * @memberof google.firestore.v1.WriteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + if (!$util.isString(message.streamId)) + return "streamId: string expected"; + if (message.writes != null && Object.hasOwnProperty.call(message, "writes")) { + if (!Array.isArray(message.writes)) + return "writes: array expected"; + for (var i = 0; i < message.writes.length; ++i) { + var error = $root.google.firestore.v1.Write.verify(message.writes[i], long + 1); + if (error) + return "writes." + error; + } + } + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + if (!(message.streamToken && typeof message.streamToken.length === "number" || $util.isString(message.streamToken))) + return "streamToken: buffer expected"; + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a WriteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.WriteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.WriteRequest} WriteRequest + */ + WriteRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.WriteRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.WriteRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.WriteRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.streamId != null) + message.streamId = String(object.streamId); + if (object.writes) { + if (!Array.isArray(object.writes)) + throw TypeError(".google.firestore.v1.WriteRequest.writes: array expected"); + message.writes = []; + for (var i = 0; i < object.writes.length; ++i) { + if (!$util.isObject(object.writes[i])) + throw TypeError(".google.firestore.v1.WriteRequest.writes: object expected"); + message.writes[i] = $root.google.firestore.v1.Write.fromObject(object.writes[i], long + 1); + } + } + if (object.streamToken != null) + if (typeof object.streamToken === "string") + $util.base64.decode(object.streamToken, message.streamToken = $util.newBuffer($util.base64.length(object.streamToken)), 0); + else if (object.streamToken.length >= 0) + message.streamToken = object.streamToken; + if (object.labels) { + if (!$util.isObject(object.labels)) + throw TypeError(".google.firestore.v1.WriteRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a WriteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.WriteRequest + * @static + * @param {google.firestore.v1.WriteRequest} message WriteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writes = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.database = ""; + object.streamId = ""; + if (options.bytes === String) + object.streamToken = ""; + else { + object.streamToken = []; + if (options.bytes !== Array) + object.streamToken = $util.newBuffer(object.streamToken); + } + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + object.streamId = message.streamId; + if (message.writes && message.writes.length) { + object.writes = []; + for (var j = 0; j < message.writes.length; ++j) + object.writes[j] = $root.google.firestore.v1.Write.toObject(message.writes[j], options, q + 1); + } + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + object.streamToken = options.bytes === String ? $util.base64.encode(message.streamToken, 0, message.streamToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.streamToken) : message.streamToken; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + } + return object; + }; + + /** + * Converts this WriteRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.WriteRequest + * @instance + * @returns {Object.} JSON object + */ + WriteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteRequest + * @function getTypeUrl + * @memberof google.firestore.v1.WriteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.WriteRequest"; + }; + + return WriteRequest; + })(); + + v1.WriteResponse = (function() { + + /** + * Properties of a WriteResponse. + * @memberof google.firestore.v1 + * @interface IWriteResponse + * @property {string|null} [streamId] WriteResponse streamId + * @property {Uint8Array|null} [streamToken] WriteResponse streamToken + * @property {Array.|null} [writeResults] WriteResponse writeResults + * @property {google.protobuf.ITimestamp|null} [commitTime] WriteResponse commitTime + */ + + /** + * Constructs a new WriteResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a WriteResponse. + * @implements IWriteResponse + * @constructor + * @param {google.firestore.v1.IWriteResponse=} [properties] Properties to set + */ + function WriteResponse(properties) { + this.writeResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteResponse streamId. + * @member {string} streamId + * @memberof google.firestore.v1.WriteResponse + * @instance + */ + WriteResponse.prototype.streamId = ""; + + /** + * WriteResponse streamToken. + * @member {Uint8Array} streamToken + * @memberof google.firestore.v1.WriteResponse + * @instance + */ + WriteResponse.prototype.streamToken = $util.newBuffer([]); + + /** + * WriteResponse writeResults. + * @member {Array.} writeResults + * @memberof google.firestore.v1.WriteResponse + * @instance + */ + WriteResponse.prototype.writeResults = $util.emptyArray; + + /** + * WriteResponse commitTime. + * @member {google.protobuf.ITimestamp|null|undefined} commitTime + * @memberof google.firestore.v1.WriteResponse + * @instance + */ + WriteResponse.prototype.commitTime = null; + + /** + * Creates a new WriteResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.WriteResponse + * @static + * @param {google.firestore.v1.IWriteResponse=} [properties] Properties to set + * @returns {google.firestore.v1.WriteResponse} WriteResponse instance + */ + WriteResponse.create = function create(properties) { + return new WriteResponse(properties); + }; + + /** + * Encodes the specified WriteResponse message. Does not implicitly {@link google.firestore.v1.WriteResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.WriteResponse + * @static + * @param {google.firestore.v1.IWriteResponse} message WriteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.streamId); + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.streamToken); + if (message.writeResults != null && message.writeResults.length) + for (var i = 0; i < message.writeResults.length; ++i) + $root.google.firestore.v1.WriteResult.encode(message.writeResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) + $root.google.protobuf.Timestamp.encode(message.commitTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteResponse message, length delimited. Does not implicitly {@link google.firestore.v1.WriteResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.WriteResponse + * @static + * @param {google.firestore.v1.IWriteResponse} message WriteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a WriteResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.WriteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.WriteResponse} WriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.WriteResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.streamId = reader.string(); + break; + } + case 2: { + message.streamToken = reader.bytes(); + break; + } + case 3: { + if (!(message.writeResults && message.writeResults.length)) + message.writeResults = []; + message.writeResults.push($root.google.firestore.v1.WriteResult.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 4: { + message.commitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a WriteResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.WriteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.WriteResponse} WriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteResponse message. + * @function verify + * @memberof google.firestore.v1.WriteResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + if (!$util.isString(message.streamId)) + return "streamId: string expected"; + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + if (!(message.streamToken && typeof message.streamToken.length === "number" || $util.isString(message.streamToken))) + return "streamToken: buffer expected"; + if (message.writeResults != null && Object.hasOwnProperty.call(message, "writeResults")) { + if (!Array.isArray(message.writeResults)) + return "writeResults: array expected"; + for (var i = 0; i < message.writeResults.length; ++i) { + var error = $root.google.firestore.v1.WriteResult.verify(message.writeResults[i], long + 1); + if (error) + return "writeResults." + error; + } + } + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.commitTime, long + 1); + if (error) + return "commitTime." + error; + } + return null; + }; + + /** + * Creates a WriteResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.WriteResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.WriteResponse} WriteResponse + */ + WriteResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.WriteResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.WriteResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.WriteResponse(); + if (object.streamId != null) + message.streamId = String(object.streamId); + if (object.streamToken != null) + if (typeof object.streamToken === "string") + $util.base64.decode(object.streamToken, message.streamToken = $util.newBuffer($util.base64.length(object.streamToken)), 0); + else if (object.streamToken.length >= 0) + message.streamToken = object.streamToken; + if (object.writeResults) { + if (!Array.isArray(object.writeResults)) + throw TypeError(".google.firestore.v1.WriteResponse.writeResults: array expected"); + message.writeResults = []; + for (var i = 0; i < object.writeResults.length; ++i) { + if (!$util.isObject(object.writeResults[i])) + throw TypeError(".google.firestore.v1.WriteResponse.writeResults: object expected"); + message.writeResults[i] = $root.google.firestore.v1.WriteResult.fromObject(object.writeResults[i], long + 1); + } + } + if (object.commitTime != null) { + if (!$util.isObject(object.commitTime)) + throw TypeError(".google.firestore.v1.WriteResponse.commitTime: object expected"); + message.commitTime = $root.google.protobuf.Timestamp.fromObject(object.commitTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a WriteResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.WriteResponse + * @static + * @param {google.firestore.v1.WriteResponse} message WriteResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writeResults = []; + if (options.defaults) { + object.streamId = ""; + if (options.bytes === String) + object.streamToken = ""; + else { + object.streamToken = []; + if (options.bytes !== Array) + object.streamToken = $util.newBuffer(object.streamToken); + } + object.commitTime = null; + } + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + object.streamId = message.streamId; + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + object.streamToken = options.bytes === String ? $util.base64.encode(message.streamToken, 0, message.streamToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.streamToken) : message.streamToken; + if (message.writeResults && message.writeResults.length) { + object.writeResults = []; + for (var j = 0; j < message.writeResults.length; ++j) + object.writeResults[j] = $root.google.firestore.v1.WriteResult.toObject(message.writeResults[j], options, q + 1); + } + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) + object.commitTime = $root.google.protobuf.Timestamp.toObject(message.commitTime, options, q + 1); + return object; + }; + + /** + * Converts this WriteResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.WriteResponse + * @instance + * @returns {Object.} JSON object + */ + WriteResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteResponse + * @function getTypeUrl + * @memberof google.firestore.v1.WriteResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.WriteResponse"; + }; + + return WriteResponse; + })(); + + v1.ListenRequest = (function() { + + /** + * Properties of a ListenRequest. + * @memberof google.firestore.v1 + * @interface IListenRequest + * @property {string|null} [database] ListenRequest database + * @property {google.firestore.v1.ITarget|null} [addTarget] ListenRequest addTarget + * @property {number|null} [removeTarget] ListenRequest removeTarget + * @property {Object.|null} [labels] ListenRequest labels + */ + + /** + * Constructs a new ListenRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a ListenRequest. + * @implements IListenRequest + * @constructor + * @param {google.firestore.v1.IListenRequest=} [properties] Properties to set + */ + function ListenRequest(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListenRequest database. + * @member {string} database + * @memberof google.firestore.v1.ListenRequest + * @instance + */ + ListenRequest.prototype.database = ""; + + /** + * ListenRequest addTarget. + * @member {google.firestore.v1.ITarget|null|undefined} addTarget + * @memberof google.firestore.v1.ListenRequest + * @instance + */ + ListenRequest.prototype.addTarget = null; + + /** + * ListenRequest removeTarget. + * @member {number|null|undefined} removeTarget + * @memberof google.firestore.v1.ListenRequest + * @instance + */ + ListenRequest.prototype.removeTarget = null; + + /** + * ListenRequest labels. + * @member {Object.} labels + * @memberof google.firestore.v1.ListenRequest + * @instance + */ + ListenRequest.prototype.labels = $util.emptyObject; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ListenRequest targetChange. + * @member {"addTarget"|"removeTarget"|undefined} targetChange + * @memberof google.firestore.v1.ListenRequest + * @instance + */ + Object.defineProperty(ListenRequest.prototype, "targetChange", { + get: $util.oneOfGetter($oneOfFields = ["addTarget", "removeTarget"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ListenRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ListenRequest + * @static + * @param {google.firestore.v1.IListenRequest=} [properties] Properties to set + * @returns {google.firestore.v1.ListenRequest} ListenRequest instance + */ + ListenRequest.create = function create(properties) { + return new ListenRequest(properties); + }; + + /** + * Encodes the specified ListenRequest message. Does not implicitly {@link google.firestore.v1.ListenRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ListenRequest + * @static + * @param {google.firestore.v1.IListenRequest} message ListenRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListenRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.addTarget != null && Object.hasOwnProperty.call(message, "addTarget")) + $root.google.firestore.v1.Target.encode(message.addTarget, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.removeTarget != null && Object.hasOwnProperty.call(message, "removeTarget")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.removeTarget); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListenRequest message, length delimited. Does not implicitly {@link google.firestore.v1.ListenRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ListenRequest + * @static + * @param {google.firestore.v1.IListenRequest} message ListenRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListenRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListenRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ListenRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ListenRequest} ListenRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListenRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ListenRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.addTarget = $root.google.firestore.v1.Target.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.removeTarget = reader.int32(); + break; + } + case 4: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.labels, key); + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListenRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ListenRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ListenRequest} ListenRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListenRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListenRequest message. + * @function verify + * @memberof google.firestore.v1.ListenRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListenRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.addTarget != null && Object.hasOwnProperty.call(message, "addTarget")) { + properties.targetChange = 1; + { + var error = $root.google.firestore.v1.Target.verify(message.addTarget, long + 1); + if (error) + return "addTarget." + error; + } + } + if (message.removeTarget != null && Object.hasOwnProperty.call(message, "removeTarget")) { + if (properties.targetChange === 1) + return "targetChange: multiple values"; + properties.targetChange = 1; + if (!$util.isInteger(message.removeTarget)) + return "removeTarget: integer expected"; + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a ListenRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ListenRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ListenRequest} ListenRequest + */ + ListenRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ListenRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ListenRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ListenRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.addTarget != null) { + if (!$util.isObject(object.addTarget)) + throw TypeError(".google.firestore.v1.ListenRequest.addTarget: object expected"); + message.addTarget = $root.google.firestore.v1.Target.fromObject(object.addTarget, long + 1); + } + if (object.removeTarget != null) + message.removeTarget = object.removeTarget | 0; + if (object.labels) { + if (!$util.isObject(object.labels)) + throw TypeError(".google.firestore.v1.ListenRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListenRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ListenRequest + * @static + * @param {google.firestore.v1.ListenRequest} message ListenRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListenRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) + object.database = ""; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.addTarget != null && Object.hasOwnProperty.call(message, "addTarget")) { + object.addTarget = $root.google.firestore.v1.Target.toObject(message.addTarget, options, q + 1); + if (options.oneofs) + object.targetChange = "addTarget"; + } + if (message.removeTarget != null && Object.hasOwnProperty.call(message, "removeTarget")) { + object.removeTarget = message.removeTarget; + if (options.oneofs) + object.targetChange = "removeTarget"; + } + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + } + return object; + }; + + /** + * Converts this ListenRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.ListenRequest + * @instance + * @returns {Object.} JSON object + */ + ListenRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListenRequest + * @function getTypeUrl + * @memberof google.firestore.v1.ListenRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListenRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ListenRequest"; + }; + + return ListenRequest; + })(); + + v1.ListenResponse = (function() { + + /** + * Properties of a ListenResponse. + * @memberof google.firestore.v1 + * @interface IListenResponse + * @property {google.firestore.v1.ITargetChange|null} [targetChange] ListenResponse targetChange + * @property {google.firestore.v1.IDocumentChange|null} [documentChange] ListenResponse documentChange + * @property {google.firestore.v1.IDocumentDelete|null} [documentDelete] ListenResponse documentDelete + * @property {google.firestore.v1.IDocumentRemove|null} [documentRemove] ListenResponse documentRemove + * @property {google.firestore.v1.IExistenceFilter|null} [filter] ListenResponse filter + */ + + /** + * Constructs a new ListenResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a ListenResponse. + * @implements IListenResponse + * @constructor + * @param {google.firestore.v1.IListenResponse=} [properties] Properties to set + */ + function ListenResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListenResponse targetChange. + * @member {google.firestore.v1.ITargetChange|null|undefined} targetChange + * @memberof google.firestore.v1.ListenResponse + * @instance + */ + ListenResponse.prototype.targetChange = null; + + /** + * ListenResponse documentChange. + * @member {google.firestore.v1.IDocumentChange|null|undefined} documentChange + * @memberof google.firestore.v1.ListenResponse + * @instance + */ + ListenResponse.prototype.documentChange = null; + + /** + * ListenResponse documentDelete. + * @member {google.firestore.v1.IDocumentDelete|null|undefined} documentDelete + * @memberof google.firestore.v1.ListenResponse + * @instance + */ + ListenResponse.prototype.documentDelete = null; + + /** + * ListenResponse documentRemove. + * @member {google.firestore.v1.IDocumentRemove|null|undefined} documentRemove + * @memberof google.firestore.v1.ListenResponse + * @instance + */ + ListenResponse.prototype.documentRemove = null; + + /** + * ListenResponse filter. + * @member {google.firestore.v1.IExistenceFilter|null|undefined} filter + * @memberof google.firestore.v1.ListenResponse + * @instance + */ + ListenResponse.prototype.filter = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ListenResponse responseType. + * @member {"targetChange"|"documentChange"|"documentDelete"|"documentRemove"|"filter"|undefined} responseType + * @memberof google.firestore.v1.ListenResponse + * @instance + */ + Object.defineProperty(ListenResponse.prototype, "responseType", { + get: $util.oneOfGetter($oneOfFields = ["targetChange", "documentChange", "documentDelete", "documentRemove", "filter"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ListenResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ListenResponse + * @static + * @param {google.firestore.v1.IListenResponse=} [properties] Properties to set + * @returns {google.firestore.v1.ListenResponse} ListenResponse instance + */ + ListenResponse.create = function create(properties) { + return new ListenResponse(properties); + }; + + /** + * Encodes the specified ListenResponse message. Does not implicitly {@link google.firestore.v1.ListenResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ListenResponse + * @static + * @param {google.firestore.v1.IListenResponse} message ListenResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListenResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.targetChange != null && Object.hasOwnProperty.call(message, "targetChange")) + $root.google.firestore.v1.TargetChange.encode(message.targetChange, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.documentChange != null && Object.hasOwnProperty.call(message, "documentChange")) + $root.google.firestore.v1.DocumentChange.encode(message.documentChange, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.documentDelete != null && Object.hasOwnProperty.call(message, "documentDelete")) + $root.google.firestore.v1.DocumentDelete.encode(message.documentDelete, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + $root.google.firestore.v1.ExistenceFilter.encode(message.filter, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.documentRemove != null && Object.hasOwnProperty.call(message, "documentRemove")) + $root.google.firestore.v1.DocumentRemove.encode(message.documentRemove, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListenResponse message, length delimited. Does not implicitly {@link google.firestore.v1.ListenResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ListenResponse + * @static + * @param {google.firestore.v1.IListenResponse} message ListenResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListenResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListenResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ListenResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ListenResponse} ListenResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListenResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ListenResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.targetChange = $root.google.firestore.v1.TargetChange.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.documentChange = $root.google.firestore.v1.DocumentChange.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.documentDelete = $root.google.firestore.v1.DocumentDelete.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.documentRemove = $root.google.firestore.v1.DocumentRemove.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.filter = $root.google.firestore.v1.ExistenceFilter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListenResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ListenResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ListenResponse} ListenResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListenResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListenResponse message. + * @function verify + * @memberof google.firestore.v1.ListenResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListenResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.targetChange != null && Object.hasOwnProperty.call(message, "targetChange")) { + properties.responseType = 1; + { + var error = $root.google.firestore.v1.TargetChange.verify(message.targetChange, long + 1); + if (error) + return "targetChange." + error; + } + } + if (message.documentChange != null && Object.hasOwnProperty.call(message, "documentChange")) { + if (properties.responseType === 1) + return "responseType: multiple values"; + properties.responseType = 1; + { + var error = $root.google.firestore.v1.DocumentChange.verify(message.documentChange, long + 1); + if (error) + return "documentChange." + error; + } + } + if (message.documentDelete != null && Object.hasOwnProperty.call(message, "documentDelete")) { + if (properties.responseType === 1) + return "responseType: multiple values"; + properties.responseType = 1; + { + var error = $root.google.firestore.v1.DocumentDelete.verify(message.documentDelete, long + 1); + if (error) + return "documentDelete." + error; + } + } + if (message.documentRemove != null && Object.hasOwnProperty.call(message, "documentRemove")) { + if (properties.responseType === 1) + return "responseType: multiple values"; + properties.responseType = 1; + { + var error = $root.google.firestore.v1.DocumentRemove.verify(message.documentRemove, long + 1); + if (error) + return "documentRemove." + error; + } + } + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) { + if (properties.responseType === 1) + return "responseType: multiple values"; + properties.responseType = 1; + { + var error = $root.google.firestore.v1.ExistenceFilter.verify(message.filter, long + 1); + if (error) + return "filter." + error; + } + } + return null; + }; + + /** + * Creates a ListenResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ListenResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ListenResponse} ListenResponse + */ + ListenResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ListenResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ListenResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ListenResponse(); + if (object.targetChange != null) { + if (!$util.isObject(object.targetChange)) + throw TypeError(".google.firestore.v1.ListenResponse.targetChange: object expected"); + message.targetChange = $root.google.firestore.v1.TargetChange.fromObject(object.targetChange, long + 1); + } + if (object.documentChange != null) { + if (!$util.isObject(object.documentChange)) + throw TypeError(".google.firestore.v1.ListenResponse.documentChange: object expected"); + message.documentChange = $root.google.firestore.v1.DocumentChange.fromObject(object.documentChange, long + 1); + } + if (object.documentDelete != null) { + if (!$util.isObject(object.documentDelete)) + throw TypeError(".google.firestore.v1.ListenResponse.documentDelete: object expected"); + message.documentDelete = $root.google.firestore.v1.DocumentDelete.fromObject(object.documentDelete, long + 1); + } + if (object.documentRemove != null) { + if (!$util.isObject(object.documentRemove)) + throw TypeError(".google.firestore.v1.ListenResponse.documentRemove: object expected"); + message.documentRemove = $root.google.firestore.v1.DocumentRemove.fromObject(object.documentRemove, long + 1); + } + if (object.filter != null) { + if (!$util.isObject(object.filter)) + throw TypeError(".google.firestore.v1.ListenResponse.filter: object expected"); + message.filter = $root.google.firestore.v1.ExistenceFilter.fromObject(object.filter, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a ListenResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ListenResponse + * @static + * @param {google.firestore.v1.ListenResponse} message ListenResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListenResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.targetChange != null && Object.hasOwnProperty.call(message, "targetChange")) { + object.targetChange = $root.google.firestore.v1.TargetChange.toObject(message.targetChange, options, q + 1); + if (options.oneofs) + object.responseType = "targetChange"; + } + if (message.documentChange != null && Object.hasOwnProperty.call(message, "documentChange")) { + object.documentChange = $root.google.firestore.v1.DocumentChange.toObject(message.documentChange, options, q + 1); + if (options.oneofs) + object.responseType = "documentChange"; + } + if (message.documentDelete != null && Object.hasOwnProperty.call(message, "documentDelete")) { + object.documentDelete = $root.google.firestore.v1.DocumentDelete.toObject(message.documentDelete, options, q + 1); + if (options.oneofs) + object.responseType = "documentDelete"; + } + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) { + object.filter = $root.google.firestore.v1.ExistenceFilter.toObject(message.filter, options, q + 1); + if (options.oneofs) + object.responseType = "filter"; + } + if (message.documentRemove != null && Object.hasOwnProperty.call(message, "documentRemove")) { + object.documentRemove = $root.google.firestore.v1.DocumentRemove.toObject(message.documentRemove, options, q + 1); + if (options.oneofs) + object.responseType = "documentRemove"; + } + return object; + }; + + /** + * Converts this ListenResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.ListenResponse + * @instance + * @returns {Object.} JSON object + */ + ListenResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListenResponse + * @function getTypeUrl + * @memberof google.firestore.v1.ListenResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListenResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ListenResponse"; + }; + + return ListenResponse; + })(); + + v1.Target = (function() { + + /** + * Properties of a Target. + * @memberof google.firestore.v1 + * @interface ITarget + * @property {google.firestore.v1.Target.IQueryTarget|null} [query] Target query + * @property {google.firestore.v1.Target.IDocumentsTarget|null} [documents] Target documents + * @property {Uint8Array|null} [resumeToken] Target resumeToken + * @property {google.protobuf.ITimestamp|null} [readTime] Target readTime + * @property {number|null} [targetId] Target targetId + * @property {boolean|null} [once] Target once + * @property {google.protobuf.IInt32Value|null} [expectedCount] Target expectedCount + */ + + /** + * Constructs a new Target. + * @memberof google.firestore.v1 + * @classdesc Represents a Target. + * @implements ITarget + * @constructor + * @param {google.firestore.v1.ITarget=} [properties] Properties to set + */ + function Target(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Target query. + * @member {google.firestore.v1.Target.IQueryTarget|null|undefined} query + * @memberof google.firestore.v1.Target + * @instance + */ + Target.prototype.query = null; + + /** + * Target documents. + * @member {google.firestore.v1.Target.IDocumentsTarget|null|undefined} documents + * @memberof google.firestore.v1.Target + * @instance + */ + Target.prototype.documents = null; + + /** + * Target resumeToken. + * @member {Uint8Array|null|undefined} resumeToken + * @memberof google.firestore.v1.Target + * @instance + */ + Target.prototype.resumeToken = null; + + /** + * Target readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.Target + * @instance + */ + Target.prototype.readTime = null; + + /** + * Target targetId. + * @member {number} targetId + * @memberof google.firestore.v1.Target + * @instance + */ + Target.prototype.targetId = 0; + + /** + * Target once. + * @member {boolean} once + * @memberof google.firestore.v1.Target + * @instance + */ + Target.prototype.once = false; + + /** + * Target expectedCount. + * @member {google.protobuf.IInt32Value|null|undefined} expectedCount + * @memberof google.firestore.v1.Target + * @instance + */ + Target.prototype.expectedCount = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Target targetType. + * @member {"query"|"documents"|undefined} targetType + * @memberof google.firestore.v1.Target + * @instance + */ + Object.defineProperty(Target.prototype, "targetType", { + get: $util.oneOfGetter($oneOfFields = ["query", "documents"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Target resumeType. + * @member {"resumeToken"|"readTime"|undefined} resumeType + * @memberof google.firestore.v1.Target + * @instance + */ + Object.defineProperty(Target.prototype, "resumeType", { + get: $util.oneOfGetter($oneOfFields = ["resumeToken", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Target instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Target + * @static + * @param {google.firestore.v1.ITarget=} [properties] Properties to set + * @returns {google.firestore.v1.Target} Target instance + */ + Target.create = function create(properties) { + return new Target(properties); + }; + + /** + * Encodes the specified Target message. Does not implicitly {@link google.firestore.v1.Target.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Target + * @static + * @param {google.firestore.v1.ITarget} message Target message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Target.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + $root.google.firestore.v1.Target.QueryTarget.encode(message.query, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) + $root.google.firestore.v1.Target.DocumentsTarget.encode(message.documents, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.resumeToken); + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.targetId); + if (message.once != null && Object.hasOwnProperty.call(message, "once")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.once); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 11, wireType 2 =*/90).fork(), q + 1).ldelim(); + if (message.expectedCount != null && Object.hasOwnProperty.call(message, "expectedCount")) + $root.google.protobuf.Int32Value.encode(message.expectedCount, writer.uint32(/* id 12, wireType 2 =*/98).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Target message, length delimited. Does not implicitly {@link google.firestore.v1.Target.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Target + * @static + * @param {google.firestore.v1.ITarget} message Target message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Target.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Target message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Target + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Target} Target + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Target.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Target(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.query = $root.google.firestore.v1.Target.QueryTarget.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.documents = $root.google.firestore.v1.Target.DocumentsTarget.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.resumeToken = reader.bytes(); + break; + } + case 11: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.targetId = reader.int32(); + break; + } + case 6: { + message.once = reader.bool(); + break; + } + case 12: { + message.expectedCount = $root.google.protobuf.Int32Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Target message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Target + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Target} Target + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Target.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Target message. + * @function verify + * @memberof google.firestore.v1.Target + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Target.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.query != null && Object.hasOwnProperty.call(message, "query")) { + properties.targetType = 1; + { + var error = $root.google.firestore.v1.Target.QueryTarget.verify(message.query, long + 1); + if (error) + return "query." + error; + } + } + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + if (properties.targetType === 1) + return "targetType: multiple values"; + properties.targetType = 1; + { + var error = $root.google.firestore.v1.Target.DocumentsTarget.verify(message.documents, long + 1); + if (error) + return "documents." + error; + } + } + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) { + properties.resumeType = 1; + if (!(message.resumeToken && typeof message.resumeToken.length === "number" || $util.isString(message.resumeToken))) + return "resumeToken: buffer expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.resumeType === 1) + return "resumeType: multiple values"; + properties.resumeType = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + if (!$util.isInteger(message.targetId)) + return "targetId: integer expected"; + if (message.once != null && Object.hasOwnProperty.call(message, "once")) + if (typeof message.once !== "boolean") + return "once: boolean expected"; + if (message.expectedCount != null && Object.hasOwnProperty.call(message, "expectedCount")) { + var error = $root.google.protobuf.Int32Value.verify(message.expectedCount, long + 1); + if (error) + return "expectedCount." + error; + } + return null; + }; + + /** + * Creates a Target message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Target + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Target} Target + */ + Target.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Target) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Target: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Target(); + if (object.query != null) { + if (!$util.isObject(object.query)) + throw TypeError(".google.firestore.v1.Target.query: object expected"); + message.query = $root.google.firestore.v1.Target.QueryTarget.fromObject(object.query, long + 1); + } + if (object.documents != null) { + if (!$util.isObject(object.documents)) + throw TypeError(".google.firestore.v1.Target.documents: object expected"); + message.documents = $root.google.firestore.v1.Target.DocumentsTarget.fromObject(object.documents, long + 1); + } + if (object.resumeToken != null) + if (typeof object.resumeToken === "string") + $util.base64.decode(object.resumeToken, message.resumeToken = $util.newBuffer($util.base64.length(object.resumeToken)), 0); + else if (object.resumeToken.length >= 0) + message.resumeToken = object.resumeToken; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.Target.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.targetId != null) + message.targetId = object.targetId | 0; + if (object.once != null) + message.once = Boolean(object.once); + if (object.expectedCount != null) { + if (!$util.isObject(object.expectedCount)) + throw TypeError(".google.firestore.v1.Target.expectedCount: object expected"); + message.expectedCount = $root.google.protobuf.Int32Value.fromObject(object.expectedCount, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Target message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Target + * @static + * @param {google.firestore.v1.Target} message Target + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Target.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.targetId = 0; + object.once = false; + object.expectedCount = null; + } + if (message.query != null && Object.hasOwnProperty.call(message, "query")) { + object.query = $root.google.firestore.v1.Target.QueryTarget.toObject(message.query, options, q + 1); + if (options.oneofs) + object.targetType = "query"; + } + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + object.documents = $root.google.firestore.v1.Target.DocumentsTarget.toObject(message.documents, options, q + 1); + if (options.oneofs) + object.targetType = "documents"; + } + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) { + object.resumeToken = options.bytes === String ? $util.base64.encode(message.resumeToken, 0, message.resumeToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.resumeToken) : message.resumeToken; + if (options.oneofs) + object.resumeType = "resumeToken"; + } + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + object.targetId = message.targetId; + if (message.once != null && Object.hasOwnProperty.call(message, "once")) + object.once = message.once; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.resumeType = "readTime"; + } + if (message.expectedCount != null && Object.hasOwnProperty.call(message, "expectedCount")) + object.expectedCount = $root.google.protobuf.Int32Value.toObject(message.expectedCount, options, q + 1); + return object; + }; + + /** + * Converts this Target to JSON. + * @function toJSON + * @memberof google.firestore.v1.Target + * @instance + * @returns {Object.} JSON object + */ + Target.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Target + * @function getTypeUrl + * @memberof google.firestore.v1.Target + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Target.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Target"; + }; + + Target.DocumentsTarget = (function() { + + /** + * Properties of a DocumentsTarget. + * @memberof google.firestore.v1.Target + * @interface IDocumentsTarget + * @property {Array.|null} [documents] DocumentsTarget documents + */ + + /** + * Constructs a new DocumentsTarget. + * @memberof google.firestore.v1.Target + * @classdesc Represents a DocumentsTarget. + * @implements IDocumentsTarget + * @constructor + * @param {google.firestore.v1.Target.IDocumentsTarget=} [properties] Properties to set + */ + function DocumentsTarget(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentsTarget documents. + * @member {Array.} documents + * @memberof google.firestore.v1.Target.DocumentsTarget + * @instance + */ + DocumentsTarget.prototype.documents = $util.emptyArray; + + /** + * Creates a new DocumentsTarget instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Target.DocumentsTarget + * @static + * @param {google.firestore.v1.Target.IDocumentsTarget=} [properties] Properties to set + * @returns {google.firestore.v1.Target.DocumentsTarget} DocumentsTarget instance + */ + DocumentsTarget.create = function create(properties) { + return new DocumentsTarget(properties); + }; + + /** + * Encodes the specified DocumentsTarget message. Does not implicitly {@link google.firestore.v1.Target.DocumentsTarget.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Target.DocumentsTarget + * @static + * @param {google.firestore.v1.Target.IDocumentsTarget} message DocumentsTarget message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentsTarget.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documents[i]); + return writer; + }; + + /** + * Encodes the specified DocumentsTarget message, length delimited. Does not implicitly {@link google.firestore.v1.Target.DocumentsTarget.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Target.DocumentsTarget + * @static + * @param {google.firestore.v1.Target.IDocumentsTarget} message DocumentsTarget message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentsTarget.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentsTarget message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Target.DocumentsTarget + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Target.DocumentsTarget} DocumentsTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentsTarget.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Target.DocumentsTarget(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentsTarget message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Target.DocumentsTarget + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Target.DocumentsTarget} DocumentsTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentsTarget.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentsTarget message. + * @function verify + * @memberof google.firestore.v1.Target.DocumentsTarget + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentsTarget.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) + if (!$util.isString(message.documents[i])) + return "documents: string[] expected"; + } + return null; + }; + + /** + * Creates a DocumentsTarget message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Target.DocumentsTarget + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Target.DocumentsTarget} DocumentsTarget + */ + DocumentsTarget.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Target.DocumentsTarget) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Target.DocumentsTarget: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Target.DocumentsTarget(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.firestore.v1.Target.DocumentsTarget.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) + message.documents[i] = String(object.documents[i]); + } + return message; + }; + + /** + * Creates a plain object from a DocumentsTarget message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Target.DocumentsTarget + * @static + * @param {google.firestore.v1.Target.DocumentsTarget} message DocumentsTarget + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentsTarget.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = message.documents[j]; + } + return object; + }; + + /** + * Converts this DocumentsTarget to JSON. + * @function toJSON + * @memberof google.firestore.v1.Target.DocumentsTarget + * @instance + * @returns {Object.} JSON object + */ + DocumentsTarget.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentsTarget + * @function getTypeUrl + * @memberof google.firestore.v1.Target.DocumentsTarget + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentsTarget.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Target.DocumentsTarget"; + }; + + return DocumentsTarget; + })(); + + Target.QueryTarget = (function() { + + /** + * Properties of a QueryTarget. + * @memberof google.firestore.v1.Target + * @interface IQueryTarget + * @property {string|null} [parent] QueryTarget parent + * @property {google.firestore.v1.IStructuredQuery|null} [structuredQuery] QueryTarget structuredQuery + */ + + /** + * Constructs a new QueryTarget. + * @memberof google.firestore.v1.Target + * @classdesc Represents a QueryTarget. + * @implements IQueryTarget + * @constructor + * @param {google.firestore.v1.Target.IQueryTarget=} [properties] Properties to set + */ + function QueryTarget(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTarget parent. + * @member {string} parent + * @memberof google.firestore.v1.Target.QueryTarget + * @instance + */ + QueryTarget.prototype.parent = ""; + + /** + * QueryTarget structuredQuery. + * @member {google.firestore.v1.IStructuredQuery|null|undefined} structuredQuery + * @memberof google.firestore.v1.Target.QueryTarget + * @instance + */ + QueryTarget.prototype.structuredQuery = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueryTarget queryType. + * @member {"structuredQuery"|undefined} queryType + * @memberof google.firestore.v1.Target.QueryTarget + * @instance + */ + Object.defineProperty(QueryTarget.prototype, "queryType", { + get: $util.oneOfGetter($oneOfFields = ["structuredQuery"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueryTarget instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Target.QueryTarget + * @static + * @param {google.firestore.v1.Target.IQueryTarget=} [properties] Properties to set + * @returns {google.firestore.v1.Target.QueryTarget} QueryTarget instance + */ + QueryTarget.create = function create(properties) { + return new QueryTarget(properties); + }; + + /** + * Encodes the specified QueryTarget message. Does not implicitly {@link google.firestore.v1.Target.QueryTarget.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Target.QueryTarget + * @static + * @param {google.firestore.v1.Target.IQueryTarget} message QueryTarget message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTarget.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) + $root.google.firestore.v1.StructuredQuery.encode(message.structuredQuery, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryTarget message, length delimited. Does not implicitly {@link google.firestore.v1.Target.QueryTarget.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Target.QueryTarget + * @static + * @param {google.firestore.v1.Target.IQueryTarget} message QueryTarget message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTarget.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a QueryTarget message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Target.QueryTarget + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Target.QueryTarget} QueryTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTarget.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Target.QueryTarget(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.structuredQuery = $root.google.firestore.v1.StructuredQuery.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTarget message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Target.QueryTarget + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Target.QueryTarget} QueryTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTarget.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTarget message. + * @function verify + * @memberof google.firestore.v1.Target.QueryTarget + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTarget.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + properties.queryType = 1; + { + var error = $root.google.firestore.v1.StructuredQuery.verify(message.structuredQuery, long + 1); + if (error) + return "structuredQuery." + error; + } + } + return null; + }; + + /** + * Creates a QueryTarget message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Target.QueryTarget + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Target.QueryTarget} QueryTarget + */ + QueryTarget.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Target.QueryTarget) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Target.QueryTarget: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Target.QueryTarget(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.structuredQuery != null) { + if (!$util.isObject(object.structuredQuery)) + throw TypeError(".google.firestore.v1.Target.QueryTarget.structuredQuery: object expected"); + message.structuredQuery = $root.google.firestore.v1.StructuredQuery.fromObject(object.structuredQuery, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a QueryTarget message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Target.QueryTarget + * @static + * @param {google.firestore.v1.Target.QueryTarget} message QueryTarget + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTarget.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + object.structuredQuery = $root.google.firestore.v1.StructuredQuery.toObject(message.structuredQuery, options, q + 1); + if (options.oneofs) + object.queryType = "structuredQuery"; + } + return object; + }; + + /** + * Converts this QueryTarget to JSON. + * @function toJSON + * @memberof google.firestore.v1.Target.QueryTarget + * @instance + * @returns {Object.} JSON object + */ + QueryTarget.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryTarget + * @function getTypeUrl + * @memberof google.firestore.v1.Target.QueryTarget + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryTarget.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Target.QueryTarget"; + }; + + return QueryTarget; + })(); + + return Target; + })(); + + v1.TargetChange = (function() { + + /** + * Properties of a TargetChange. + * @memberof google.firestore.v1 + * @interface ITargetChange + * @property {google.firestore.v1.TargetChange.TargetChangeType|null} [targetChangeType] TargetChange targetChangeType + * @property {Array.|null} [targetIds] TargetChange targetIds + * @property {google.rpc.IStatus|null} [cause] TargetChange cause + * @property {Uint8Array|null} [resumeToken] TargetChange resumeToken + * @property {google.protobuf.ITimestamp|null} [readTime] TargetChange readTime + */ + + /** + * Constructs a new TargetChange. + * @memberof google.firestore.v1 + * @classdesc Represents a TargetChange. + * @implements ITargetChange + * @constructor + * @param {google.firestore.v1.ITargetChange=} [properties] Properties to set + */ + function TargetChange(properties) { + this.targetIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * TargetChange targetChangeType. + * @member {google.firestore.v1.TargetChange.TargetChangeType} targetChangeType + * @memberof google.firestore.v1.TargetChange + * @instance + */ + TargetChange.prototype.targetChangeType = 0; + + /** + * TargetChange targetIds. + * @member {Array.} targetIds + * @memberof google.firestore.v1.TargetChange + * @instance + */ + TargetChange.prototype.targetIds = $util.emptyArray; + + /** + * TargetChange cause. + * @member {google.rpc.IStatus|null|undefined} cause + * @memberof google.firestore.v1.TargetChange + * @instance + */ + TargetChange.prototype.cause = null; + + /** + * TargetChange resumeToken. + * @member {Uint8Array} resumeToken + * @memberof google.firestore.v1.TargetChange + * @instance + */ + TargetChange.prototype.resumeToken = $util.newBuffer([]); + + /** + * TargetChange readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.TargetChange + * @instance + */ + TargetChange.prototype.readTime = null; + + /** + * Creates a new TargetChange instance using the specified properties. + * @function create + * @memberof google.firestore.v1.TargetChange + * @static + * @param {google.firestore.v1.ITargetChange=} [properties] Properties to set + * @returns {google.firestore.v1.TargetChange} TargetChange instance + */ + TargetChange.create = function create(properties) { + return new TargetChange(properties); + }; + + /** + * Encodes the specified TargetChange message. Does not implicitly {@link google.firestore.v1.TargetChange.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.TargetChange + * @static + * @param {google.firestore.v1.ITargetChange} message TargetChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TargetChange.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.targetChangeType != null && Object.hasOwnProperty.call(message, "targetChangeType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.targetChangeType); + if (message.targetIds != null && message.targetIds.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.targetIds.length; ++i) + writer.int32(message.targetIds[i]); + writer.ldelim(); + } + if (message.cause != null && Object.hasOwnProperty.call(message, "cause")) + $root.google.rpc.Status.encode(message.cause, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.resumeToken); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified TargetChange message, length delimited. Does not implicitly {@link google.firestore.v1.TargetChange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.TargetChange + * @static + * @param {google.firestore.v1.ITargetChange} message TargetChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TargetChange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a TargetChange message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.TargetChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.TargetChange} TargetChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TargetChange.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.TargetChange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.targetChangeType = reader.int32(); + break; + } + case 2: { + if (!(message.targetIds && message.targetIds.length)) + message.targetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.targetIds.push(reader.int32()); + } else + message.targetIds.push(reader.int32()); + break; + } + case 3: { + message.cause = $root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.resumeToken = reader.bytes(); + break; + } + case 6: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a TargetChange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.TargetChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.TargetChange} TargetChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TargetChange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TargetChange message. + * @function verify + * @memberof google.firestore.v1.TargetChange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TargetChange.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.targetChangeType != null && Object.hasOwnProperty.call(message, "targetChangeType")) + switch (message.targetChangeType) { + default: + return "targetChangeType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.targetIds != null && Object.hasOwnProperty.call(message, "targetIds")) { + if (!Array.isArray(message.targetIds)) + return "targetIds: array expected"; + for (var i = 0; i < message.targetIds.length; ++i) + if (!$util.isInteger(message.targetIds[i])) + return "targetIds: integer[] expected"; + } + if (message.cause != null && Object.hasOwnProperty.call(message, "cause")) { + var error = $root.google.rpc.Status.verify(message.cause, long + 1); + if (error) + return "cause." + error; + } + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) + if (!(message.resumeToken && typeof message.resumeToken.length === "number" || $util.isString(message.resumeToken))) + return "resumeToken: buffer expected"; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a TargetChange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.TargetChange + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.TargetChange} TargetChange + */ + TargetChange.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.TargetChange) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.TargetChange: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.TargetChange(); + switch (object.targetChangeType) { + default: + if (typeof object.targetChangeType === "number") { + message.targetChangeType = object.targetChangeType; + break; + } + break; + case "NO_CHANGE": + case 0: + message.targetChangeType = 0; + break; + case "ADD": + case 1: + message.targetChangeType = 1; + break; + case "REMOVE": + case 2: + message.targetChangeType = 2; + break; + case "CURRENT": + case 3: + message.targetChangeType = 3; + break; + case "RESET": + case 4: + message.targetChangeType = 4; + break; + } + if (object.targetIds) { + if (!Array.isArray(object.targetIds)) + throw TypeError(".google.firestore.v1.TargetChange.targetIds: array expected"); + message.targetIds = []; + for (var i = 0; i < object.targetIds.length; ++i) + message.targetIds[i] = object.targetIds[i] | 0; + } + if (object.cause != null) { + if (!$util.isObject(object.cause)) + throw TypeError(".google.firestore.v1.TargetChange.cause: object expected"); + message.cause = $root.google.rpc.Status.fromObject(object.cause, long + 1); + } + if (object.resumeToken != null) + if (typeof object.resumeToken === "string") + $util.base64.decode(object.resumeToken, message.resumeToken = $util.newBuffer($util.base64.length(object.resumeToken)), 0); + else if (object.resumeToken.length >= 0) + message.resumeToken = object.resumeToken; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.TargetChange.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a TargetChange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.TargetChange + * @static + * @param {google.firestore.v1.TargetChange} message TargetChange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TargetChange.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.targetIds = []; + if (options.defaults) { + object.targetChangeType = options.enums === String ? "NO_CHANGE" : 0; + object.cause = null; + if (options.bytes === String) + object.resumeToken = ""; + else { + object.resumeToken = []; + if (options.bytes !== Array) + object.resumeToken = $util.newBuffer(object.resumeToken); + } + object.readTime = null; + } + if (message.targetChangeType != null && Object.hasOwnProperty.call(message, "targetChangeType")) + object.targetChangeType = options.enums === String ? $root.google.firestore.v1.TargetChange.TargetChangeType[message.targetChangeType] === undefined ? message.targetChangeType : $root.google.firestore.v1.TargetChange.TargetChangeType[message.targetChangeType] : message.targetChangeType; + if (message.targetIds && message.targetIds.length) { + object.targetIds = []; + for (var j = 0; j < message.targetIds.length; ++j) + object.targetIds[j] = message.targetIds[j]; + } + if (message.cause != null && Object.hasOwnProperty.call(message, "cause")) + object.cause = $root.google.rpc.Status.toObject(message.cause, options, q + 1); + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) + object.resumeToken = options.bytes === String ? $util.base64.encode(message.resumeToken, 0, message.resumeToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.resumeToken) : message.resumeToken; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + return object; + }; + + /** + * Converts this TargetChange to JSON. + * @function toJSON + * @memberof google.firestore.v1.TargetChange + * @instance + * @returns {Object.} JSON object + */ + TargetChange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TargetChange + * @function getTypeUrl + * @memberof google.firestore.v1.TargetChange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TargetChange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.TargetChange"; + }; + + /** + * TargetChangeType enum. + * @name google.firestore.v1.TargetChange.TargetChangeType + * @enum {number} + * @property {number} NO_CHANGE=0 NO_CHANGE value + * @property {number} ADD=1 ADD value + * @property {number} REMOVE=2 REMOVE value + * @property {number} CURRENT=3 CURRENT value + * @property {number} RESET=4 RESET value + */ + TargetChange.TargetChangeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NO_CHANGE"] = 0; + values[valuesById[1] = "ADD"] = 1; + values[valuesById[2] = "REMOVE"] = 2; + values[valuesById[3] = "CURRENT"] = 3; + values[valuesById[4] = "RESET"] = 4; + return values; + })(); + + return TargetChange; + })(); + + v1.ListCollectionIdsRequest = (function() { + + /** + * Properties of a ListCollectionIdsRequest. + * @memberof google.firestore.v1 + * @interface IListCollectionIdsRequest + * @property {string|null} [parent] ListCollectionIdsRequest parent + * @property {number|null} [pageSize] ListCollectionIdsRequest pageSize + * @property {string|null} [pageToken] ListCollectionIdsRequest pageToken + * @property {google.protobuf.ITimestamp|null} [readTime] ListCollectionIdsRequest readTime + */ + + /** + * Constructs a new ListCollectionIdsRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a ListCollectionIdsRequest. + * @implements IListCollectionIdsRequest + * @constructor + * @param {google.firestore.v1.IListCollectionIdsRequest=} [properties] Properties to set + */ + function ListCollectionIdsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCollectionIdsRequest parent. + * @member {string} parent + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @instance + */ + ListCollectionIdsRequest.prototype.parent = ""; + + /** + * ListCollectionIdsRequest pageSize. + * @member {number} pageSize + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @instance + */ + ListCollectionIdsRequest.prototype.pageSize = 0; + + /** + * ListCollectionIdsRequest pageToken. + * @member {string} pageToken + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @instance + */ + ListCollectionIdsRequest.prototype.pageToken = ""; + + /** + * ListCollectionIdsRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @instance + */ + ListCollectionIdsRequest.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ListCollectionIdsRequest consistencySelector. + * @member {"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @instance + */ + Object.defineProperty(ListCollectionIdsRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ListCollectionIdsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @static + * @param {google.firestore.v1.IListCollectionIdsRequest=} [properties] Properties to set + * @returns {google.firestore.v1.ListCollectionIdsRequest} ListCollectionIdsRequest instance + */ + ListCollectionIdsRequest.create = function create(properties) { + return new ListCollectionIdsRequest(properties); + }; + + /** + * Encodes the specified ListCollectionIdsRequest message. Does not implicitly {@link google.firestore.v1.ListCollectionIdsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @static + * @param {google.firestore.v1.IListCollectionIdsRequest} message ListCollectionIdsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCollectionIdsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListCollectionIdsRequest message, length delimited. Does not implicitly {@link google.firestore.v1.ListCollectionIdsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @static + * @param {google.firestore.v1.IListCollectionIdsRequest} message ListCollectionIdsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCollectionIdsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListCollectionIdsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ListCollectionIdsRequest} ListCollectionIdsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCollectionIdsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ListCollectionIdsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListCollectionIdsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ListCollectionIdsRequest} ListCollectionIdsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCollectionIdsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCollectionIdsRequest message. + * @function verify + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCollectionIdsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + return null; + }; + + /** + * Creates a ListCollectionIdsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ListCollectionIdsRequest} ListCollectionIdsRequest + */ + ListCollectionIdsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ListCollectionIdsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ListCollectionIdsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ListCollectionIdsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.ListCollectionIdsRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a ListCollectionIdsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @static + * @param {google.firestore.v1.ListCollectionIdsRequest} message ListCollectionIdsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCollectionIdsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + object.pageToken = message.pageToken; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + return object; + }; + + /** + * Converts this ListCollectionIdsRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @instance + * @returns {Object.} JSON object + */ + ListCollectionIdsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListCollectionIdsRequest + * @function getTypeUrl + * @memberof google.firestore.v1.ListCollectionIdsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCollectionIdsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ListCollectionIdsRequest"; + }; + + return ListCollectionIdsRequest; + })(); + + v1.ListCollectionIdsResponse = (function() { + + /** + * Properties of a ListCollectionIdsResponse. + * @memberof google.firestore.v1 + * @interface IListCollectionIdsResponse + * @property {Array.|null} [collectionIds] ListCollectionIdsResponse collectionIds + * @property {string|null} [nextPageToken] ListCollectionIdsResponse nextPageToken + */ + + /** + * Constructs a new ListCollectionIdsResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a ListCollectionIdsResponse. + * @implements IListCollectionIdsResponse + * @constructor + * @param {google.firestore.v1.IListCollectionIdsResponse=} [properties] Properties to set + */ + function ListCollectionIdsResponse(properties) { + this.collectionIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCollectionIdsResponse collectionIds. + * @member {Array.} collectionIds + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @instance + */ + ListCollectionIdsResponse.prototype.collectionIds = $util.emptyArray; + + /** + * ListCollectionIdsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @instance + */ + ListCollectionIdsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListCollectionIdsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @static + * @param {google.firestore.v1.IListCollectionIdsResponse=} [properties] Properties to set + * @returns {google.firestore.v1.ListCollectionIdsResponse} ListCollectionIdsResponse instance + */ + ListCollectionIdsResponse.create = function create(properties) { + return new ListCollectionIdsResponse(properties); + }; + + /** + * Encodes the specified ListCollectionIdsResponse message. Does not implicitly {@link google.firestore.v1.ListCollectionIdsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @static + * @param {google.firestore.v1.IListCollectionIdsResponse} message ListCollectionIdsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCollectionIdsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.collectionIds != null && message.collectionIds.length) + for (var i = 0; i < message.collectionIds.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.collectionIds[i]); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListCollectionIdsResponse message, length delimited. Does not implicitly {@link google.firestore.v1.ListCollectionIdsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @static + * @param {google.firestore.v1.IListCollectionIdsResponse} message ListCollectionIdsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCollectionIdsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListCollectionIdsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ListCollectionIdsResponse} ListCollectionIdsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCollectionIdsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ListCollectionIdsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.collectionIds && message.collectionIds.length)) + message.collectionIds = []; + message.collectionIds.push(reader.string()); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListCollectionIdsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ListCollectionIdsResponse} ListCollectionIdsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCollectionIdsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCollectionIdsResponse message. + * @function verify + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCollectionIdsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.collectionIds != null && Object.hasOwnProperty.call(message, "collectionIds")) { + if (!Array.isArray(message.collectionIds)) + return "collectionIds: array expected"; + for (var i = 0; i < message.collectionIds.length; ++i) + if (!$util.isString(message.collectionIds[i])) + return "collectionIds: string[] expected"; + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListCollectionIdsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ListCollectionIdsResponse} ListCollectionIdsResponse + */ + ListCollectionIdsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ListCollectionIdsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ListCollectionIdsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ListCollectionIdsResponse(); + if (object.collectionIds) { + if (!Array.isArray(object.collectionIds)) + throw TypeError(".google.firestore.v1.ListCollectionIdsResponse.collectionIds: array expected"); + message.collectionIds = []; + for (var i = 0; i < object.collectionIds.length; ++i) + message.collectionIds[i] = String(object.collectionIds[i]); + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListCollectionIdsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @static + * @param {google.firestore.v1.ListCollectionIdsResponse} message ListCollectionIdsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCollectionIdsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.collectionIds = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.collectionIds && message.collectionIds.length) { + object.collectionIds = []; + for (var j = 0; j < message.collectionIds.length; ++j) + object.collectionIds[j] = message.collectionIds[j]; + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListCollectionIdsResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @instance + * @returns {Object.} JSON object + */ + ListCollectionIdsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListCollectionIdsResponse + * @function getTypeUrl + * @memberof google.firestore.v1.ListCollectionIdsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCollectionIdsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ListCollectionIdsResponse"; + }; + + return ListCollectionIdsResponse; + })(); + + v1.BatchWriteRequest = (function() { + + /** + * Properties of a BatchWriteRequest. + * @memberof google.firestore.v1 + * @interface IBatchWriteRequest + * @property {string|null} [database] BatchWriteRequest database + * @property {Array.|null} [writes] BatchWriteRequest writes + * @property {Object.|null} [labels] BatchWriteRequest labels + */ + + /** + * Constructs a new BatchWriteRequest. + * @memberof google.firestore.v1 + * @classdesc Represents a BatchWriteRequest. + * @implements IBatchWriteRequest + * @constructor + * @param {google.firestore.v1.IBatchWriteRequest=} [properties] Properties to set + */ + function BatchWriteRequest(properties) { + this.writes = []; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchWriteRequest database. + * @member {string} database + * @memberof google.firestore.v1.BatchWriteRequest + * @instance + */ + BatchWriteRequest.prototype.database = ""; + + /** + * BatchWriteRequest writes. + * @member {Array.} writes + * @memberof google.firestore.v1.BatchWriteRequest + * @instance + */ + BatchWriteRequest.prototype.writes = $util.emptyArray; + + /** + * BatchWriteRequest labels. + * @member {Object.} labels + * @memberof google.firestore.v1.BatchWriteRequest + * @instance + */ + BatchWriteRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new BatchWriteRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.BatchWriteRequest + * @static + * @param {google.firestore.v1.IBatchWriteRequest=} [properties] Properties to set + * @returns {google.firestore.v1.BatchWriteRequest} BatchWriteRequest instance + */ + BatchWriteRequest.create = function create(properties) { + return new BatchWriteRequest(properties); + }; + + /** + * Encodes the specified BatchWriteRequest message. Does not implicitly {@link google.firestore.v1.BatchWriteRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.BatchWriteRequest + * @static + * @param {google.firestore.v1.IBatchWriteRequest} message BatchWriteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchWriteRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.writes != null && message.writes.length) + for (var i = 0; i < message.writes.length; ++i) + $root.google.firestore.v1.Write.encode(message.writes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchWriteRequest message, length delimited. Does not implicitly {@link google.firestore.v1.BatchWriteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.BatchWriteRequest + * @static + * @param {google.firestore.v1.IBatchWriteRequest} message BatchWriteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchWriteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BatchWriteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.BatchWriteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.BatchWriteRequest} BatchWriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchWriteRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.BatchWriteRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + if (!(message.writes && message.writes.length)) + message.writes = []; + message.writes.push($root.google.firestore.v1.Write.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.labels, key); + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BatchWriteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.BatchWriteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.BatchWriteRequest} BatchWriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchWriteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchWriteRequest message. + * @function verify + * @memberof google.firestore.v1.BatchWriteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchWriteRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.writes != null && Object.hasOwnProperty.call(message, "writes")) { + if (!Array.isArray(message.writes)) + return "writes: array expected"; + for (var i = 0; i < message.writes.length; ++i) { + var error = $root.google.firestore.v1.Write.verify(message.writes[i], long + 1); + if (error) + return "writes." + error; + } + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a BatchWriteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.BatchWriteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.BatchWriteRequest} BatchWriteRequest + */ + BatchWriteRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.BatchWriteRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.BatchWriteRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.BatchWriteRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.writes) { + if (!Array.isArray(object.writes)) + throw TypeError(".google.firestore.v1.BatchWriteRequest.writes: array expected"); + message.writes = []; + for (var i = 0; i < object.writes.length; ++i) { + if (!$util.isObject(object.writes[i])) + throw TypeError(".google.firestore.v1.BatchWriteRequest.writes: object expected"); + message.writes[i] = $root.google.firestore.v1.Write.fromObject(object.writes[i], long + 1); + } + } + if (object.labels) { + if (!$util.isObject(object.labels)) + throw TypeError(".google.firestore.v1.BatchWriteRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchWriteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.BatchWriteRequest + * @static + * @param {google.firestore.v1.BatchWriteRequest} message BatchWriteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchWriteRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writes = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) + object.database = ""; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.writes && message.writes.length) { + object.writes = []; + for (var j = 0; j < message.writes.length; ++j) + object.writes[j] = $root.google.firestore.v1.Write.toObject(message.writes[j], options, q + 1); + } + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + } + return object; + }; + + /** + * Converts this BatchWriteRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1.BatchWriteRequest + * @instance + * @returns {Object.} JSON object + */ + BatchWriteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchWriteRequest + * @function getTypeUrl + * @memberof google.firestore.v1.BatchWriteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchWriteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.BatchWriteRequest"; + }; + + return BatchWriteRequest; + })(); + + v1.BatchWriteResponse = (function() { + + /** + * Properties of a BatchWriteResponse. + * @memberof google.firestore.v1 + * @interface IBatchWriteResponse + * @property {Array.|null} [writeResults] BatchWriteResponse writeResults + * @property {Array.|null} [status] BatchWriteResponse status + */ + + /** + * Constructs a new BatchWriteResponse. + * @memberof google.firestore.v1 + * @classdesc Represents a BatchWriteResponse. + * @implements IBatchWriteResponse + * @constructor + * @param {google.firestore.v1.IBatchWriteResponse=} [properties] Properties to set + */ + function BatchWriteResponse(properties) { + this.writeResults = []; + this.status = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchWriteResponse writeResults. + * @member {Array.} writeResults + * @memberof google.firestore.v1.BatchWriteResponse + * @instance + */ + BatchWriteResponse.prototype.writeResults = $util.emptyArray; + + /** + * BatchWriteResponse status. + * @member {Array.} status + * @memberof google.firestore.v1.BatchWriteResponse + * @instance + */ + BatchWriteResponse.prototype.status = $util.emptyArray; + + /** + * Creates a new BatchWriteResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1.BatchWriteResponse + * @static + * @param {google.firestore.v1.IBatchWriteResponse=} [properties] Properties to set + * @returns {google.firestore.v1.BatchWriteResponse} BatchWriteResponse instance + */ + BatchWriteResponse.create = function create(properties) { + return new BatchWriteResponse(properties); + }; + + /** + * Encodes the specified BatchWriteResponse message. Does not implicitly {@link google.firestore.v1.BatchWriteResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.BatchWriteResponse + * @static + * @param {google.firestore.v1.IBatchWriteResponse} message BatchWriteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchWriteResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.writeResults != null && message.writeResults.length) + for (var i = 0; i < message.writeResults.length; ++i) + $root.google.firestore.v1.WriteResult.encode(message.writeResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.status != null && message.status.length) + for (var i = 0; i < message.status.length; ++i) + $root.google.rpc.Status.encode(message.status[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchWriteResponse message, length delimited. Does not implicitly {@link google.firestore.v1.BatchWriteResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.BatchWriteResponse + * @static + * @param {google.firestore.v1.IBatchWriteResponse} message BatchWriteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchWriteResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BatchWriteResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.BatchWriteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.BatchWriteResponse} BatchWriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchWriteResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.BatchWriteResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.writeResults && message.writeResults.length)) + message.writeResults = []; + message.writeResults.push($root.google.firestore.v1.WriteResult.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + if (!(message.status && message.status.length)) + message.status = []; + message.status.push($root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BatchWriteResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.BatchWriteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.BatchWriteResponse} BatchWriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchWriteResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchWriteResponse message. + * @function verify + * @memberof google.firestore.v1.BatchWriteResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchWriteResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.writeResults != null && Object.hasOwnProperty.call(message, "writeResults")) { + if (!Array.isArray(message.writeResults)) + return "writeResults: array expected"; + for (var i = 0; i < message.writeResults.length; ++i) { + var error = $root.google.firestore.v1.WriteResult.verify(message.writeResults[i], long + 1); + if (error) + return "writeResults." + error; + } + } + if (message.status != null && Object.hasOwnProperty.call(message, "status")) { + if (!Array.isArray(message.status)) + return "status: array expected"; + for (var i = 0; i < message.status.length; ++i) { + var error = $root.google.rpc.Status.verify(message.status[i], long + 1); + if (error) + return "status." + error; + } + } + return null; + }; + + /** + * Creates a BatchWriteResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.BatchWriteResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.BatchWriteResponse} BatchWriteResponse + */ + BatchWriteResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.BatchWriteResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.BatchWriteResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.BatchWriteResponse(); + if (object.writeResults) { + if (!Array.isArray(object.writeResults)) + throw TypeError(".google.firestore.v1.BatchWriteResponse.writeResults: array expected"); + message.writeResults = []; + for (var i = 0; i < object.writeResults.length; ++i) { + if (!$util.isObject(object.writeResults[i])) + throw TypeError(".google.firestore.v1.BatchWriteResponse.writeResults: object expected"); + message.writeResults[i] = $root.google.firestore.v1.WriteResult.fromObject(object.writeResults[i], long + 1); + } + } + if (object.status) { + if (!Array.isArray(object.status)) + throw TypeError(".google.firestore.v1.BatchWriteResponse.status: array expected"); + message.status = []; + for (var i = 0; i < object.status.length; ++i) { + if (!$util.isObject(object.status[i])) + throw TypeError(".google.firestore.v1.BatchWriteResponse.status: object expected"); + message.status[i] = $root.google.rpc.Status.fromObject(object.status[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchWriteResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.BatchWriteResponse + * @static + * @param {google.firestore.v1.BatchWriteResponse} message BatchWriteResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchWriteResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.writeResults = []; + object.status = []; + } + if (message.writeResults && message.writeResults.length) { + object.writeResults = []; + for (var j = 0; j < message.writeResults.length; ++j) + object.writeResults[j] = $root.google.firestore.v1.WriteResult.toObject(message.writeResults[j], options, q + 1); + } + if (message.status && message.status.length) { + object.status = []; + for (var j = 0; j < message.status.length; ++j) + object.status[j] = $root.google.rpc.Status.toObject(message.status[j], options, q + 1); + } + return object; + }; + + /** + * Converts this BatchWriteResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1.BatchWriteResponse + * @instance + * @returns {Object.} JSON object + */ + BatchWriteResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchWriteResponse + * @function getTypeUrl + * @memberof google.firestore.v1.BatchWriteResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchWriteResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.BatchWriteResponse"; + }; + + return BatchWriteResponse; + })(); + + v1.StructuredPipeline = (function() { + + /** + * Properties of a StructuredPipeline. + * @memberof google.firestore.v1 + * @interface IStructuredPipeline + * @property {google.firestore.v1.IPipeline|null} [pipeline] StructuredPipeline pipeline + * @property {Object.|null} [options] StructuredPipeline options + */ + + /** + * Constructs a new StructuredPipeline. + * @memberof google.firestore.v1 + * @classdesc Represents a StructuredPipeline. + * @implements IStructuredPipeline + * @constructor + * @param {google.firestore.v1.IStructuredPipeline=} [properties] Properties to set + */ + function StructuredPipeline(properties) { + this.options = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * StructuredPipeline pipeline. + * @member {google.firestore.v1.IPipeline|null|undefined} pipeline + * @memberof google.firestore.v1.StructuredPipeline + * @instance + */ + StructuredPipeline.prototype.pipeline = null; + + /** + * StructuredPipeline options. + * @member {Object.} options + * @memberof google.firestore.v1.StructuredPipeline + * @instance + */ + StructuredPipeline.prototype.options = $util.emptyObject; + + /** + * Creates a new StructuredPipeline instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredPipeline + * @static + * @param {google.firestore.v1.IStructuredPipeline=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredPipeline} StructuredPipeline instance + */ + StructuredPipeline.create = function create(properties) { + return new StructuredPipeline(properties); + }; + + /** + * Encodes the specified StructuredPipeline message. Does not implicitly {@link google.firestore.v1.StructuredPipeline.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredPipeline + * @static + * @param {google.firestore.v1.IStructuredPipeline} message StructuredPipeline message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StructuredPipeline.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.pipeline != null && Object.hasOwnProperty.call(message, "pipeline")) + $root.google.firestore.v1.Pipeline.encode(message.pipeline, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + for (var keys = Object.keys(message.options), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.firestore.v1.Value.encode(message.options[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified StructuredPipeline message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredPipeline.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredPipeline + * @static + * @param {google.firestore.v1.IStructuredPipeline} message StructuredPipeline message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StructuredPipeline.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a StructuredPipeline message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredPipeline + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredPipeline} StructuredPipeline + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StructuredPipeline.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredPipeline(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.pipeline = $root.google.firestore.v1.Pipeline.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + if (message.options === $util.emptyObject) + message.options = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.options, key); + message.options[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a StructuredPipeline message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredPipeline + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredPipeline} StructuredPipeline + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StructuredPipeline.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StructuredPipeline message. + * @function verify + * @memberof google.firestore.v1.StructuredPipeline + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StructuredPipeline.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.pipeline != null && Object.hasOwnProperty.call(message, "pipeline")) { + var error = $root.google.firestore.v1.Pipeline.verify(message.pipeline, long + 1); + if (error) + return "pipeline." + error; + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + if (!$util.isObject(message.options)) + return "options: object expected"; + var key = Object.keys(message.options); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.options[key[i]], long + 1); + if (error) + return "options." + error; + } + } + return null; + }; + + /** + * Creates a StructuredPipeline message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredPipeline + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredPipeline} StructuredPipeline + */ + StructuredPipeline.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredPipeline) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredPipeline: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredPipeline(); + if (object.pipeline != null) { + if (!$util.isObject(object.pipeline)) + throw TypeError(".google.firestore.v1.StructuredPipeline.pipeline: object expected"); + message.pipeline = $root.google.firestore.v1.Pipeline.fromObject(object.pipeline, long + 1); + } + if (object.options) { + if (!$util.isObject(object.options)) + throw TypeError(".google.firestore.v1.StructuredPipeline.options: object expected"); + message.options = {}; + for (var keys = Object.keys(object.options), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.options, keys[i]); + if (!$util.isObject(object.options[keys[i]])) + throw TypeError(".google.firestore.v1.StructuredPipeline.options: object expected"); + message.options[keys[i]] = $root.google.firestore.v1.Value.fromObject(object.options[keys[i]], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a StructuredPipeline message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredPipeline + * @static + * @param {google.firestore.v1.StructuredPipeline} message StructuredPipeline + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StructuredPipeline.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.options = {}; + if (options.defaults) + object.pipeline = null; + if (message.pipeline != null && Object.hasOwnProperty.call(message, "pipeline")) + object.pipeline = $root.google.firestore.v1.Pipeline.toObject(message.pipeline, options, q + 1); + var keys2; + if (message.options && (keys2 = Object.keys(message.options)).length) { + object.options = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.options, keys2[j]); + object.options[keys2[j]] = $root.google.firestore.v1.Value.toObject(message.options[keys2[j]], options, q + 1); + } + } + return object; + }; + + /** + * Converts this StructuredPipeline to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredPipeline + * @instance + * @returns {Object.} JSON object + */ + StructuredPipeline.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StructuredPipeline + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredPipeline + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StructuredPipeline.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredPipeline"; + }; + + return StructuredPipeline; + })(); + + v1.StructuredQuery = (function() { + + /** + * Properties of a StructuredQuery. + * @memberof google.firestore.v1 + * @interface IStructuredQuery + * @property {google.firestore.v1.StructuredQuery.IProjection|null} [select] StructuredQuery select + * @property {Array.|null} [from] StructuredQuery from + * @property {google.firestore.v1.StructuredQuery.IFilter|null} [where] StructuredQuery where + * @property {Array.|null} [orderBy] StructuredQuery orderBy + * @property {google.firestore.v1.ICursor|null} [startAt] StructuredQuery startAt + * @property {google.firestore.v1.ICursor|null} [endAt] StructuredQuery endAt + * @property {number|null} [offset] StructuredQuery offset + * @property {google.protobuf.IInt32Value|null} [limit] StructuredQuery limit + * @property {google.firestore.v1.StructuredQuery.IFindNearest|null} [findNearest] StructuredQuery findNearest + */ + + /** + * Constructs a new StructuredQuery. + * @memberof google.firestore.v1 + * @classdesc Represents a StructuredQuery. + * @implements IStructuredQuery + * @constructor + * @param {google.firestore.v1.IStructuredQuery=} [properties] Properties to set + */ + function StructuredQuery(properties) { + this.from = []; + this.orderBy = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * StructuredQuery select. + * @member {google.firestore.v1.StructuredQuery.IProjection|null|undefined} select + * @memberof google.firestore.v1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.select = null; + + /** + * StructuredQuery from. + * @member {Array.} from + * @memberof google.firestore.v1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.from = $util.emptyArray; + + /** + * StructuredQuery where. + * @member {google.firestore.v1.StructuredQuery.IFilter|null|undefined} where + * @memberof google.firestore.v1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.where = null; + + /** + * StructuredQuery orderBy. + * @member {Array.} orderBy + * @memberof google.firestore.v1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.orderBy = $util.emptyArray; + + /** + * StructuredQuery startAt. + * @member {google.firestore.v1.ICursor|null|undefined} startAt + * @memberof google.firestore.v1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.startAt = null; + + /** + * StructuredQuery endAt. + * @member {google.firestore.v1.ICursor|null|undefined} endAt + * @memberof google.firestore.v1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.endAt = null; + + /** + * StructuredQuery offset. + * @member {number} offset + * @memberof google.firestore.v1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.offset = 0; + + /** + * StructuredQuery limit. + * @member {google.protobuf.IInt32Value|null|undefined} limit + * @memberof google.firestore.v1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.limit = null; + + /** + * StructuredQuery findNearest. + * @member {google.firestore.v1.StructuredQuery.IFindNearest|null|undefined} findNearest + * @memberof google.firestore.v1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.findNearest = null; + + /** + * Creates a new StructuredQuery instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery + * @static + * @param {google.firestore.v1.IStructuredQuery=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery} StructuredQuery instance + */ + StructuredQuery.create = function create(properties) { + return new StructuredQuery(properties); + }; + + /** + * Encodes the specified StructuredQuery message. Does not implicitly {@link google.firestore.v1.StructuredQuery.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery + * @static + * @param {google.firestore.v1.IStructuredQuery} message StructuredQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StructuredQuery.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.select != null && Object.hasOwnProperty.call(message, "select")) + $root.google.firestore.v1.StructuredQuery.Projection.encode(message.select, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.from != null && message.from.length) + for (var i = 0; i < message.from.length; ++i) + $root.google.firestore.v1.StructuredQuery.CollectionSelector.encode(message.from[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.where != null && Object.hasOwnProperty.call(message, "where")) + $root.google.firestore.v1.StructuredQuery.Filter.encode(message.where, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.orderBy != null && message.orderBy.length) + for (var i = 0; i < message.orderBy.length; ++i) + $root.google.firestore.v1.StructuredQuery.Order.encode(message.orderBy[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + $root.google.protobuf.Int32Value.encode(message.limit, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.offset); + if (message.startAt != null && Object.hasOwnProperty.call(message, "startAt")) + $root.google.firestore.v1.Cursor.encode(message.startAt, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.endAt != null && Object.hasOwnProperty.call(message, "endAt")) + $root.google.firestore.v1.Cursor.encode(message.endAt, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + if (message.findNearest != null && Object.hasOwnProperty.call(message, "findNearest")) + $root.google.firestore.v1.StructuredQuery.FindNearest.encode(message.findNearest, writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified StructuredQuery message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery + * @static + * @param {google.firestore.v1.IStructuredQuery} message StructuredQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StructuredQuery.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a StructuredQuery message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery} StructuredQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StructuredQuery.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.select = $root.google.firestore.v1.StructuredQuery.Projection.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + if (!(message.from && message.from.length)) + message.from = []; + message.from.push($root.google.firestore.v1.StructuredQuery.CollectionSelector.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + message.where = $root.google.firestore.v1.StructuredQuery.Filter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + if (!(message.orderBy && message.orderBy.length)) + message.orderBy = []; + message.orderBy.push($root.google.firestore.v1.StructuredQuery.Order.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 7: { + message.startAt = $root.google.firestore.v1.Cursor.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 8: { + message.endAt = $root.google.firestore.v1.Cursor.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.offset = reader.int32(); + break; + } + case 5: { + message.limit = $root.google.protobuf.Int32Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 9: { + message.findNearest = $root.google.firestore.v1.StructuredQuery.FindNearest.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a StructuredQuery message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery} StructuredQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StructuredQuery.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StructuredQuery message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StructuredQuery.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.select != null && Object.hasOwnProperty.call(message, "select")) { + var error = $root.google.firestore.v1.StructuredQuery.Projection.verify(message.select, long + 1); + if (error) + return "select." + error; + } + if (message.from != null && Object.hasOwnProperty.call(message, "from")) { + if (!Array.isArray(message.from)) + return "from: array expected"; + for (var i = 0; i < message.from.length; ++i) { + var error = $root.google.firestore.v1.StructuredQuery.CollectionSelector.verify(message.from[i], long + 1); + if (error) + return "from." + error; + } + } + if (message.where != null && Object.hasOwnProperty.call(message, "where")) { + var error = $root.google.firestore.v1.StructuredQuery.Filter.verify(message.where, long + 1); + if (error) + return "where." + error; + } + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) { + if (!Array.isArray(message.orderBy)) + return "orderBy: array expected"; + for (var i = 0; i < message.orderBy.length; ++i) { + var error = $root.google.firestore.v1.StructuredQuery.Order.verify(message.orderBy[i], long + 1); + if (error) + return "orderBy." + error; + } + } + if (message.startAt != null && Object.hasOwnProperty.call(message, "startAt")) { + var error = $root.google.firestore.v1.Cursor.verify(message.startAt, long + 1); + if (error) + return "startAt." + error; + } + if (message.endAt != null && Object.hasOwnProperty.call(message, "endAt")) { + var error = $root.google.firestore.v1.Cursor.verify(message.endAt, long + 1); + if (error) + return "endAt." + error; + } + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) { + var error = $root.google.protobuf.Int32Value.verify(message.limit, long + 1); + if (error) + return "limit." + error; + } + if (message.findNearest != null && Object.hasOwnProperty.call(message, "findNearest")) { + var error = $root.google.firestore.v1.StructuredQuery.FindNearest.verify(message.findNearest, long + 1); + if (error) + return "findNearest." + error; + } + return null; + }; + + /** + * Creates a StructuredQuery message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery} StructuredQuery + */ + StructuredQuery.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery(); + if (object.select != null) { + if (!$util.isObject(object.select)) + throw TypeError(".google.firestore.v1.StructuredQuery.select: object expected"); + message.select = $root.google.firestore.v1.StructuredQuery.Projection.fromObject(object.select, long + 1); + } + if (object.from) { + if (!Array.isArray(object.from)) + throw TypeError(".google.firestore.v1.StructuredQuery.from: array expected"); + message.from = []; + for (var i = 0; i < object.from.length; ++i) { + if (!$util.isObject(object.from[i])) + throw TypeError(".google.firestore.v1.StructuredQuery.from: object expected"); + message.from[i] = $root.google.firestore.v1.StructuredQuery.CollectionSelector.fromObject(object.from[i], long + 1); + } + } + if (object.where != null) { + if (!$util.isObject(object.where)) + throw TypeError(".google.firestore.v1.StructuredQuery.where: object expected"); + message.where = $root.google.firestore.v1.StructuredQuery.Filter.fromObject(object.where, long + 1); + } + if (object.orderBy) { + if (!Array.isArray(object.orderBy)) + throw TypeError(".google.firestore.v1.StructuredQuery.orderBy: array expected"); + message.orderBy = []; + for (var i = 0; i < object.orderBy.length; ++i) { + if (!$util.isObject(object.orderBy[i])) + throw TypeError(".google.firestore.v1.StructuredQuery.orderBy: object expected"); + message.orderBy[i] = $root.google.firestore.v1.StructuredQuery.Order.fromObject(object.orderBy[i], long + 1); + } + } + if (object.startAt != null) { + if (!$util.isObject(object.startAt)) + throw TypeError(".google.firestore.v1.StructuredQuery.startAt: object expected"); + message.startAt = $root.google.firestore.v1.Cursor.fromObject(object.startAt, long + 1); + } + if (object.endAt != null) { + if (!$util.isObject(object.endAt)) + throw TypeError(".google.firestore.v1.StructuredQuery.endAt: object expected"); + message.endAt = $root.google.firestore.v1.Cursor.fromObject(object.endAt, long + 1); + } + if (object.offset != null) + message.offset = object.offset | 0; + if (object.limit != null) { + if (!$util.isObject(object.limit)) + throw TypeError(".google.firestore.v1.StructuredQuery.limit: object expected"); + message.limit = $root.google.protobuf.Int32Value.fromObject(object.limit, long + 1); + } + if (object.findNearest != null) { + if (!$util.isObject(object.findNearest)) + throw TypeError(".google.firestore.v1.StructuredQuery.findNearest: object expected"); + message.findNearest = $root.google.firestore.v1.StructuredQuery.FindNearest.fromObject(object.findNearest, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a StructuredQuery message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery + * @static + * @param {google.firestore.v1.StructuredQuery} message StructuredQuery + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StructuredQuery.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.from = []; + object.orderBy = []; + } + if (options.defaults) { + object.select = null; + object.where = null; + object.limit = null; + object.offset = 0; + object.startAt = null; + object.endAt = null; + object.findNearest = null; + } + if (message.select != null && Object.hasOwnProperty.call(message, "select")) + object.select = $root.google.firestore.v1.StructuredQuery.Projection.toObject(message.select, options, q + 1); + if (message.from && message.from.length) { + object.from = []; + for (var j = 0; j < message.from.length; ++j) + object.from[j] = $root.google.firestore.v1.StructuredQuery.CollectionSelector.toObject(message.from[j], options, q + 1); + } + if (message.where != null && Object.hasOwnProperty.call(message, "where")) + object.where = $root.google.firestore.v1.StructuredQuery.Filter.toObject(message.where, options, q + 1); + if (message.orderBy && message.orderBy.length) { + object.orderBy = []; + for (var j = 0; j < message.orderBy.length; ++j) + object.orderBy[j] = $root.google.firestore.v1.StructuredQuery.Order.toObject(message.orderBy[j], options, q + 1); + } + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + object.limit = $root.google.protobuf.Int32Value.toObject(message.limit, options, q + 1); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + object.offset = message.offset; + if (message.startAt != null && Object.hasOwnProperty.call(message, "startAt")) + object.startAt = $root.google.firestore.v1.Cursor.toObject(message.startAt, options, q + 1); + if (message.endAt != null && Object.hasOwnProperty.call(message, "endAt")) + object.endAt = $root.google.firestore.v1.Cursor.toObject(message.endAt, options, q + 1); + if (message.findNearest != null && Object.hasOwnProperty.call(message, "findNearest")) + object.findNearest = $root.google.firestore.v1.StructuredQuery.FindNearest.toObject(message.findNearest, options, q + 1); + return object; + }; + + /** + * Converts this StructuredQuery to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery + * @instance + * @returns {Object.} JSON object + */ + StructuredQuery.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StructuredQuery + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StructuredQuery.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery"; + }; + + StructuredQuery.CollectionSelector = (function() { + + /** + * Properties of a CollectionSelector. + * @memberof google.firestore.v1.StructuredQuery + * @interface ICollectionSelector + * @property {string|null} [collectionId] CollectionSelector collectionId + * @property {boolean|null} [allDescendants] CollectionSelector allDescendants + */ + + /** + * Constructs a new CollectionSelector. + * @memberof google.firestore.v1.StructuredQuery + * @classdesc Represents a CollectionSelector. + * @implements ICollectionSelector + * @constructor + * @param {google.firestore.v1.StructuredQuery.ICollectionSelector=} [properties] Properties to set + */ + function CollectionSelector(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CollectionSelector collectionId. + * @member {string} collectionId + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @instance + */ + CollectionSelector.prototype.collectionId = ""; + + /** + * CollectionSelector allDescendants. + * @member {boolean} allDescendants + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @instance + */ + CollectionSelector.prototype.allDescendants = false; + + /** + * Creates a new CollectionSelector instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @static + * @param {google.firestore.v1.StructuredQuery.ICollectionSelector=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery.CollectionSelector} CollectionSelector instance + */ + CollectionSelector.create = function create(properties) { + return new CollectionSelector(properties); + }; + + /** + * Encodes the specified CollectionSelector message. Does not implicitly {@link google.firestore.v1.StructuredQuery.CollectionSelector.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @static + * @param {google.firestore.v1.StructuredQuery.ICollectionSelector} message CollectionSelector message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectionSelector.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.collectionId); + if (message.allDescendants != null && Object.hasOwnProperty.call(message, "allDescendants")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allDescendants); + return writer; + }; + + /** + * Encodes the specified CollectionSelector message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.CollectionSelector.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @static + * @param {google.firestore.v1.StructuredQuery.ICollectionSelector} message CollectionSelector message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectionSelector.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CollectionSelector message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery.CollectionSelector} CollectionSelector + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectionSelector.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery.CollectionSelector(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.collectionId = reader.string(); + break; + } + case 3: { + message.allDescendants = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CollectionSelector message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery.CollectionSelector} CollectionSelector + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectionSelector.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CollectionSelector message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CollectionSelector.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + if (!$util.isString(message.collectionId)) + return "collectionId: string expected"; + if (message.allDescendants != null && Object.hasOwnProperty.call(message, "allDescendants")) + if (typeof message.allDescendants !== "boolean") + return "allDescendants: boolean expected"; + return null; + }; + + /** + * Creates a CollectionSelector message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery.CollectionSelector} CollectionSelector + */ + CollectionSelector.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery.CollectionSelector) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery.CollectionSelector: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery.CollectionSelector(); + if (object.collectionId != null) + message.collectionId = String(object.collectionId); + if (object.allDescendants != null) + message.allDescendants = Boolean(object.allDescendants); + return message; + }; + + /** + * Creates a plain object from a CollectionSelector message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @static + * @param {google.firestore.v1.StructuredQuery.CollectionSelector} message CollectionSelector + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CollectionSelector.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.collectionId = ""; + object.allDescendants = false; + } + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + object.collectionId = message.collectionId; + if (message.allDescendants != null && Object.hasOwnProperty.call(message, "allDescendants")) + object.allDescendants = message.allDescendants; + return object; + }; + + /** + * Converts this CollectionSelector to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @instance + * @returns {Object.} JSON object + */ + CollectionSelector.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CollectionSelector + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery.CollectionSelector + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CollectionSelector.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery.CollectionSelector"; + }; + + return CollectionSelector; + })(); + + StructuredQuery.Filter = (function() { + + /** + * Properties of a Filter. + * @memberof google.firestore.v1.StructuredQuery + * @interface IFilter + * @property {google.firestore.v1.StructuredQuery.ICompositeFilter|null} [compositeFilter] Filter compositeFilter + * @property {google.firestore.v1.StructuredQuery.IFieldFilter|null} [fieldFilter] Filter fieldFilter + * @property {google.firestore.v1.StructuredQuery.IUnaryFilter|null} [unaryFilter] Filter unaryFilter + */ + + /** + * Constructs a new Filter. + * @memberof google.firestore.v1.StructuredQuery + * @classdesc Represents a Filter. + * @implements IFilter + * @constructor + * @param {google.firestore.v1.StructuredQuery.IFilter=} [properties] Properties to set + */ + function Filter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Filter compositeFilter. + * @member {google.firestore.v1.StructuredQuery.ICompositeFilter|null|undefined} compositeFilter + * @memberof google.firestore.v1.StructuredQuery.Filter + * @instance + */ + Filter.prototype.compositeFilter = null; + + /** + * Filter fieldFilter. + * @member {google.firestore.v1.StructuredQuery.IFieldFilter|null|undefined} fieldFilter + * @memberof google.firestore.v1.StructuredQuery.Filter + * @instance + */ + Filter.prototype.fieldFilter = null; + + /** + * Filter unaryFilter. + * @member {google.firestore.v1.StructuredQuery.IUnaryFilter|null|undefined} unaryFilter + * @memberof google.firestore.v1.StructuredQuery.Filter + * @instance + */ + Filter.prototype.unaryFilter = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Filter filterType. + * @member {"compositeFilter"|"fieldFilter"|"unaryFilter"|undefined} filterType + * @memberof google.firestore.v1.StructuredQuery.Filter + * @instance + */ + Object.defineProperty(Filter.prototype, "filterType", { + get: $util.oneOfGetter($oneOfFields = ["compositeFilter", "fieldFilter", "unaryFilter"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Filter instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery.Filter + * @static + * @param {google.firestore.v1.StructuredQuery.IFilter=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery.Filter} Filter instance + */ + Filter.create = function create(properties) { + return new Filter(properties); + }; + + /** + * Encodes the specified Filter message. Does not implicitly {@link google.firestore.v1.StructuredQuery.Filter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery.Filter + * @static + * @param {google.firestore.v1.StructuredQuery.IFilter} message Filter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Filter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.compositeFilter != null && Object.hasOwnProperty.call(message, "compositeFilter")) + $root.google.firestore.v1.StructuredQuery.CompositeFilter.encode(message.compositeFilter, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.fieldFilter != null && Object.hasOwnProperty.call(message, "fieldFilter")) + $root.google.firestore.v1.StructuredQuery.FieldFilter.encode(message.fieldFilter, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.unaryFilter != null && Object.hasOwnProperty.call(message, "unaryFilter")) + $root.google.firestore.v1.StructuredQuery.UnaryFilter.encode(message.unaryFilter, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Filter message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.Filter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery.Filter + * @static + * @param {google.firestore.v1.StructuredQuery.IFilter} message Filter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Filter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Filter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery.Filter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery.Filter} Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Filter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery.Filter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.compositeFilter = $root.google.firestore.v1.StructuredQuery.CompositeFilter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.fieldFilter = $root.google.firestore.v1.StructuredQuery.FieldFilter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.unaryFilter = $root.google.firestore.v1.StructuredQuery.UnaryFilter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Filter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery.Filter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery.Filter} Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Filter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Filter message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery.Filter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Filter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.compositeFilter != null && Object.hasOwnProperty.call(message, "compositeFilter")) { + properties.filterType = 1; + { + var error = $root.google.firestore.v1.StructuredQuery.CompositeFilter.verify(message.compositeFilter, long + 1); + if (error) + return "compositeFilter." + error; + } + } + if (message.fieldFilter != null && Object.hasOwnProperty.call(message, "fieldFilter")) { + if (properties.filterType === 1) + return "filterType: multiple values"; + properties.filterType = 1; + { + var error = $root.google.firestore.v1.StructuredQuery.FieldFilter.verify(message.fieldFilter, long + 1); + if (error) + return "fieldFilter." + error; + } + } + if (message.unaryFilter != null && Object.hasOwnProperty.call(message, "unaryFilter")) { + if (properties.filterType === 1) + return "filterType: multiple values"; + properties.filterType = 1; + { + var error = $root.google.firestore.v1.StructuredQuery.UnaryFilter.verify(message.unaryFilter, long + 1); + if (error) + return "unaryFilter." + error; + } + } + return null; + }; + + /** + * Creates a Filter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery.Filter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery.Filter} Filter + */ + Filter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery.Filter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery.Filter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery.Filter(); + if (object.compositeFilter != null) { + if (!$util.isObject(object.compositeFilter)) + throw TypeError(".google.firestore.v1.StructuredQuery.Filter.compositeFilter: object expected"); + message.compositeFilter = $root.google.firestore.v1.StructuredQuery.CompositeFilter.fromObject(object.compositeFilter, long + 1); + } + if (object.fieldFilter != null) { + if (!$util.isObject(object.fieldFilter)) + throw TypeError(".google.firestore.v1.StructuredQuery.Filter.fieldFilter: object expected"); + message.fieldFilter = $root.google.firestore.v1.StructuredQuery.FieldFilter.fromObject(object.fieldFilter, long + 1); + } + if (object.unaryFilter != null) { + if (!$util.isObject(object.unaryFilter)) + throw TypeError(".google.firestore.v1.StructuredQuery.Filter.unaryFilter: object expected"); + message.unaryFilter = $root.google.firestore.v1.StructuredQuery.UnaryFilter.fromObject(object.unaryFilter, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Filter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery.Filter + * @static + * @param {google.firestore.v1.StructuredQuery.Filter} message Filter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Filter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.compositeFilter != null && Object.hasOwnProperty.call(message, "compositeFilter")) { + object.compositeFilter = $root.google.firestore.v1.StructuredQuery.CompositeFilter.toObject(message.compositeFilter, options, q + 1); + if (options.oneofs) + object.filterType = "compositeFilter"; + } + if (message.fieldFilter != null && Object.hasOwnProperty.call(message, "fieldFilter")) { + object.fieldFilter = $root.google.firestore.v1.StructuredQuery.FieldFilter.toObject(message.fieldFilter, options, q + 1); + if (options.oneofs) + object.filterType = "fieldFilter"; + } + if (message.unaryFilter != null && Object.hasOwnProperty.call(message, "unaryFilter")) { + object.unaryFilter = $root.google.firestore.v1.StructuredQuery.UnaryFilter.toObject(message.unaryFilter, options, q + 1); + if (options.oneofs) + object.filterType = "unaryFilter"; + } + return object; + }; + + /** + * Converts this Filter to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery.Filter + * @instance + * @returns {Object.} JSON object + */ + Filter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Filter + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery.Filter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Filter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery.Filter"; + }; + + return Filter; + })(); + + StructuredQuery.CompositeFilter = (function() { + + /** + * Properties of a CompositeFilter. + * @memberof google.firestore.v1.StructuredQuery + * @interface ICompositeFilter + * @property {google.firestore.v1.StructuredQuery.CompositeFilter.Operator|null} [op] CompositeFilter op + * @property {Array.|null} [filters] CompositeFilter filters + */ + + /** + * Constructs a new CompositeFilter. + * @memberof google.firestore.v1.StructuredQuery + * @classdesc Represents a CompositeFilter. + * @implements ICompositeFilter + * @constructor + * @param {google.firestore.v1.StructuredQuery.ICompositeFilter=} [properties] Properties to set + */ + function CompositeFilter(properties) { + this.filters = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompositeFilter op. + * @member {google.firestore.v1.StructuredQuery.CompositeFilter.Operator} op + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @instance + */ + CompositeFilter.prototype.op = 0; + + /** + * CompositeFilter filters. + * @member {Array.} filters + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @instance + */ + CompositeFilter.prototype.filters = $util.emptyArray; + + /** + * Creates a new CompositeFilter instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @static + * @param {google.firestore.v1.StructuredQuery.ICompositeFilter=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery.CompositeFilter} CompositeFilter instance + */ + CompositeFilter.create = function create(properties) { + return new CompositeFilter(properties); + }; + + /** + * Encodes the specified CompositeFilter message. Does not implicitly {@link google.firestore.v1.StructuredQuery.CompositeFilter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @static + * @param {google.firestore.v1.StructuredQuery.ICompositeFilter} message CompositeFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompositeFilter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.op); + if (message.filters != null && message.filters.length) + for (var i = 0; i < message.filters.length; ++i) + $root.google.firestore.v1.StructuredQuery.Filter.encode(message.filters[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompositeFilter message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.CompositeFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @static + * @param {google.firestore.v1.StructuredQuery.ICompositeFilter} message CompositeFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompositeFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CompositeFilter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery.CompositeFilter} CompositeFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompositeFilter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery.CompositeFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.op = reader.int32(); + break; + } + case 2: { + if (!(message.filters && message.filters.length)) + message.filters = []; + message.filters.push($root.google.firestore.v1.StructuredQuery.Filter.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CompositeFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery.CompositeFilter} CompositeFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompositeFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompositeFilter message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompositeFilter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + switch (message.op) { + default: + return "op: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.filters != null && Object.hasOwnProperty.call(message, "filters")) { + if (!Array.isArray(message.filters)) + return "filters: array expected"; + for (var i = 0; i < message.filters.length; ++i) { + var error = $root.google.firestore.v1.StructuredQuery.Filter.verify(message.filters[i], long + 1); + if (error) + return "filters." + error; + } + } + return null; + }; + + /** + * Creates a CompositeFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery.CompositeFilter} CompositeFilter + */ + CompositeFilter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery.CompositeFilter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery.CompositeFilter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery.CompositeFilter(); + switch (object.op) { + default: + if (typeof object.op === "number") { + message.op = object.op; + break; + } + break; + case "OPERATOR_UNSPECIFIED": + case 0: + message.op = 0; + break; + case "AND": + case 1: + message.op = 1; + break; + case "OR": + case 2: + message.op = 2; + break; + } + if (object.filters) { + if (!Array.isArray(object.filters)) + throw TypeError(".google.firestore.v1.StructuredQuery.CompositeFilter.filters: array expected"); + message.filters = []; + for (var i = 0; i < object.filters.length; ++i) { + if (!$util.isObject(object.filters[i])) + throw TypeError(".google.firestore.v1.StructuredQuery.CompositeFilter.filters: object expected"); + message.filters[i] = $root.google.firestore.v1.StructuredQuery.Filter.fromObject(object.filters[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a CompositeFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @static + * @param {google.firestore.v1.StructuredQuery.CompositeFilter} message CompositeFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompositeFilter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.filters = []; + if (options.defaults) + object.op = options.enums === String ? "OPERATOR_UNSPECIFIED" : 0; + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + object.op = options.enums === String ? $root.google.firestore.v1.StructuredQuery.CompositeFilter.Operator[message.op] === undefined ? message.op : $root.google.firestore.v1.StructuredQuery.CompositeFilter.Operator[message.op] : message.op; + if (message.filters && message.filters.length) { + object.filters = []; + for (var j = 0; j < message.filters.length; ++j) + object.filters[j] = $root.google.firestore.v1.StructuredQuery.Filter.toObject(message.filters[j], options, q + 1); + } + return object; + }; + + /** + * Converts this CompositeFilter to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @instance + * @returns {Object.} JSON object + */ + CompositeFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CompositeFilter + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery.CompositeFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompositeFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery.CompositeFilter"; + }; + + /** + * Operator enum. + * @name google.firestore.v1.StructuredQuery.CompositeFilter.Operator + * @enum {number} + * @property {number} OPERATOR_UNSPECIFIED=0 OPERATOR_UNSPECIFIED value + * @property {number} AND=1 AND value + * @property {number} OR=2 OR value + */ + CompositeFilter.Operator = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "AND"] = 1; + values[valuesById[2] = "OR"] = 2; + return values; + })(); + + return CompositeFilter; + })(); + + StructuredQuery.FieldFilter = (function() { + + /** + * Properties of a FieldFilter. + * @memberof google.firestore.v1.StructuredQuery + * @interface IFieldFilter + * @property {google.firestore.v1.StructuredQuery.IFieldReference|null} [field] FieldFilter field + * @property {google.firestore.v1.StructuredQuery.FieldFilter.Operator|null} [op] FieldFilter op + * @property {google.firestore.v1.IValue|null} [value] FieldFilter value + */ + + /** + * Constructs a new FieldFilter. + * @memberof google.firestore.v1.StructuredQuery + * @classdesc Represents a FieldFilter. + * @implements IFieldFilter + * @constructor + * @param {google.firestore.v1.StructuredQuery.IFieldFilter=} [properties] Properties to set + */ + function FieldFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldFilter field. + * @member {google.firestore.v1.StructuredQuery.IFieldReference|null|undefined} field + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @instance + */ + FieldFilter.prototype.field = null; + + /** + * FieldFilter op. + * @member {google.firestore.v1.StructuredQuery.FieldFilter.Operator} op + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @instance + */ + FieldFilter.prototype.op = 0; + + /** + * FieldFilter value. + * @member {google.firestore.v1.IValue|null|undefined} value + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @instance + */ + FieldFilter.prototype.value = null; + + /** + * Creates a new FieldFilter instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @static + * @param {google.firestore.v1.StructuredQuery.IFieldFilter=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery.FieldFilter} FieldFilter instance + */ + FieldFilter.create = function create(properties) { + return new FieldFilter(properties); + }; + + /** + * Encodes the specified FieldFilter message. Does not implicitly {@link google.firestore.v1.StructuredQuery.FieldFilter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @static + * @param {google.firestore.v1.StructuredQuery.IFieldFilter} message FieldFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldFilter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + $root.google.firestore.v1.StructuredQuery.FieldReference.encode(message.field, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.op); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + $root.google.firestore.v1.Value.encode(message.value, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldFilter message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.FieldFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @static + * @param {google.firestore.v1.StructuredQuery.IFieldFilter} message FieldFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldFilter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery.FieldFilter} FieldFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldFilter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery.FieldFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.op = reader.int32(); + break; + } + case 3: { + message.value = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery.FieldFilter} FieldFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldFilter message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldFilter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + var error = $root.google.firestore.v1.StructuredQuery.FieldReference.verify(message.field, long + 1); + if (error) + return "field." + error; + } + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + switch (message.op) { + default: + return "op: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + break; + } + if (message.value != null && Object.hasOwnProperty.call(message, "value")) { + var error = $root.google.firestore.v1.Value.verify(message.value, long + 1); + if (error) + return "value." + error; + } + return null; + }; + + /** + * Creates a FieldFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery.FieldFilter} FieldFilter + */ + FieldFilter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery.FieldFilter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery.FieldFilter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery.FieldFilter(); + if (object.field != null) { + if (!$util.isObject(object.field)) + throw TypeError(".google.firestore.v1.StructuredQuery.FieldFilter.field: object expected"); + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.fromObject(object.field, long + 1); + } + switch (object.op) { + default: + if (typeof object.op === "number") { + message.op = object.op; + break; + } + break; + case "OPERATOR_UNSPECIFIED": + case 0: + message.op = 0; + break; + case "LESS_THAN": + case 1: + message.op = 1; + break; + case "LESS_THAN_OR_EQUAL": + case 2: + message.op = 2; + break; + case "GREATER_THAN": + case 3: + message.op = 3; + break; + case "GREATER_THAN_OR_EQUAL": + case 4: + message.op = 4; + break; + case "EQUAL": + case 5: + message.op = 5; + break; + case "NOT_EQUAL": + case 6: + message.op = 6; + break; + case "ARRAY_CONTAINS": + case 7: + message.op = 7; + break; + case "IN": + case 8: + message.op = 8; + break; + case "ARRAY_CONTAINS_ANY": + case 9: + message.op = 9; + break; + case "NOT_IN": + case 10: + message.op = 10; + break; + } + if (object.value != null) { + if (!$util.isObject(object.value)) + throw TypeError(".google.firestore.v1.StructuredQuery.FieldFilter.value: object expected"); + message.value = $root.google.firestore.v1.Value.fromObject(object.value, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a FieldFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @static + * @param {google.firestore.v1.StructuredQuery.FieldFilter} message FieldFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldFilter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.field = null; + object.op = options.enums === String ? "OPERATOR_UNSPECIFIED" : 0; + object.value = null; + } + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + object.field = $root.google.firestore.v1.StructuredQuery.FieldReference.toObject(message.field, options, q + 1); + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + object.op = options.enums === String ? $root.google.firestore.v1.StructuredQuery.FieldFilter.Operator[message.op] === undefined ? message.op : $root.google.firestore.v1.StructuredQuery.FieldFilter.Operator[message.op] : message.op; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = $root.google.firestore.v1.Value.toObject(message.value, options, q + 1); + return object; + }; + + /** + * Converts this FieldFilter to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @instance + * @returns {Object.} JSON object + */ + FieldFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldFilter + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery.FieldFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery.FieldFilter"; + }; + + /** + * Operator enum. + * @name google.firestore.v1.StructuredQuery.FieldFilter.Operator + * @enum {number} + * @property {number} OPERATOR_UNSPECIFIED=0 OPERATOR_UNSPECIFIED value + * @property {number} LESS_THAN=1 LESS_THAN value + * @property {number} LESS_THAN_OR_EQUAL=2 LESS_THAN_OR_EQUAL value + * @property {number} GREATER_THAN=3 GREATER_THAN value + * @property {number} GREATER_THAN_OR_EQUAL=4 GREATER_THAN_OR_EQUAL value + * @property {number} EQUAL=5 EQUAL value + * @property {number} NOT_EQUAL=6 NOT_EQUAL value + * @property {number} ARRAY_CONTAINS=7 ARRAY_CONTAINS value + * @property {number} IN=8 IN value + * @property {number} ARRAY_CONTAINS_ANY=9 ARRAY_CONTAINS_ANY value + * @property {number} NOT_IN=10 NOT_IN value + */ + FieldFilter.Operator = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "LESS_THAN"] = 1; + values[valuesById[2] = "LESS_THAN_OR_EQUAL"] = 2; + values[valuesById[3] = "GREATER_THAN"] = 3; + values[valuesById[4] = "GREATER_THAN_OR_EQUAL"] = 4; + values[valuesById[5] = "EQUAL"] = 5; + values[valuesById[6] = "NOT_EQUAL"] = 6; + values[valuesById[7] = "ARRAY_CONTAINS"] = 7; + values[valuesById[8] = "IN"] = 8; + values[valuesById[9] = "ARRAY_CONTAINS_ANY"] = 9; + values[valuesById[10] = "NOT_IN"] = 10; + return values; + })(); + + return FieldFilter; + })(); + + StructuredQuery.UnaryFilter = (function() { + + /** + * Properties of an UnaryFilter. + * @memberof google.firestore.v1.StructuredQuery + * @interface IUnaryFilter + * @property {google.firestore.v1.StructuredQuery.UnaryFilter.Operator|null} [op] UnaryFilter op + * @property {google.firestore.v1.StructuredQuery.IFieldReference|null} [field] UnaryFilter field + */ + + /** + * Constructs a new UnaryFilter. + * @memberof google.firestore.v1.StructuredQuery + * @classdesc Represents an UnaryFilter. + * @implements IUnaryFilter + * @constructor + * @param {google.firestore.v1.StructuredQuery.IUnaryFilter=} [properties] Properties to set + */ + function UnaryFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UnaryFilter op. + * @member {google.firestore.v1.StructuredQuery.UnaryFilter.Operator} op + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @instance + */ + UnaryFilter.prototype.op = 0; + + /** + * UnaryFilter field. + * @member {google.firestore.v1.StructuredQuery.IFieldReference|null|undefined} field + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @instance + */ + UnaryFilter.prototype.field = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UnaryFilter operandType. + * @member {"field"|undefined} operandType + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @instance + */ + Object.defineProperty(UnaryFilter.prototype, "operandType", { + get: $util.oneOfGetter($oneOfFields = ["field"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UnaryFilter instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @static + * @param {google.firestore.v1.StructuredQuery.IUnaryFilter=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery.UnaryFilter} UnaryFilter instance + */ + UnaryFilter.create = function create(properties) { + return new UnaryFilter(properties); + }; + + /** + * Encodes the specified UnaryFilter message. Does not implicitly {@link google.firestore.v1.StructuredQuery.UnaryFilter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @static + * @param {google.firestore.v1.StructuredQuery.IUnaryFilter} message UnaryFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnaryFilter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.op); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + $root.google.firestore.v1.StructuredQuery.FieldReference.encode(message.field, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified UnaryFilter message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.UnaryFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @static + * @param {google.firestore.v1.StructuredQuery.IUnaryFilter} message UnaryFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnaryFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UnaryFilter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery.UnaryFilter} UnaryFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnaryFilter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery.UnaryFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.op = reader.int32(); + break; + } + case 2: { + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UnaryFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery.UnaryFilter} UnaryFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnaryFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UnaryFilter message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UnaryFilter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + switch (message.op) { + default: + return "op: enum value expected"; + case 0: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + properties.operandType = 1; + { + var error = $root.google.firestore.v1.StructuredQuery.FieldReference.verify(message.field, long + 1); + if (error) + return "field." + error; + } + } + return null; + }; + + /** + * Creates an UnaryFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery.UnaryFilter} UnaryFilter + */ + UnaryFilter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery.UnaryFilter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery.UnaryFilter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery.UnaryFilter(); + switch (object.op) { + default: + if (typeof object.op === "number") { + message.op = object.op; + break; + } + break; + case "OPERATOR_UNSPECIFIED": + case 0: + message.op = 0; + break; + case "IS_NAN": + case 2: + message.op = 2; + break; + case "IS_NULL": + case 3: + message.op = 3; + break; + case "IS_NOT_NAN": + case 4: + message.op = 4; + break; + case "IS_NOT_NULL": + case 5: + message.op = 5; + break; + } + if (object.field != null) { + if (!$util.isObject(object.field)) + throw TypeError(".google.firestore.v1.StructuredQuery.UnaryFilter.field: object expected"); + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.fromObject(object.field, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an UnaryFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @static + * @param {google.firestore.v1.StructuredQuery.UnaryFilter} message UnaryFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UnaryFilter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.op = options.enums === String ? "OPERATOR_UNSPECIFIED" : 0; + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + object.op = options.enums === String ? $root.google.firestore.v1.StructuredQuery.UnaryFilter.Operator[message.op] === undefined ? message.op : $root.google.firestore.v1.StructuredQuery.UnaryFilter.Operator[message.op] : message.op; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + object.field = $root.google.firestore.v1.StructuredQuery.FieldReference.toObject(message.field, options, q + 1); + if (options.oneofs) + object.operandType = "field"; + } + return object; + }; + + /** + * Converts this UnaryFilter to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @instance + * @returns {Object.} JSON object + */ + UnaryFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UnaryFilter + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery.UnaryFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UnaryFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery.UnaryFilter"; + }; + + /** + * Operator enum. + * @name google.firestore.v1.StructuredQuery.UnaryFilter.Operator + * @enum {number} + * @property {number} OPERATOR_UNSPECIFIED=0 OPERATOR_UNSPECIFIED value + * @property {number} IS_NAN=2 IS_NAN value + * @property {number} IS_NULL=3 IS_NULL value + * @property {number} IS_NOT_NAN=4 IS_NOT_NAN value + * @property {number} IS_NOT_NULL=5 IS_NOT_NULL value + */ + UnaryFilter.Operator = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATOR_UNSPECIFIED"] = 0; + values[valuesById[2] = "IS_NAN"] = 2; + values[valuesById[3] = "IS_NULL"] = 3; + values[valuesById[4] = "IS_NOT_NAN"] = 4; + values[valuesById[5] = "IS_NOT_NULL"] = 5; + return values; + })(); + + return UnaryFilter; + })(); + + StructuredQuery.Order = (function() { + + /** + * Properties of an Order. + * @memberof google.firestore.v1.StructuredQuery + * @interface IOrder + * @property {google.firestore.v1.StructuredQuery.IFieldReference|null} [field] Order field + * @property {google.firestore.v1.StructuredQuery.Direction|null} [direction] Order direction + */ + + /** + * Constructs a new Order. + * @memberof google.firestore.v1.StructuredQuery + * @classdesc Represents an Order. + * @implements IOrder + * @constructor + * @param {google.firestore.v1.StructuredQuery.IOrder=} [properties] Properties to set + */ + function Order(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Order field. + * @member {google.firestore.v1.StructuredQuery.IFieldReference|null|undefined} field + * @memberof google.firestore.v1.StructuredQuery.Order + * @instance + */ + Order.prototype.field = null; + + /** + * Order direction. + * @member {google.firestore.v1.StructuredQuery.Direction} direction + * @memberof google.firestore.v1.StructuredQuery.Order + * @instance + */ + Order.prototype.direction = 0; + + /** + * Creates a new Order instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery.Order + * @static + * @param {google.firestore.v1.StructuredQuery.IOrder=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery.Order} Order instance + */ + Order.create = function create(properties) { + return new Order(properties); + }; + + /** + * Encodes the specified Order message. Does not implicitly {@link google.firestore.v1.StructuredQuery.Order.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery.Order + * @static + * @param {google.firestore.v1.StructuredQuery.IOrder} message Order message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Order.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + $root.google.firestore.v1.StructuredQuery.FieldReference.encode(message.field, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.direction != null && Object.hasOwnProperty.call(message, "direction")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.direction); + return writer; + }; + + /** + * Encodes the specified Order message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.Order.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery.Order + * @static + * @param {google.firestore.v1.StructuredQuery.IOrder} message Order message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Order.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Order message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery.Order + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery.Order} Order + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Order.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery.Order(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.direction = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Order message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery.Order + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery.Order} Order + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Order.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Order message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery.Order + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Order.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + var error = $root.google.firestore.v1.StructuredQuery.FieldReference.verify(message.field, long + 1); + if (error) + return "field." + error; + } + if (message.direction != null && Object.hasOwnProperty.call(message, "direction")) + switch (message.direction) { + default: + return "direction: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an Order message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery.Order + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery.Order} Order + */ + Order.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery.Order) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery.Order: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery.Order(); + if (object.field != null) { + if (!$util.isObject(object.field)) + throw TypeError(".google.firestore.v1.StructuredQuery.Order.field: object expected"); + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.fromObject(object.field, long + 1); + } + switch (object.direction) { + default: + if (typeof object.direction === "number") { + message.direction = object.direction; + break; + } + break; + case "DIRECTION_UNSPECIFIED": + case 0: + message.direction = 0; + break; + case "ASCENDING": + case 1: + message.direction = 1; + break; + case "DESCENDING": + case 2: + message.direction = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an Order message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery.Order + * @static + * @param {google.firestore.v1.StructuredQuery.Order} message Order + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Order.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.field = null; + object.direction = options.enums === String ? "DIRECTION_UNSPECIFIED" : 0; + } + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + object.field = $root.google.firestore.v1.StructuredQuery.FieldReference.toObject(message.field, options, q + 1); + if (message.direction != null && Object.hasOwnProperty.call(message, "direction")) + object.direction = options.enums === String ? $root.google.firestore.v1.StructuredQuery.Direction[message.direction] === undefined ? message.direction : $root.google.firestore.v1.StructuredQuery.Direction[message.direction] : message.direction; + return object; + }; + + /** + * Converts this Order to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery.Order + * @instance + * @returns {Object.} JSON object + */ + Order.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Order + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery.Order + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Order.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery.Order"; + }; + + return Order; + })(); + + /** + * Direction enum. + * @name google.firestore.v1.StructuredQuery.Direction + * @enum {number} + * @property {number} DIRECTION_UNSPECIFIED=0 DIRECTION_UNSPECIFIED value + * @property {number} ASCENDING=1 ASCENDING value + * @property {number} DESCENDING=2 DESCENDING value + */ + StructuredQuery.Direction = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DIRECTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "ASCENDING"] = 1; + values[valuesById[2] = "DESCENDING"] = 2; + return values; + })(); + + StructuredQuery.FieldReference = (function() { + + /** + * Properties of a FieldReference. + * @memberof google.firestore.v1.StructuredQuery + * @interface IFieldReference + * @property {string|null} [fieldPath] FieldReference fieldPath + */ + + /** + * Constructs a new FieldReference. + * @memberof google.firestore.v1.StructuredQuery + * @classdesc Represents a FieldReference. + * @implements IFieldReference + * @constructor + * @param {google.firestore.v1.StructuredQuery.IFieldReference=} [properties] Properties to set + */ + function FieldReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldReference fieldPath. + * @member {string} fieldPath + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @instance + */ + FieldReference.prototype.fieldPath = ""; + + /** + * Creates a new FieldReference instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @static + * @param {google.firestore.v1.StructuredQuery.IFieldReference=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery.FieldReference} FieldReference instance + */ + FieldReference.create = function create(properties) { + return new FieldReference(properties); + }; + + /** + * Encodes the specified FieldReference message. Does not implicitly {@link google.firestore.v1.StructuredQuery.FieldReference.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @static + * @param {google.firestore.v1.StructuredQuery.IFieldReference} message FieldReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldReference.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.fieldPath); + return writer; + }; + + /** + * Encodes the specified FieldReference message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.FieldReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @static + * @param {google.firestore.v1.StructuredQuery.IFieldReference} message FieldReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldReference message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery.FieldReference} FieldReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldReference.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery.FieldReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.fieldPath = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery.FieldReference} FieldReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldReference message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldReference.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + if (!$util.isString(message.fieldPath)) + return "fieldPath: string expected"; + return null; + }; + + /** + * Creates a FieldReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery.FieldReference} FieldReference + */ + FieldReference.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery.FieldReference) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery.FieldReference: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery.FieldReference(); + if (object.fieldPath != null) + message.fieldPath = String(object.fieldPath); + return message; + }; + + /** + * Creates a plain object from a FieldReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @static + * @param {google.firestore.v1.StructuredQuery.FieldReference} message FieldReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldReference.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.fieldPath = ""; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + object.fieldPath = message.fieldPath; + return object; + }; + + /** + * Converts this FieldReference to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @instance + * @returns {Object.} JSON object + */ + FieldReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldReference + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery.FieldReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery.FieldReference"; + }; + + return FieldReference; + })(); + + StructuredQuery.Projection = (function() { + + /** + * Properties of a Projection. + * @memberof google.firestore.v1.StructuredQuery + * @interface IProjection + * @property {Array.|null} [fields] Projection fields + */ + + /** + * Constructs a new Projection. + * @memberof google.firestore.v1.StructuredQuery + * @classdesc Represents a Projection. + * @implements IProjection + * @constructor + * @param {google.firestore.v1.StructuredQuery.IProjection=} [properties] Properties to set + */ + function Projection(properties) { + this.fields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Projection fields. + * @member {Array.} fields + * @memberof google.firestore.v1.StructuredQuery.Projection + * @instance + */ + Projection.prototype.fields = $util.emptyArray; + + /** + * Creates a new Projection instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery.Projection + * @static + * @param {google.firestore.v1.StructuredQuery.IProjection=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery.Projection} Projection instance + */ + Projection.create = function create(properties) { + return new Projection(properties); + }; + + /** + * Encodes the specified Projection message. Does not implicitly {@link google.firestore.v1.StructuredQuery.Projection.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery.Projection + * @static + * @param {google.firestore.v1.StructuredQuery.IProjection} message Projection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Projection.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fields != null && message.fields.length) + for (var i = 0; i < message.fields.length; ++i) + $root.google.firestore.v1.StructuredQuery.FieldReference.encode(message.fields[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Projection message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.Projection.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery.Projection + * @static + * @param {google.firestore.v1.StructuredQuery.IProjection} message Projection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Projection.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Projection message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery.Projection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery.Projection} Projection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Projection.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery.Projection(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.fields && message.fields.length)) + message.fields = []; + message.fields.push($root.google.firestore.v1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Projection message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery.Projection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery.Projection} Projection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Projection.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Projection message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery.Projection + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Projection.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { + if (!Array.isArray(message.fields)) + return "fields: array expected"; + for (var i = 0; i < message.fields.length; ++i) { + var error = $root.google.firestore.v1.StructuredQuery.FieldReference.verify(message.fields[i], long + 1); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a Projection message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery.Projection + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery.Projection} Projection + */ + Projection.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery.Projection) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery.Projection: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery.Projection(); + if (object.fields) { + if (!Array.isArray(object.fields)) + throw TypeError(".google.firestore.v1.StructuredQuery.Projection.fields: array expected"); + message.fields = []; + for (var i = 0; i < object.fields.length; ++i) { + if (!$util.isObject(object.fields[i])) + throw TypeError(".google.firestore.v1.StructuredQuery.Projection.fields: object expected"); + message.fields[i] = $root.google.firestore.v1.StructuredQuery.FieldReference.fromObject(object.fields[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a Projection message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery.Projection + * @static + * @param {google.firestore.v1.StructuredQuery.Projection} message Projection + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Projection.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.fields = []; + if (message.fields && message.fields.length) { + object.fields = []; + for (var j = 0; j < message.fields.length; ++j) + object.fields[j] = $root.google.firestore.v1.StructuredQuery.FieldReference.toObject(message.fields[j], options, q + 1); + } + return object; + }; + + /** + * Converts this Projection to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery.Projection + * @instance + * @returns {Object.} JSON object + */ + Projection.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Projection + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery.Projection + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Projection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery.Projection"; + }; + + return Projection; + })(); + + StructuredQuery.FindNearest = (function() { + + /** + * Properties of a FindNearest. + * @memberof google.firestore.v1.StructuredQuery + * @interface IFindNearest + * @property {google.firestore.v1.StructuredQuery.IFieldReference|null} [vectorField] FindNearest vectorField + * @property {google.firestore.v1.IValue|null} [queryVector] FindNearest queryVector + * @property {google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure|null} [distanceMeasure] FindNearest distanceMeasure + * @property {google.protobuf.IInt32Value|null} [limit] FindNearest limit + * @property {string|null} [distanceResultField] FindNearest distanceResultField + * @property {google.protobuf.IDoubleValue|null} [distanceThreshold] FindNearest distanceThreshold + */ + + /** + * Constructs a new FindNearest. + * @memberof google.firestore.v1.StructuredQuery + * @classdesc Represents a FindNearest. + * @implements IFindNearest + * @constructor + * @param {google.firestore.v1.StructuredQuery.IFindNearest=} [properties] Properties to set + */ + function FindNearest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FindNearest vectorField. + * @member {google.firestore.v1.StructuredQuery.IFieldReference|null|undefined} vectorField + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @instance + */ + FindNearest.prototype.vectorField = null; + + /** + * FindNearest queryVector. + * @member {google.firestore.v1.IValue|null|undefined} queryVector + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @instance + */ + FindNearest.prototype.queryVector = null; + + /** + * FindNearest distanceMeasure. + * @member {google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure} distanceMeasure + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @instance + */ + FindNearest.prototype.distanceMeasure = 0; + + /** + * FindNearest limit. + * @member {google.protobuf.IInt32Value|null|undefined} limit + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @instance + */ + FindNearest.prototype.limit = null; + + /** + * FindNearest distanceResultField. + * @member {string} distanceResultField + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @instance + */ + FindNearest.prototype.distanceResultField = ""; + + /** + * FindNearest distanceThreshold. + * @member {google.protobuf.IDoubleValue|null|undefined} distanceThreshold + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @instance + */ + FindNearest.prototype.distanceThreshold = null; + + /** + * Creates a new FindNearest instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @static + * @param {google.firestore.v1.StructuredQuery.IFindNearest=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredQuery.FindNearest} FindNearest instance + */ + FindNearest.create = function create(properties) { + return new FindNearest(properties); + }; + + /** + * Encodes the specified FindNearest message. Does not implicitly {@link google.firestore.v1.StructuredQuery.FindNearest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @static + * @param {google.firestore.v1.StructuredQuery.IFindNearest} message FindNearest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FindNearest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.vectorField != null && Object.hasOwnProperty.call(message, "vectorField")) + $root.google.firestore.v1.StructuredQuery.FieldReference.encode(message.vectorField, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.queryVector != null && Object.hasOwnProperty.call(message, "queryVector")) + $root.google.firestore.v1.Value.encode(message.queryVector, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.distanceMeasure != null && Object.hasOwnProperty.call(message, "distanceMeasure")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.distanceMeasure); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + $root.google.protobuf.Int32Value.encode(message.limit, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.distanceResultField != null && Object.hasOwnProperty.call(message, "distanceResultField")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.distanceResultField); + if (message.distanceThreshold != null && Object.hasOwnProperty.call(message, "distanceThreshold")) + $root.google.protobuf.DoubleValue.encode(message.distanceThreshold, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FindNearest message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredQuery.FindNearest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @static + * @param {google.firestore.v1.StructuredQuery.IFindNearest} message FindNearest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FindNearest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FindNearest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredQuery.FindNearest} FindNearest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FindNearest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredQuery.FindNearest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.vectorField = $root.google.firestore.v1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.queryVector = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.distanceMeasure = reader.int32(); + break; + } + case 4: { + message.limit = $root.google.protobuf.Int32Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.distanceResultField = reader.string(); + break; + } + case 6: { + message.distanceThreshold = $root.google.protobuf.DoubleValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FindNearest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredQuery.FindNearest} FindNearest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FindNearest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FindNearest message. + * @function verify + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FindNearest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.vectorField != null && Object.hasOwnProperty.call(message, "vectorField")) { + var error = $root.google.firestore.v1.StructuredQuery.FieldReference.verify(message.vectorField, long + 1); + if (error) + return "vectorField." + error; + } + if (message.queryVector != null && Object.hasOwnProperty.call(message, "queryVector")) { + var error = $root.google.firestore.v1.Value.verify(message.queryVector, long + 1); + if (error) + return "queryVector." + error; + } + if (message.distanceMeasure != null && Object.hasOwnProperty.call(message, "distanceMeasure")) + switch (message.distanceMeasure) { + default: + return "distanceMeasure: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) { + var error = $root.google.protobuf.Int32Value.verify(message.limit, long + 1); + if (error) + return "limit." + error; + } + if (message.distanceResultField != null && Object.hasOwnProperty.call(message, "distanceResultField")) + if (!$util.isString(message.distanceResultField)) + return "distanceResultField: string expected"; + if (message.distanceThreshold != null && Object.hasOwnProperty.call(message, "distanceThreshold")) { + var error = $root.google.protobuf.DoubleValue.verify(message.distanceThreshold, long + 1); + if (error) + return "distanceThreshold." + error; + } + return null; + }; + + /** + * Creates a FindNearest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredQuery.FindNearest} FindNearest + */ + FindNearest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredQuery.FindNearest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredQuery.FindNearest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredQuery.FindNearest(); + if (object.vectorField != null) { + if (!$util.isObject(object.vectorField)) + throw TypeError(".google.firestore.v1.StructuredQuery.FindNearest.vectorField: object expected"); + message.vectorField = $root.google.firestore.v1.StructuredQuery.FieldReference.fromObject(object.vectorField, long + 1); + } + if (object.queryVector != null) { + if (!$util.isObject(object.queryVector)) + throw TypeError(".google.firestore.v1.StructuredQuery.FindNearest.queryVector: object expected"); + message.queryVector = $root.google.firestore.v1.Value.fromObject(object.queryVector, long + 1); + } + switch (object.distanceMeasure) { + default: + if (typeof object.distanceMeasure === "number") { + message.distanceMeasure = object.distanceMeasure; + break; + } + break; + case "DISTANCE_MEASURE_UNSPECIFIED": + case 0: + message.distanceMeasure = 0; + break; + case "EUCLIDEAN": + case 1: + message.distanceMeasure = 1; + break; + case "COSINE": + case 2: + message.distanceMeasure = 2; + break; + case "DOT_PRODUCT": + case 3: + message.distanceMeasure = 3; + break; + } + if (object.limit != null) { + if (!$util.isObject(object.limit)) + throw TypeError(".google.firestore.v1.StructuredQuery.FindNearest.limit: object expected"); + message.limit = $root.google.protobuf.Int32Value.fromObject(object.limit, long + 1); + } + if (object.distanceResultField != null) + message.distanceResultField = String(object.distanceResultField); + if (object.distanceThreshold != null) { + if (!$util.isObject(object.distanceThreshold)) + throw TypeError(".google.firestore.v1.StructuredQuery.FindNearest.distanceThreshold: object expected"); + message.distanceThreshold = $root.google.protobuf.DoubleValue.fromObject(object.distanceThreshold, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a FindNearest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @static + * @param {google.firestore.v1.StructuredQuery.FindNearest} message FindNearest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FindNearest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.vectorField = null; + object.queryVector = null; + object.distanceMeasure = options.enums === String ? "DISTANCE_MEASURE_UNSPECIFIED" : 0; + object.limit = null; + object.distanceResultField = ""; + object.distanceThreshold = null; + } + if (message.vectorField != null && Object.hasOwnProperty.call(message, "vectorField")) + object.vectorField = $root.google.firestore.v1.StructuredQuery.FieldReference.toObject(message.vectorField, options, q + 1); + if (message.queryVector != null && Object.hasOwnProperty.call(message, "queryVector")) + object.queryVector = $root.google.firestore.v1.Value.toObject(message.queryVector, options, q + 1); + if (message.distanceMeasure != null && Object.hasOwnProperty.call(message, "distanceMeasure")) + object.distanceMeasure = options.enums === String ? $root.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure[message.distanceMeasure] === undefined ? message.distanceMeasure : $root.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure[message.distanceMeasure] : message.distanceMeasure; + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + object.limit = $root.google.protobuf.Int32Value.toObject(message.limit, options, q + 1); + if (message.distanceResultField != null && Object.hasOwnProperty.call(message, "distanceResultField")) + object.distanceResultField = message.distanceResultField; + if (message.distanceThreshold != null && Object.hasOwnProperty.call(message, "distanceThreshold")) + object.distanceThreshold = $root.google.protobuf.DoubleValue.toObject(message.distanceThreshold, options, q + 1); + return object; + }; + + /** + * Converts this FindNearest to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @instance + * @returns {Object.} JSON object + */ + FindNearest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FindNearest + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredQuery.FindNearest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FindNearest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredQuery.FindNearest"; + }; + + /** + * DistanceMeasure enum. + * @name google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure + * @enum {number} + * @property {number} DISTANCE_MEASURE_UNSPECIFIED=0 DISTANCE_MEASURE_UNSPECIFIED value + * @property {number} EUCLIDEAN=1 EUCLIDEAN value + * @property {number} COSINE=2 COSINE value + * @property {number} DOT_PRODUCT=3 DOT_PRODUCT value + */ + FindNearest.DistanceMeasure = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DISTANCE_MEASURE_UNSPECIFIED"] = 0; + values[valuesById[1] = "EUCLIDEAN"] = 1; + values[valuesById[2] = "COSINE"] = 2; + values[valuesById[3] = "DOT_PRODUCT"] = 3; + return values; + })(); + + return FindNearest; + })(); + + return StructuredQuery; + })(); + + v1.StructuredAggregationQuery = (function() { + + /** + * Properties of a StructuredAggregationQuery. + * @memberof google.firestore.v1 + * @interface IStructuredAggregationQuery + * @property {google.firestore.v1.IStructuredQuery|null} [structuredQuery] StructuredAggregationQuery structuredQuery + * @property {Array.|null} [aggregations] StructuredAggregationQuery aggregations + */ + + /** + * Constructs a new StructuredAggregationQuery. + * @memberof google.firestore.v1 + * @classdesc Represents a StructuredAggregationQuery. + * @implements IStructuredAggregationQuery + * @constructor + * @param {google.firestore.v1.IStructuredAggregationQuery=} [properties] Properties to set + */ + function StructuredAggregationQuery(properties) { + this.aggregations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * StructuredAggregationQuery structuredQuery. + * @member {google.firestore.v1.IStructuredQuery|null|undefined} structuredQuery + * @memberof google.firestore.v1.StructuredAggregationQuery + * @instance + */ + StructuredAggregationQuery.prototype.structuredQuery = null; + + /** + * StructuredAggregationQuery aggregations. + * @member {Array.} aggregations + * @memberof google.firestore.v1.StructuredAggregationQuery + * @instance + */ + StructuredAggregationQuery.prototype.aggregations = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * StructuredAggregationQuery queryType. + * @member {"structuredQuery"|undefined} queryType + * @memberof google.firestore.v1.StructuredAggregationQuery + * @instance + */ + Object.defineProperty(StructuredAggregationQuery.prototype, "queryType", { + get: $util.oneOfGetter($oneOfFields = ["structuredQuery"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new StructuredAggregationQuery instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredAggregationQuery + * @static + * @param {google.firestore.v1.IStructuredAggregationQuery=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredAggregationQuery} StructuredAggregationQuery instance + */ + StructuredAggregationQuery.create = function create(properties) { + return new StructuredAggregationQuery(properties); + }; + + /** + * Encodes the specified StructuredAggregationQuery message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredAggregationQuery + * @static + * @param {google.firestore.v1.IStructuredAggregationQuery} message StructuredAggregationQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StructuredAggregationQuery.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) + $root.google.firestore.v1.StructuredQuery.encode(message.structuredQuery, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.aggregations != null && message.aggregations.length) + for (var i = 0; i < message.aggregations.length; ++i) + $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.encode(message.aggregations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified StructuredAggregationQuery message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery + * @static + * @param {google.firestore.v1.IStructuredAggregationQuery} message StructuredAggregationQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StructuredAggregationQuery.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a StructuredAggregationQuery message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredAggregationQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredAggregationQuery} StructuredAggregationQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StructuredAggregationQuery.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredAggregationQuery(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.structuredQuery = $root.google.firestore.v1.StructuredQuery.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + if (!(message.aggregations && message.aggregations.length)) + message.aggregations = []; + message.aggregations.push($root.google.firestore.v1.StructuredAggregationQuery.Aggregation.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a StructuredAggregationQuery message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredAggregationQuery} StructuredAggregationQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StructuredAggregationQuery.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StructuredAggregationQuery message. + * @function verify + * @memberof google.firestore.v1.StructuredAggregationQuery + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StructuredAggregationQuery.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + properties.queryType = 1; + { + var error = $root.google.firestore.v1.StructuredQuery.verify(message.structuredQuery, long + 1); + if (error) + return "structuredQuery." + error; + } + } + if (message.aggregations != null && Object.hasOwnProperty.call(message, "aggregations")) { + if (!Array.isArray(message.aggregations)) + return "aggregations: array expected"; + for (var i = 0; i < message.aggregations.length; ++i) { + var error = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.verify(message.aggregations[i], long + 1); + if (error) + return "aggregations." + error; + } + } + return null; + }; + + /** + * Creates a StructuredAggregationQuery message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredAggregationQuery + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredAggregationQuery} StructuredAggregationQuery + */ + StructuredAggregationQuery.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredAggregationQuery) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredAggregationQuery(); + if (object.structuredQuery != null) { + if (!$util.isObject(object.structuredQuery)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.structuredQuery: object expected"); + message.structuredQuery = $root.google.firestore.v1.StructuredQuery.fromObject(object.structuredQuery, long + 1); + } + if (object.aggregations) { + if (!Array.isArray(object.aggregations)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.aggregations: array expected"); + message.aggregations = []; + for (var i = 0; i < object.aggregations.length; ++i) { + if (!$util.isObject(object.aggregations[i])) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.aggregations: object expected"); + message.aggregations[i] = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.fromObject(object.aggregations[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a StructuredAggregationQuery message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredAggregationQuery + * @static + * @param {google.firestore.v1.StructuredAggregationQuery} message StructuredAggregationQuery + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StructuredAggregationQuery.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.aggregations = []; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + object.structuredQuery = $root.google.firestore.v1.StructuredQuery.toObject(message.structuredQuery, options, q + 1); + if (options.oneofs) + object.queryType = "structuredQuery"; + } + if (message.aggregations && message.aggregations.length) { + object.aggregations = []; + for (var j = 0; j < message.aggregations.length; ++j) + object.aggregations[j] = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.toObject(message.aggregations[j], options, q + 1); + } + return object; + }; + + /** + * Converts this StructuredAggregationQuery to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredAggregationQuery + * @instance + * @returns {Object.} JSON object + */ + StructuredAggregationQuery.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StructuredAggregationQuery + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredAggregationQuery + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StructuredAggregationQuery.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredAggregationQuery"; + }; + + StructuredAggregationQuery.Aggregation = (function() { + + /** + * Properties of an Aggregation. + * @memberof google.firestore.v1.StructuredAggregationQuery + * @interface IAggregation + * @property {google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount|null} [count] Aggregation count + * @property {google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum|null} [sum] Aggregation sum + * @property {google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg|null} [avg] Aggregation avg + * @property {string|null} [alias] Aggregation alias + */ + + /** + * Constructs a new Aggregation. + * @memberof google.firestore.v1.StructuredAggregationQuery + * @classdesc Represents an Aggregation. + * @implements IAggregation + * @constructor + * @param {google.firestore.v1.StructuredAggregationQuery.IAggregation=} [properties] Properties to set + */ + function Aggregation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Aggregation count. + * @member {google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount|null|undefined} count + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @instance + */ + Aggregation.prototype.count = null; + + /** + * Aggregation sum. + * @member {google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum|null|undefined} sum + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @instance + */ + Aggregation.prototype.sum = null; + + /** + * Aggregation avg. + * @member {google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg|null|undefined} avg + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @instance + */ + Aggregation.prototype.avg = null; + + /** + * Aggregation alias. + * @member {string} alias + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @instance + */ + Aggregation.prototype.alias = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Aggregation operator. + * @member {"count"|"sum"|"avg"|undefined} operator + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @instance + */ + Object.defineProperty(Aggregation.prototype, "operator", { + get: $util.oneOfGetter($oneOfFields = ["count", "sum", "avg"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Aggregation instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.IAggregation=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation} Aggregation instance + */ + Aggregation.create = function create(properties) { + return new Aggregation(properties); + }; + + /** + * Encodes the specified Aggregation message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.IAggregation} message Aggregation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Aggregation.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.encode(message.count, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.sum != null && Object.hasOwnProperty.call(message, "sum")) + $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.encode(message.sum, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.avg != null && Object.hasOwnProperty.call(message, "avg")) + $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.encode(message.avg, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.alias != null && Object.hasOwnProperty.call(message, "alias")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.alias); + return writer; + }; + + /** + * Encodes the specified Aggregation message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.IAggregation} message Aggregation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Aggregation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Aggregation message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation} Aggregation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Aggregation.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredAggregationQuery.Aggregation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.count = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.sum = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.avg = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.alias = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Aggregation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation} Aggregation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Aggregation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Aggregation message. + * @function verify + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Aggregation.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.count != null && Object.hasOwnProperty.call(message, "count")) { + properties.operator = 1; + { + var error = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.verify(message.count, long + 1); + if (error) + return "count." + error; + } + } + if (message.sum != null && Object.hasOwnProperty.call(message, "sum")) { + if (properties.operator === 1) + return "operator: multiple values"; + properties.operator = 1; + { + var error = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.verify(message.sum, long + 1); + if (error) + return "sum." + error; + } + } + if (message.avg != null && Object.hasOwnProperty.call(message, "avg")) { + if (properties.operator === 1) + return "operator: multiple values"; + properties.operator = 1; + { + var error = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.verify(message.avg, long + 1); + if (error) + return "avg." + error; + } + } + if (message.alias != null && Object.hasOwnProperty.call(message, "alias")) + if (!$util.isString(message.alias)) + return "alias: string expected"; + return null; + }; + + /** + * Creates an Aggregation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation} Aggregation + */ + Aggregation.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredAggregationQuery.Aggregation) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredAggregationQuery.Aggregation(); + if (object.count != null) { + if (!$util.isObject(object.count)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation.count: object expected"); + message.count = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.fromObject(object.count, long + 1); + } + if (object.sum != null) { + if (!$util.isObject(object.sum)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation.sum: object expected"); + message.sum = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.fromObject(object.sum, long + 1); + } + if (object.avg != null) { + if (!$util.isObject(object.avg)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation.avg: object expected"); + message.avg = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.fromObject(object.avg, long + 1); + } + if (object.alias != null) + message.alias = String(object.alias); + return message; + }; + + /** + * Creates a plain object from an Aggregation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation} message Aggregation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Aggregation.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.alias = ""; + if (message.count != null && Object.hasOwnProperty.call(message, "count")) { + object.count = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.toObject(message.count, options, q + 1); + if (options.oneofs) + object.operator = "count"; + } + if (message.sum != null && Object.hasOwnProperty.call(message, "sum")) { + object.sum = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.toObject(message.sum, options, q + 1); + if (options.oneofs) + object.operator = "sum"; + } + if (message.avg != null && Object.hasOwnProperty.call(message, "avg")) { + object.avg = $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.toObject(message.avg, options, q + 1); + if (options.oneofs) + object.operator = "avg"; + } + if (message.alias != null && Object.hasOwnProperty.call(message, "alias")) + object.alias = message.alias; + return object; + }; + + /** + * Converts this Aggregation to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @instance + * @returns {Object.} JSON object + */ + Aggregation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Aggregation + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Aggregation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredAggregationQuery.Aggregation"; + }; + + Aggregation.Count = (function() { + + /** + * Properties of a Count. + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @interface ICount + * @property {google.protobuf.IInt64Value|null} [upTo] Count upTo + */ + + /** + * Constructs a new Count. + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @classdesc Represents a Count. + * @implements ICount + * @constructor + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount=} [properties] Properties to set + */ + function Count(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Count upTo. + * @member {google.protobuf.IInt64Value|null|undefined} upTo + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @instance + */ + Count.prototype.upTo = null; + + /** + * Creates a new Count instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Count} Count instance + */ + Count.create = function create(properties) { + return new Count(properties); + }; + + /** + * Encodes the specified Count message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount} message Count message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Count.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.upTo != null && Object.hasOwnProperty.call(message, "upTo")) + $root.google.protobuf.Int64Value.encode(message.upTo, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Count message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.ICount} message Count message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Count.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Count message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Count} Count + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Count.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Count(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.upTo = $root.google.protobuf.Int64Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Count message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Count} Count + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Count.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Count message. + * @function verify + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Count.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.upTo != null && Object.hasOwnProperty.call(message, "upTo")) { + var error = $root.google.protobuf.Int64Value.verify(message.upTo, long + 1); + if (error) + return "upTo." + error; + } + return null; + }; + + /** + * Creates a Count message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Count} Count + */ + Count.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Count) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation.Count: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Count(); + if (object.upTo != null) { + if (!$util.isObject(object.upTo)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation.Count.upTo: object expected"); + message.upTo = $root.google.protobuf.Int64Value.fromObject(object.upTo, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Count message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.Count} message Count + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Count.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.upTo = null; + if (message.upTo != null && Object.hasOwnProperty.call(message, "upTo")) + object.upTo = $root.google.protobuf.Int64Value.toObject(message.upTo, options, q + 1); + return object; + }; + + /** + * Converts this Count to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @instance + * @returns {Object.} JSON object + */ + Count.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Count + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Count + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Count.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredAggregationQuery.Aggregation.Count"; + }; + + return Count; + })(); + + Aggregation.Sum = (function() { + + /** + * Properties of a Sum. + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @interface ISum + * @property {google.firestore.v1.StructuredQuery.IFieldReference|null} [field] Sum field + */ + + /** + * Constructs a new Sum. + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @classdesc Represents a Sum. + * @implements ISum + * @constructor + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum=} [properties] Properties to set + */ + function Sum(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Sum field. + * @member {google.firestore.v1.StructuredQuery.IFieldReference|null|undefined} field + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @instance + */ + Sum.prototype.field = null; + + /** + * Creates a new Sum instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum} Sum instance + */ + Sum.create = function create(properties) { + return new Sum(properties); + }; + + /** + * Encodes the specified Sum message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum} message Sum message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sum.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + $root.google.firestore.v1.StructuredQuery.FieldReference.encode(message.field, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Sum message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.ISum} message Sum message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sum.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Sum message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum} Sum + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sum.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Sum message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum} Sum + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sum.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Sum message. + * @function verify + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Sum.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + var error = $root.google.firestore.v1.StructuredQuery.FieldReference.verify(message.field, long + 1); + if (error) + return "field." + error; + } + return null; + }; + + /** + * Creates a Sum message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum} Sum + */ + Sum.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum(); + if (object.field != null) { + if (!$util.isObject(object.field)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum.field: object expected"); + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.fromObject(object.field, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Sum message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum} message Sum + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Sum.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.field = null; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + object.field = $root.google.firestore.v1.StructuredQuery.FieldReference.toObject(message.field, options, q + 1); + return object; + }; + + /** + * Converts this Sum to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @instance + * @returns {Object.} JSON object + */ + Sum.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Sum + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Sum.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredAggregationQuery.Aggregation.Sum"; + }; + + return Sum; + })(); + + Aggregation.Avg = (function() { + + /** + * Properties of an Avg. + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @interface IAvg + * @property {google.firestore.v1.StructuredQuery.IFieldReference|null} [field] Avg field + */ + + /** + * Constructs a new Avg. + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation + * @classdesc Represents an Avg. + * @implements IAvg + * @constructor + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg=} [properties] Properties to set + */ + function Avg(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Avg field. + * @member {google.firestore.v1.StructuredQuery.IFieldReference|null|undefined} field + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @instance + */ + Avg.prototype.field = null; + + /** + * Creates a new Avg instance using the specified properties. + * @function create + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg=} [properties] Properties to set + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg} Avg instance + */ + Avg.create = function create(properties) { + return new Avg(properties); + }; + + /** + * Encodes the specified Avg message. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg} message Avg message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Avg.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + $root.google.firestore.v1.StructuredQuery.FieldReference.encode(message.field, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Avg message, length delimited. Does not implicitly {@link google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.IAvg} message Avg message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Avg.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Avg message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg} Avg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Avg.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Avg message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg} Avg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Avg.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Avg message. + * @function verify + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Avg.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + var error = $root.google.firestore.v1.StructuredQuery.FieldReference.verify(message.field, long + 1); + if (error) + return "field." + error; + } + return null; + }; + + /** + * Creates an Avg message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg} Avg + */ + Avg.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg(); + if (object.field != null) { + if (!$util.isObject(object.field)) + throw TypeError(".google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg.field: object expected"); + message.field = $root.google.firestore.v1.StructuredQuery.FieldReference.fromObject(object.field, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an Avg message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @static + * @param {google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg} message Avg + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Avg.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.field = null; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + object.field = $root.google.firestore.v1.StructuredQuery.FieldReference.toObject(message.field, options, q + 1); + return object; + }; + + /** + * Converts this Avg to JSON. + * @function toJSON + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @instance + * @returns {Object.} JSON object + */ + Avg.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Avg + * @function getTypeUrl + * @memberof google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Avg.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg"; + }; + + return Avg; + })(); + + return Aggregation; + })(); + + return StructuredAggregationQuery; + })(); + + v1.Cursor = (function() { + + /** + * Properties of a Cursor. + * @memberof google.firestore.v1 + * @interface ICursor + * @property {Array.|null} [values] Cursor values + * @property {boolean|null} [before] Cursor before + */ + + /** + * Constructs a new Cursor. + * @memberof google.firestore.v1 + * @classdesc Represents a Cursor. + * @implements ICursor + * @constructor + * @param {google.firestore.v1.ICursor=} [properties] Properties to set + */ + function Cursor(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Cursor values. + * @member {Array.} values + * @memberof google.firestore.v1.Cursor + * @instance + */ + Cursor.prototype.values = $util.emptyArray; + + /** + * Cursor before. + * @member {boolean} before + * @memberof google.firestore.v1.Cursor + * @instance + */ + Cursor.prototype.before = false; + + /** + * Creates a new Cursor instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Cursor + * @static + * @param {google.firestore.v1.ICursor=} [properties] Properties to set + * @returns {google.firestore.v1.Cursor} Cursor instance + */ + Cursor.create = function create(properties) { + return new Cursor(properties); + }; + + /** + * Encodes the specified Cursor message. Does not implicitly {@link google.firestore.v1.Cursor.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Cursor + * @static + * @param {google.firestore.v1.ICursor} message Cursor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Cursor.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.firestore.v1.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.before != null && Object.hasOwnProperty.call(message, "before")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.before); + return writer; + }; + + /** + * Encodes the specified Cursor message, length delimited. Does not implicitly {@link google.firestore.v1.Cursor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Cursor + * @static + * @param {google.firestore.v1.ICursor} message Cursor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Cursor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Cursor message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Cursor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Cursor} Cursor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Cursor.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Cursor(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.before = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Cursor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Cursor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Cursor} Cursor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Cursor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Cursor message. + * @function verify + * @memberof google.firestore.v1.Cursor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Cursor.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.values != null && Object.hasOwnProperty.call(message, "values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.values[i], long + 1); + if (error) + return "values." + error; + } + } + if (message.before != null && Object.hasOwnProperty.call(message, "before")) + if (typeof message.before !== "boolean") + return "before: boolean expected"; + return null; + }; + + /** + * Creates a Cursor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Cursor + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Cursor} Cursor + */ + Cursor.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Cursor) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Cursor: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Cursor(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.firestore.v1.Cursor.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (!$util.isObject(object.values[i])) + throw TypeError(".google.firestore.v1.Cursor.values: object expected"); + message.values[i] = $root.google.firestore.v1.Value.fromObject(object.values[i], long + 1); + } + } + if (object.before != null) + message.before = Boolean(object.before); + return message; + }; + + /** + * Creates a plain object from a Cursor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Cursor + * @static + * @param {google.firestore.v1.Cursor} message Cursor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Cursor.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) + object.before = false; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.firestore.v1.Value.toObject(message.values[j], options, q + 1); + } + if (message.before != null && Object.hasOwnProperty.call(message, "before")) + object.before = message.before; + return object; + }; + + /** + * Converts this Cursor to JSON. + * @function toJSON + * @memberof google.firestore.v1.Cursor + * @instance + * @returns {Object.} JSON object + */ + Cursor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Cursor + * @function getTypeUrl + * @memberof google.firestore.v1.Cursor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Cursor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Cursor"; + }; + + return Cursor; + })(); + + v1.ExplainOptions = (function() { + + /** + * Properties of an ExplainOptions. + * @memberof google.firestore.v1 + * @interface IExplainOptions + * @property {boolean|null} [analyze] ExplainOptions analyze + */ + + /** + * Constructs a new ExplainOptions. + * @memberof google.firestore.v1 + * @classdesc Represents an ExplainOptions. + * @implements IExplainOptions + * @constructor + * @param {google.firestore.v1.IExplainOptions=} [properties] Properties to set + */ + function ExplainOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExplainOptions analyze. + * @member {boolean} analyze + * @memberof google.firestore.v1.ExplainOptions + * @instance + */ + ExplainOptions.prototype.analyze = false; + + /** + * Creates a new ExplainOptions instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ExplainOptions + * @static + * @param {google.firestore.v1.IExplainOptions=} [properties] Properties to set + * @returns {google.firestore.v1.ExplainOptions} ExplainOptions instance + */ + ExplainOptions.create = function create(properties) { + return new ExplainOptions(properties); + }; + + /** + * Encodes the specified ExplainOptions message. Does not implicitly {@link google.firestore.v1.ExplainOptions.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ExplainOptions + * @static + * @param {google.firestore.v1.IExplainOptions} message ExplainOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExplainOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.analyze != null && Object.hasOwnProperty.call(message, "analyze")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.analyze); + return writer; + }; + + /** + * Encodes the specified ExplainOptions message, length delimited. Does not implicitly {@link google.firestore.v1.ExplainOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ExplainOptions + * @static + * @param {google.firestore.v1.IExplainOptions} message ExplainOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExplainOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExplainOptions message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ExplainOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ExplainOptions} ExplainOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExplainOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ExplainOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.analyze = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExplainOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ExplainOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ExplainOptions} ExplainOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExplainOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExplainOptions message. + * @function verify + * @memberof google.firestore.v1.ExplainOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExplainOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.analyze != null && Object.hasOwnProperty.call(message, "analyze")) + if (typeof message.analyze !== "boolean") + return "analyze: boolean expected"; + return null; + }; + + /** + * Creates an ExplainOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ExplainOptions + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ExplainOptions} ExplainOptions + */ + ExplainOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ExplainOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ExplainOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ExplainOptions(); + if (object.analyze != null) + message.analyze = Boolean(object.analyze); + return message; + }; + + /** + * Creates a plain object from an ExplainOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ExplainOptions + * @static + * @param {google.firestore.v1.ExplainOptions} message ExplainOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExplainOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.analyze = false; + if (message.analyze != null && Object.hasOwnProperty.call(message, "analyze")) + object.analyze = message.analyze; + return object; + }; + + /** + * Converts this ExplainOptions to JSON. + * @function toJSON + * @memberof google.firestore.v1.ExplainOptions + * @instance + * @returns {Object.} JSON object + */ + ExplainOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExplainOptions + * @function getTypeUrl + * @memberof google.firestore.v1.ExplainOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExplainOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ExplainOptions"; + }; + + return ExplainOptions; + })(); + + v1.ExplainMetrics = (function() { + + /** + * Properties of an ExplainMetrics. + * @memberof google.firestore.v1 + * @interface IExplainMetrics + * @property {google.firestore.v1.IPlanSummary|null} [planSummary] ExplainMetrics planSummary + * @property {google.firestore.v1.IExecutionStats|null} [executionStats] ExplainMetrics executionStats + */ + + /** + * Constructs a new ExplainMetrics. + * @memberof google.firestore.v1 + * @classdesc Represents an ExplainMetrics. + * @implements IExplainMetrics + * @constructor + * @param {google.firestore.v1.IExplainMetrics=} [properties] Properties to set + */ + function ExplainMetrics(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExplainMetrics planSummary. + * @member {google.firestore.v1.IPlanSummary|null|undefined} planSummary + * @memberof google.firestore.v1.ExplainMetrics + * @instance + */ + ExplainMetrics.prototype.planSummary = null; + + /** + * ExplainMetrics executionStats. + * @member {google.firestore.v1.IExecutionStats|null|undefined} executionStats + * @memberof google.firestore.v1.ExplainMetrics + * @instance + */ + ExplainMetrics.prototype.executionStats = null; + + /** + * Creates a new ExplainMetrics instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ExplainMetrics + * @static + * @param {google.firestore.v1.IExplainMetrics=} [properties] Properties to set + * @returns {google.firestore.v1.ExplainMetrics} ExplainMetrics instance + */ + ExplainMetrics.create = function create(properties) { + return new ExplainMetrics(properties); + }; + + /** + * Encodes the specified ExplainMetrics message. Does not implicitly {@link google.firestore.v1.ExplainMetrics.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ExplainMetrics + * @static + * @param {google.firestore.v1.IExplainMetrics} message ExplainMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExplainMetrics.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.planSummary != null && Object.hasOwnProperty.call(message, "planSummary")) + $root.google.firestore.v1.PlanSummary.encode(message.planSummary, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.executionStats != null && Object.hasOwnProperty.call(message, "executionStats")) + $root.google.firestore.v1.ExecutionStats.encode(message.executionStats, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExplainMetrics message, length delimited. Does not implicitly {@link google.firestore.v1.ExplainMetrics.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ExplainMetrics + * @static + * @param {google.firestore.v1.IExplainMetrics} message ExplainMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExplainMetrics.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExplainMetrics message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ExplainMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ExplainMetrics} ExplainMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExplainMetrics.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ExplainMetrics(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.planSummary = $root.google.firestore.v1.PlanSummary.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.executionStats = $root.google.firestore.v1.ExecutionStats.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExplainMetrics message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ExplainMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ExplainMetrics} ExplainMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExplainMetrics.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExplainMetrics message. + * @function verify + * @memberof google.firestore.v1.ExplainMetrics + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExplainMetrics.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.planSummary != null && Object.hasOwnProperty.call(message, "planSummary")) { + var error = $root.google.firestore.v1.PlanSummary.verify(message.planSummary, long + 1); + if (error) + return "planSummary." + error; + } + if (message.executionStats != null && Object.hasOwnProperty.call(message, "executionStats")) { + var error = $root.google.firestore.v1.ExecutionStats.verify(message.executionStats, long + 1); + if (error) + return "executionStats." + error; + } + return null; + }; + + /** + * Creates an ExplainMetrics message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ExplainMetrics + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ExplainMetrics} ExplainMetrics + */ + ExplainMetrics.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ExplainMetrics) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ExplainMetrics: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ExplainMetrics(); + if (object.planSummary != null) { + if (!$util.isObject(object.planSummary)) + throw TypeError(".google.firestore.v1.ExplainMetrics.planSummary: object expected"); + message.planSummary = $root.google.firestore.v1.PlanSummary.fromObject(object.planSummary, long + 1); + } + if (object.executionStats != null) { + if (!$util.isObject(object.executionStats)) + throw TypeError(".google.firestore.v1.ExplainMetrics.executionStats: object expected"); + message.executionStats = $root.google.firestore.v1.ExecutionStats.fromObject(object.executionStats, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an ExplainMetrics message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ExplainMetrics + * @static + * @param {google.firestore.v1.ExplainMetrics} message ExplainMetrics + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExplainMetrics.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.planSummary = null; + object.executionStats = null; + } + if (message.planSummary != null && Object.hasOwnProperty.call(message, "planSummary")) + object.planSummary = $root.google.firestore.v1.PlanSummary.toObject(message.planSummary, options, q + 1); + if (message.executionStats != null && Object.hasOwnProperty.call(message, "executionStats")) + object.executionStats = $root.google.firestore.v1.ExecutionStats.toObject(message.executionStats, options, q + 1); + return object; + }; + + /** + * Converts this ExplainMetrics to JSON. + * @function toJSON + * @memberof google.firestore.v1.ExplainMetrics + * @instance + * @returns {Object.} JSON object + */ + ExplainMetrics.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExplainMetrics + * @function getTypeUrl + * @memberof google.firestore.v1.ExplainMetrics + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExplainMetrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ExplainMetrics"; + }; + + return ExplainMetrics; + })(); + + v1.PlanSummary = (function() { + + /** + * Properties of a PlanSummary. + * @memberof google.firestore.v1 + * @interface IPlanSummary + * @property {Array.|null} [indexesUsed] PlanSummary indexesUsed + */ + + /** + * Constructs a new PlanSummary. + * @memberof google.firestore.v1 + * @classdesc Represents a PlanSummary. + * @implements IPlanSummary + * @constructor + * @param {google.firestore.v1.IPlanSummary=} [properties] Properties to set + */ + function PlanSummary(properties) { + this.indexesUsed = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * PlanSummary indexesUsed. + * @member {Array.} indexesUsed + * @memberof google.firestore.v1.PlanSummary + * @instance + */ + PlanSummary.prototype.indexesUsed = $util.emptyArray; + + /** + * Creates a new PlanSummary instance using the specified properties. + * @function create + * @memberof google.firestore.v1.PlanSummary + * @static + * @param {google.firestore.v1.IPlanSummary=} [properties] Properties to set + * @returns {google.firestore.v1.PlanSummary} PlanSummary instance + */ + PlanSummary.create = function create(properties) { + return new PlanSummary(properties); + }; + + /** + * Encodes the specified PlanSummary message. Does not implicitly {@link google.firestore.v1.PlanSummary.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.PlanSummary + * @static + * @param {google.firestore.v1.IPlanSummary} message PlanSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PlanSummary.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.indexesUsed != null && message.indexesUsed.length) + for (var i = 0; i < message.indexesUsed.length; ++i) + $root.google.protobuf.Struct.encode(message.indexesUsed[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified PlanSummary message, length delimited. Does not implicitly {@link google.firestore.v1.PlanSummary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.PlanSummary + * @static + * @param {google.firestore.v1.IPlanSummary} message PlanSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PlanSummary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a PlanSummary message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.PlanSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.PlanSummary} PlanSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PlanSummary.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.PlanSummary(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.indexesUsed && message.indexesUsed.length)) + message.indexesUsed = []; + message.indexesUsed.push($root.google.protobuf.Struct.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a PlanSummary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.PlanSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.PlanSummary} PlanSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PlanSummary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PlanSummary message. + * @function verify + * @memberof google.firestore.v1.PlanSummary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PlanSummary.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.indexesUsed != null && Object.hasOwnProperty.call(message, "indexesUsed")) { + if (!Array.isArray(message.indexesUsed)) + return "indexesUsed: array expected"; + for (var i = 0; i < message.indexesUsed.length; ++i) { + var error = $root.google.protobuf.Struct.verify(message.indexesUsed[i], long + 1); + if (error) + return "indexesUsed." + error; + } + } + return null; + }; + + /** + * Creates a PlanSummary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.PlanSummary + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.PlanSummary} PlanSummary + */ + PlanSummary.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.PlanSummary) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.PlanSummary: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.PlanSummary(); + if (object.indexesUsed) { + if (!Array.isArray(object.indexesUsed)) + throw TypeError(".google.firestore.v1.PlanSummary.indexesUsed: array expected"); + message.indexesUsed = []; + for (var i = 0; i < object.indexesUsed.length; ++i) { + if (!$util.isObject(object.indexesUsed[i])) + throw TypeError(".google.firestore.v1.PlanSummary.indexesUsed: object expected"); + message.indexesUsed[i] = $root.google.protobuf.Struct.fromObject(object.indexesUsed[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a PlanSummary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.PlanSummary + * @static + * @param {google.firestore.v1.PlanSummary} message PlanSummary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PlanSummary.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.indexesUsed = []; + if (message.indexesUsed && message.indexesUsed.length) { + object.indexesUsed = []; + for (var j = 0; j < message.indexesUsed.length; ++j) + object.indexesUsed[j] = $root.google.protobuf.Struct.toObject(message.indexesUsed[j], options, q + 1); + } + return object; + }; + + /** + * Converts this PlanSummary to JSON. + * @function toJSON + * @memberof google.firestore.v1.PlanSummary + * @instance + * @returns {Object.} JSON object + */ + PlanSummary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PlanSummary + * @function getTypeUrl + * @memberof google.firestore.v1.PlanSummary + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PlanSummary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.PlanSummary"; + }; + + return PlanSummary; + })(); + + v1.ExecutionStats = (function() { + + /** + * Properties of an ExecutionStats. + * @memberof google.firestore.v1 + * @interface IExecutionStats + * @property {number|Long|null} [resultsReturned] ExecutionStats resultsReturned + * @property {google.protobuf.IDuration|null} [executionDuration] ExecutionStats executionDuration + * @property {number|Long|null} [readOperations] ExecutionStats readOperations + * @property {google.protobuf.IStruct|null} [debugStats] ExecutionStats debugStats + */ + + /** + * Constructs a new ExecutionStats. + * @memberof google.firestore.v1 + * @classdesc Represents an ExecutionStats. + * @implements IExecutionStats + * @constructor + * @param {google.firestore.v1.IExecutionStats=} [properties] Properties to set + */ + function ExecutionStats(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExecutionStats resultsReturned. + * @member {number|Long} resultsReturned + * @memberof google.firestore.v1.ExecutionStats + * @instance + */ + ExecutionStats.prototype.resultsReturned = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ExecutionStats executionDuration. + * @member {google.protobuf.IDuration|null|undefined} executionDuration + * @memberof google.firestore.v1.ExecutionStats + * @instance + */ + ExecutionStats.prototype.executionDuration = null; + + /** + * ExecutionStats readOperations. + * @member {number|Long} readOperations + * @memberof google.firestore.v1.ExecutionStats + * @instance + */ + ExecutionStats.prototype.readOperations = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ExecutionStats debugStats. + * @member {google.protobuf.IStruct|null|undefined} debugStats + * @memberof google.firestore.v1.ExecutionStats + * @instance + */ + ExecutionStats.prototype.debugStats = null; + + /** + * Creates a new ExecutionStats instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ExecutionStats + * @static + * @param {google.firestore.v1.IExecutionStats=} [properties] Properties to set + * @returns {google.firestore.v1.ExecutionStats} ExecutionStats instance + */ + ExecutionStats.create = function create(properties) { + return new ExecutionStats(properties); + }; + + /** + * Encodes the specified ExecutionStats message. Does not implicitly {@link google.firestore.v1.ExecutionStats.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ExecutionStats + * @static + * @param {google.firestore.v1.IExecutionStats} message ExecutionStats message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecutionStats.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.resultsReturned != null && Object.hasOwnProperty.call(message, "resultsReturned")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.resultsReturned); + if (message.executionDuration != null && Object.hasOwnProperty.call(message, "executionDuration")) + $root.google.protobuf.Duration.encode(message.executionDuration, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.readOperations != null && Object.hasOwnProperty.call(message, "readOperations")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.readOperations); + if (message.debugStats != null && Object.hasOwnProperty.call(message, "debugStats")) + $root.google.protobuf.Struct.encode(message.debugStats, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExecutionStats message, length delimited. Does not implicitly {@link google.firestore.v1.ExecutionStats.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ExecutionStats + * @static + * @param {google.firestore.v1.IExecutionStats} message ExecutionStats message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecutionStats.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExecutionStats message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ExecutionStats + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ExecutionStats} ExecutionStats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecutionStats.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ExecutionStats(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.resultsReturned = reader.int64(); + break; + } + case 3: { + message.executionDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.readOperations = reader.int64(); + break; + } + case 5: { + message.debugStats = $root.google.protobuf.Struct.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExecutionStats message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ExecutionStats + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ExecutionStats} ExecutionStats + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecutionStats.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExecutionStats message. + * @function verify + * @memberof google.firestore.v1.ExecutionStats + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExecutionStats.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.resultsReturned != null && Object.hasOwnProperty.call(message, "resultsReturned")) + if (!$util.isInteger(message.resultsReturned) && !(message.resultsReturned && $util.isInteger(message.resultsReturned.low) && $util.isInteger(message.resultsReturned.high))) + return "resultsReturned: integer|Long expected"; + if (message.executionDuration != null && Object.hasOwnProperty.call(message, "executionDuration")) { + var error = $root.google.protobuf.Duration.verify(message.executionDuration, long + 1); + if (error) + return "executionDuration." + error; + } + if (message.readOperations != null && Object.hasOwnProperty.call(message, "readOperations")) + if (!$util.isInteger(message.readOperations) && !(message.readOperations && $util.isInteger(message.readOperations.low) && $util.isInteger(message.readOperations.high))) + return "readOperations: integer|Long expected"; + if (message.debugStats != null && Object.hasOwnProperty.call(message, "debugStats")) { + var error = $root.google.protobuf.Struct.verify(message.debugStats, long + 1); + if (error) + return "debugStats." + error; + } + return null; + }; + + /** + * Creates an ExecutionStats message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ExecutionStats + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ExecutionStats} ExecutionStats + */ + ExecutionStats.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ExecutionStats) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ExecutionStats: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ExecutionStats(); + if (object.resultsReturned != null) + if ($util.Long) + message.resultsReturned = $util.Long.fromValue(object.resultsReturned, false); + else if (typeof object.resultsReturned === "string") + message.resultsReturned = parseInt(object.resultsReturned, 10); + else if (typeof object.resultsReturned === "number") + message.resultsReturned = object.resultsReturned; + else if (typeof object.resultsReturned === "object") + message.resultsReturned = new $util.LongBits(object.resultsReturned.low >>> 0, object.resultsReturned.high >>> 0).toNumber(); + if (object.executionDuration != null) { + if (!$util.isObject(object.executionDuration)) + throw TypeError(".google.firestore.v1.ExecutionStats.executionDuration: object expected"); + message.executionDuration = $root.google.protobuf.Duration.fromObject(object.executionDuration, long + 1); + } + if (object.readOperations != null) + if ($util.Long) + message.readOperations = $util.Long.fromValue(object.readOperations, false); + else if (typeof object.readOperations === "string") + message.readOperations = parseInt(object.readOperations, 10); + else if (typeof object.readOperations === "number") + message.readOperations = object.readOperations; + else if (typeof object.readOperations === "object") + message.readOperations = new $util.LongBits(object.readOperations.low >>> 0, object.readOperations.high >>> 0).toNumber(); + if (object.debugStats != null) { + if (!$util.isObject(object.debugStats)) + throw TypeError(".google.firestore.v1.ExecutionStats.debugStats: object expected"); + message.debugStats = $root.google.protobuf.Struct.fromObject(object.debugStats, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an ExecutionStats message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ExecutionStats + * @static + * @param {google.firestore.v1.ExecutionStats} message ExecutionStats + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExecutionStats.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.resultsReturned = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.resultsReturned = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + object.executionDuration = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.readOperations = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.readOperations = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + object.debugStats = null; + } + if (message.resultsReturned != null && Object.hasOwnProperty.call(message, "resultsReturned")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.resultsReturned = typeof message.resultsReturned === "number" ? BigInt(message.resultsReturned) : $util.Long.fromBits(message.resultsReturned.low >>> 0, message.resultsReturned.high >>> 0, false).toBigInt(); + else if (typeof message.resultsReturned === "number") + object.resultsReturned = options.longs === String ? String(message.resultsReturned) : message.resultsReturned; + else + object.resultsReturned = options.longs === String ? $util.Long.prototype.toString.call(message.resultsReturned) : options.longs === Number ? new $util.LongBits(message.resultsReturned.low >>> 0, message.resultsReturned.high >>> 0).toNumber() : message.resultsReturned; + if (message.executionDuration != null && Object.hasOwnProperty.call(message, "executionDuration")) + object.executionDuration = $root.google.protobuf.Duration.toObject(message.executionDuration, options, q + 1); + if (message.readOperations != null && Object.hasOwnProperty.call(message, "readOperations")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.readOperations = typeof message.readOperations === "number" ? BigInt(message.readOperations) : $util.Long.fromBits(message.readOperations.low >>> 0, message.readOperations.high >>> 0, false).toBigInt(); + else if (typeof message.readOperations === "number") + object.readOperations = options.longs === String ? String(message.readOperations) : message.readOperations; + else + object.readOperations = options.longs === String ? $util.Long.prototype.toString.call(message.readOperations) : options.longs === Number ? new $util.LongBits(message.readOperations.low >>> 0, message.readOperations.high >>> 0).toNumber() : message.readOperations; + if (message.debugStats != null && Object.hasOwnProperty.call(message, "debugStats")) + object.debugStats = $root.google.protobuf.Struct.toObject(message.debugStats, options, q + 1); + return object; + }; + + /** + * Converts this ExecutionStats to JSON. + * @function toJSON + * @memberof google.firestore.v1.ExecutionStats + * @instance + * @returns {Object.} JSON object + */ + ExecutionStats.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExecutionStats + * @function getTypeUrl + * @memberof google.firestore.v1.ExecutionStats + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExecutionStats.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ExecutionStats"; + }; + + return ExecutionStats; + })(); + + v1.Write = (function() { + + /** + * Properties of a Write. + * @memberof google.firestore.v1 + * @interface IWrite + * @property {google.firestore.v1.IDocument|null} [update] Write update + * @property {string|null} ["delete"] Write delete + * @property {google.firestore.v1.IDocumentTransform|null} [transform] Write transform + * @property {google.firestore.v1.IDocumentMask|null} [updateMask] Write updateMask + * @property {Array.|null} [updateTransforms] Write updateTransforms + * @property {google.firestore.v1.IPrecondition|null} [currentDocument] Write currentDocument + */ + + /** + * Constructs a new Write. + * @memberof google.firestore.v1 + * @classdesc Represents a Write. + * @implements IWrite + * @constructor + * @param {google.firestore.v1.IWrite=} [properties] Properties to set + */ + function Write(properties) { + this.updateTransforms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Write update. + * @member {google.firestore.v1.IDocument|null|undefined} update + * @memberof google.firestore.v1.Write + * @instance + */ + Write.prototype.update = null; + + /** + * Write delete. + * @member {string|null|undefined} delete + * @memberof google.firestore.v1.Write + * @instance + */ + Write.prototype["delete"] = null; + + /** + * Write transform. + * @member {google.firestore.v1.IDocumentTransform|null|undefined} transform + * @memberof google.firestore.v1.Write + * @instance + */ + Write.prototype.transform = null; + + /** + * Write updateMask. + * @member {google.firestore.v1.IDocumentMask|null|undefined} updateMask + * @memberof google.firestore.v1.Write + * @instance + */ + Write.prototype.updateMask = null; + + /** + * Write updateTransforms. + * @member {Array.} updateTransforms + * @memberof google.firestore.v1.Write + * @instance + */ + Write.prototype.updateTransforms = $util.emptyArray; + + /** + * Write currentDocument. + * @member {google.firestore.v1.IPrecondition|null|undefined} currentDocument + * @memberof google.firestore.v1.Write + * @instance + */ + Write.prototype.currentDocument = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Write operation. + * @member {"update"|"delete"|"transform"|undefined} operation + * @memberof google.firestore.v1.Write + * @instance + */ + Object.defineProperty(Write.prototype, "operation", { + get: $util.oneOfGetter($oneOfFields = ["update", "delete", "transform"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Write instance using the specified properties. + * @function create + * @memberof google.firestore.v1.Write + * @static + * @param {google.firestore.v1.IWrite=} [properties] Properties to set + * @returns {google.firestore.v1.Write} Write instance + */ + Write.create = function create(properties) { + return new Write(properties); + }; + + /** + * Encodes the specified Write message. Does not implicitly {@link google.firestore.v1.Write.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.Write + * @static + * @param {google.firestore.v1.IWrite} message Write message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Write.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.update != null && Object.hasOwnProperty.call(message, "update")) + $root.google.firestore.v1.Document.encode(message.update, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["delete"]); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.firestore.v1.DocumentMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + $root.google.firestore.v1.Precondition.encode(message.currentDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.transform != null && Object.hasOwnProperty.call(message, "transform")) + $root.google.firestore.v1.DocumentTransform.encode(message.transform, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.updateTransforms != null && message.updateTransforms.length) + for (var i = 0; i < message.updateTransforms.length; ++i) + $root.google.firestore.v1.DocumentTransform.FieldTransform.encode(message.updateTransforms[i], writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Write message, length delimited. Does not implicitly {@link google.firestore.v1.Write.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.Write + * @static + * @param {google.firestore.v1.IWrite} message Write message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Write.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Write message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.Write + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.Write} Write + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Write.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.Write(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.update = $root.google.firestore.v1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.transform = $root.google.firestore.v1.DocumentTransform.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.updateMask = $root.google.firestore.v1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + if (!(message.updateTransforms && message.updateTransforms.length)) + message.updateTransforms = []; + message.updateTransforms.push($root.google.firestore.v1.DocumentTransform.FieldTransform.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 4: { + message.currentDocument = $root.google.firestore.v1.Precondition.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Write message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.Write + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.Write} Write + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Write.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Write message. + * @function verify + * @memberof google.firestore.v1.Write + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Write.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.update != null && Object.hasOwnProperty.call(message, "update")) { + properties.operation = 1; + { + var error = $root.google.firestore.v1.Document.verify(message.update, long + 1); + if (error) + return "update." + error; + } + } + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) { + if (properties.operation === 1) + return "operation: multiple values"; + properties.operation = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.transform != null && Object.hasOwnProperty.call(message, "transform")) { + if (properties.operation === 1) + return "operation: multiple values"; + properties.operation = 1; + { + var error = $root.google.firestore.v1.DocumentTransform.verify(message.transform, long + 1); + if (error) + return "transform." + error; + } + } + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { + var error = $root.google.firestore.v1.DocumentMask.verify(message.updateMask, long + 1); + if (error) + return "updateMask." + error; + } + if (message.updateTransforms != null && Object.hasOwnProperty.call(message, "updateTransforms")) { + if (!Array.isArray(message.updateTransforms)) + return "updateTransforms: array expected"; + for (var i = 0; i < message.updateTransforms.length; ++i) { + var error = $root.google.firestore.v1.DocumentTransform.FieldTransform.verify(message.updateTransforms[i], long + 1); + if (error) + return "updateTransforms." + error; + } + } + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) { + var error = $root.google.firestore.v1.Precondition.verify(message.currentDocument, long + 1); + if (error) + return "currentDocument." + error; + } + return null; + }; + + /** + * Creates a Write message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.Write + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.Write} Write + */ + Write.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.Write) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.Write: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.Write(); + if (object.update != null) { + if (!$util.isObject(object.update)) + throw TypeError(".google.firestore.v1.Write.update: object expected"); + message.update = $root.google.firestore.v1.Document.fromObject(object.update, long + 1); + } + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.transform != null) { + if (!$util.isObject(object.transform)) + throw TypeError(".google.firestore.v1.Write.transform: object expected"); + message.transform = $root.google.firestore.v1.DocumentTransform.fromObject(object.transform, long + 1); + } + if (object.updateMask != null) { + if (!$util.isObject(object.updateMask)) + throw TypeError(".google.firestore.v1.Write.updateMask: object expected"); + message.updateMask = $root.google.firestore.v1.DocumentMask.fromObject(object.updateMask, long + 1); + } + if (object.updateTransforms) { + if (!Array.isArray(object.updateTransforms)) + throw TypeError(".google.firestore.v1.Write.updateTransforms: array expected"); + message.updateTransforms = []; + for (var i = 0; i < object.updateTransforms.length; ++i) { + if (!$util.isObject(object.updateTransforms[i])) + throw TypeError(".google.firestore.v1.Write.updateTransforms: object expected"); + message.updateTransforms[i] = $root.google.firestore.v1.DocumentTransform.FieldTransform.fromObject(object.updateTransforms[i], long + 1); + } + } + if (object.currentDocument != null) { + if (!$util.isObject(object.currentDocument)) + throw TypeError(".google.firestore.v1.Write.currentDocument: object expected"); + message.currentDocument = $root.google.firestore.v1.Precondition.fromObject(object.currentDocument, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Write message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.Write + * @static + * @param {google.firestore.v1.Write} message Write + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Write.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.updateTransforms = []; + if (options.defaults) { + object.updateMask = null; + object.currentDocument = null; + } + if (message.update != null && Object.hasOwnProperty.call(message, "update")) { + object.update = $root.google.firestore.v1.Document.toObject(message.update, options, q + 1); + if (options.oneofs) + object.operation = "update"; + } + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.operation = "delete"; + } + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.firestore.v1.DocumentMask.toObject(message.updateMask, options, q + 1); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + object.currentDocument = $root.google.firestore.v1.Precondition.toObject(message.currentDocument, options, q + 1); + if (message.transform != null && Object.hasOwnProperty.call(message, "transform")) { + object.transform = $root.google.firestore.v1.DocumentTransform.toObject(message.transform, options, q + 1); + if (options.oneofs) + object.operation = "transform"; + } + if (message.updateTransforms && message.updateTransforms.length) { + object.updateTransforms = []; + for (var j = 0; j < message.updateTransforms.length; ++j) + object.updateTransforms[j] = $root.google.firestore.v1.DocumentTransform.FieldTransform.toObject(message.updateTransforms[j], options, q + 1); + } + return object; + }; + + /** + * Converts this Write to JSON. + * @function toJSON + * @memberof google.firestore.v1.Write + * @instance + * @returns {Object.} JSON object + */ + Write.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Write + * @function getTypeUrl + * @memberof google.firestore.v1.Write + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Write.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.Write"; + }; + + return Write; + })(); + + v1.DocumentTransform = (function() { + + /** + * Properties of a DocumentTransform. + * @memberof google.firestore.v1 + * @interface IDocumentTransform + * @property {string|null} [document] DocumentTransform document + * @property {Array.|null} [fieldTransforms] DocumentTransform fieldTransforms + */ + + /** + * Constructs a new DocumentTransform. + * @memberof google.firestore.v1 + * @classdesc Represents a DocumentTransform. + * @implements IDocumentTransform + * @constructor + * @param {google.firestore.v1.IDocumentTransform=} [properties] Properties to set + */ + function DocumentTransform(properties) { + this.fieldTransforms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentTransform document. + * @member {string} document + * @memberof google.firestore.v1.DocumentTransform + * @instance + */ + DocumentTransform.prototype.document = ""; + + /** + * DocumentTransform fieldTransforms. + * @member {Array.} fieldTransforms + * @memberof google.firestore.v1.DocumentTransform + * @instance + */ + DocumentTransform.prototype.fieldTransforms = $util.emptyArray; + + /** + * Creates a new DocumentTransform instance using the specified properties. + * @function create + * @memberof google.firestore.v1.DocumentTransform + * @static + * @param {google.firestore.v1.IDocumentTransform=} [properties] Properties to set + * @returns {google.firestore.v1.DocumentTransform} DocumentTransform instance + */ + DocumentTransform.create = function create(properties) { + return new DocumentTransform(properties); + }; + + /** + * Encodes the specified DocumentTransform message. Does not implicitly {@link google.firestore.v1.DocumentTransform.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.DocumentTransform + * @static + * @param {google.firestore.v1.IDocumentTransform} message DocumentTransform message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentTransform.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.document); + if (message.fieldTransforms != null && message.fieldTransforms.length) + for (var i = 0; i < message.fieldTransforms.length; ++i) + $root.google.firestore.v1.DocumentTransform.FieldTransform.encode(message.fieldTransforms[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentTransform message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentTransform.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.DocumentTransform + * @static + * @param {google.firestore.v1.IDocumentTransform} message DocumentTransform message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentTransform.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentTransform message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.DocumentTransform + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.DocumentTransform} DocumentTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentTransform.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.DocumentTransform(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = reader.string(); + break; + } + case 2: { + if (!(message.fieldTransforms && message.fieldTransforms.length)) + message.fieldTransforms = []; + message.fieldTransforms.push($root.google.firestore.v1.DocumentTransform.FieldTransform.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentTransform message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.DocumentTransform + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.DocumentTransform} DocumentTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentTransform.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentTransform message. + * @function verify + * @memberof google.firestore.v1.DocumentTransform + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentTransform.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + if (!$util.isString(message.document)) + return "document: string expected"; + if (message.fieldTransforms != null && Object.hasOwnProperty.call(message, "fieldTransforms")) { + if (!Array.isArray(message.fieldTransforms)) + return "fieldTransforms: array expected"; + for (var i = 0; i < message.fieldTransforms.length; ++i) { + var error = $root.google.firestore.v1.DocumentTransform.FieldTransform.verify(message.fieldTransforms[i], long + 1); + if (error) + return "fieldTransforms." + error; + } + } + return null; + }; + + /** + * Creates a DocumentTransform message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.DocumentTransform + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.DocumentTransform} DocumentTransform + */ + DocumentTransform.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.DocumentTransform) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.DocumentTransform: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.DocumentTransform(); + if (object.document != null) + message.document = String(object.document); + if (object.fieldTransforms) { + if (!Array.isArray(object.fieldTransforms)) + throw TypeError(".google.firestore.v1.DocumentTransform.fieldTransforms: array expected"); + message.fieldTransforms = []; + for (var i = 0; i < object.fieldTransforms.length; ++i) { + if (!$util.isObject(object.fieldTransforms[i])) + throw TypeError(".google.firestore.v1.DocumentTransform.fieldTransforms: object expected"); + message.fieldTransforms[i] = $root.google.firestore.v1.DocumentTransform.FieldTransform.fromObject(object.fieldTransforms[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a DocumentTransform message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.DocumentTransform + * @static + * @param {google.firestore.v1.DocumentTransform} message DocumentTransform + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentTransform.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.fieldTransforms = []; + if (options.defaults) + object.document = ""; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = message.document; + if (message.fieldTransforms && message.fieldTransforms.length) { + object.fieldTransforms = []; + for (var j = 0; j < message.fieldTransforms.length; ++j) + object.fieldTransforms[j] = $root.google.firestore.v1.DocumentTransform.FieldTransform.toObject(message.fieldTransforms[j], options, q + 1); + } + return object; + }; + + /** + * Converts this DocumentTransform to JSON. + * @function toJSON + * @memberof google.firestore.v1.DocumentTransform + * @instance + * @returns {Object.} JSON object + */ + DocumentTransform.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentTransform + * @function getTypeUrl + * @memberof google.firestore.v1.DocumentTransform + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentTransform.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.DocumentTransform"; + }; + + DocumentTransform.FieldTransform = (function() { + + /** + * Properties of a FieldTransform. + * @memberof google.firestore.v1.DocumentTransform + * @interface IFieldTransform + * @property {string|null} [fieldPath] FieldTransform fieldPath + * @property {google.firestore.v1.DocumentTransform.FieldTransform.ServerValue|null} [setToServerValue] FieldTransform setToServerValue + * @property {google.firestore.v1.IValue|null} [increment] FieldTransform increment + * @property {google.firestore.v1.IValue|null} [maximum] FieldTransform maximum + * @property {google.firestore.v1.IValue|null} [minimum] FieldTransform minimum + * @property {google.firestore.v1.IArrayValue|null} [appendMissingElements] FieldTransform appendMissingElements + * @property {google.firestore.v1.IArrayValue|null} [removeAllFromArray] FieldTransform removeAllFromArray + */ + + /** + * Constructs a new FieldTransform. + * @memberof google.firestore.v1.DocumentTransform + * @classdesc Represents a FieldTransform. + * @implements IFieldTransform + * @constructor + * @param {google.firestore.v1.DocumentTransform.IFieldTransform=} [properties] Properties to set + */ + function FieldTransform(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldTransform fieldPath. + * @member {string} fieldPath + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.fieldPath = ""; + + /** + * FieldTransform setToServerValue. + * @member {google.firestore.v1.DocumentTransform.FieldTransform.ServerValue|null|undefined} setToServerValue + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.setToServerValue = null; + + /** + * FieldTransform increment. + * @member {google.firestore.v1.IValue|null|undefined} increment + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.increment = null; + + /** + * FieldTransform maximum. + * @member {google.firestore.v1.IValue|null|undefined} maximum + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.maximum = null; + + /** + * FieldTransform minimum. + * @member {google.firestore.v1.IValue|null|undefined} minimum + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.minimum = null; + + /** + * FieldTransform appendMissingElements. + * @member {google.firestore.v1.IArrayValue|null|undefined} appendMissingElements + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.appendMissingElements = null; + + /** + * FieldTransform removeAllFromArray. + * @member {google.firestore.v1.IArrayValue|null|undefined} removeAllFromArray + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.removeAllFromArray = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FieldTransform transformType. + * @member {"setToServerValue"|"increment"|"maximum"|"minimum"|"appendMissingElements"|"removeAllFromArray"|undefined} transformType + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @instance + */ + Object.defineProperty(FieldTransform.prototype, "transformType", { + get: $util.oneOfGetter($oneOfFields = ["setToServerValue", "increment", "maximum", "minimum", "appendMissingElements", "removeAllFromArray"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FieldTransform instance using the specified properties. + * @function create + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @static + * @param {google.firestore.v1.DocumentTransform.IFieldTransform=} [properties] Properties to set + * @returns {google.firestore.v1.DocumentTransform.FieldTransform} FieldTransform instance + */ + FieldTransform.create = function create(properties) { + return new FieldTransform(properties); + }; + + /** + * Encodes the specified FieldTransform message. Does not implicitly {@link google.firestore.v1.DocumentTransform.FieldTransform.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @static + * @param {google.firestore.v1.DocumentTransform.IFieldTransform} message FieldTransform message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldTransform.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fieldPath); + if (message.setToServerValue != null && Object.hasOwnProperty.call(message, "setToServerValue")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.setToServerValue); + if (message.increment != null && Object.hasOwnProperty.call(message, "increment")) + $root.google.firestore.v1.Value.encode(message.increment, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) + $root.google.firestore.v1.Value.encode(message.maximum, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) + $root.google.firestore.v1.Value.encode(message.minimum, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.appendMissingElements != null && Object.hasOwnProperty.call(message, "appendMissingElements")) + $root.google.firestore.v1.ArrayValue.encode(message.appendMissingElements, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.removeAllFromArray != null && Object.hasOwnProperty.call(message, "removeAllFromArray")) + $root.google.firestore.v1.ArrayValue.encode(message.removeAllFromArray, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldTransform message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentTransform.FieldTransform.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @static + * @param {google.firestore.v1.DocumentTransform.IFieldTransform} message FieldTransform message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldTransform.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldTransform message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.DocumentTransform.FieldTransform} FieldTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldTransform.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.DocumentTransform.FieldTransform(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.fieldPath = reader.string(); + break; + } + case 2: { + message.setToServerValue = reader.int32(); + break; + } + case 3: { + message.increment = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.maximum = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.minimum = $root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.appendMissingElements = $root.google.firestore.v1.ArrayValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.removeAllFromArray = $root.google.firestore.v1.ArrayValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldTransform message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.DocumentTransform.FieldTransform} FieldTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldTransform.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldTransform message. + * @function verify + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldTransform.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + if (!$util.isString(message.fieldPath)) + return "fieldPath: string expected"; + if (message.setToServerValue != null && Object.hasOwnProperty.call(message, "setToServerValue")) { + properties.transformType = 1; + switch (message.setToServerValue) { + default: + return "setToServerValue: enum value expected"; + case 0: + case 1: + break; + } + } + if (message.increment != null && Object.hasOwnProperty.call(message, "increment")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1.Value.verify(message.increment, long + 1); + if (error) + return "increment." + error; + } + } + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1.Value.verify(message.maximum, long + 1); + if (error) + return "maximum." + error; + } + } + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1.Value.verify(message.minimum, long + 1); + if (error) + return "minimum." + error; + } + } + if (message.appendMissingElements != null && Object.hasOwnProperty.call(message, "appendMissingElements")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1.ArrayValue.verify(message.appendMissingElements, long + 1); + if (error) + return "appendMissingElements." + error; + } + } + if (message.removeAllFromArray != null && Object.hasOwnProperty.call(message, "removeAllFromArray")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1.ArrayValue.verify(message.removeAllFromArray, long + 1); + if (error) + return "removeAllFromArray." + error; + } + } + return null; + }; + + /** + * Creates a FieldTransform message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.DocumentTransform.FieldTransform} FieldTransform + */ + FieldTransform.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.DocumentTransform.FieldTransform) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.DocumentTransform.FieldTransform: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.DocumentTransform.FieldTransform(); + if (object.fieldPath != null) + message.fieldPath = String(object.fieldPath); + switch (object.setToServerValue) { + default: + if (typeof object.setToServerValue === "number") { + message.setToServerValue = object.setToServerValue; + break; + } + break; + case "SERVER_VALUE_UNSPECIFIED": + case 0: + message.setToServerValue = 0; + break; + case "REQUEST_TIME": + case 1: + message.setToServerValue = 1; + break; + } + if (object.increment != null) { + if (!$util.isObject(object.increment)) + throw TypeError(".google.firestore.v1.DocumentTransform.FieldTransform.increment: object expected"); + message.increment = $root.google.firestore.v1.Value.fromObject(object.increment, long + 1); + } + if (object.maximum != null) { + if (!$util.isObject(object.maximum)) + throw TypeError(".google.firestore.v1.DocumentTransform.FieldTransform.maximum: object expected"); + message.maximum = $root.google.firestore.v1.Value.fromObject(object.maximum, long + 1); + } + if (object.minimum != null) { + if (!$util.isObject(object.minimum)) + throw TypeError(".google.firestore.v1.DocumentTransform.FieldTransform.minimum: object expected"); + message.minimum = $root.google.firestore.v1.Value.fromObject(object.minimum, long + 1); + } + if (object.appendMissingElements != null) { + if (!$util.isObject(object.appendMissingElements)) + throw TypeError(".google.firestore.v1.DocumentTransform.FieldTransform.appendMissingElements: object expected"); + message.appendMissingElements = $root.google.firestore.v1.ArrayValue.fromObject(object.appendMissingElements, long + 1); + } + if (object.removeAllFromArray != null) { + if (!$util.isObject(object.removeAllFromArray)) + throw TypeError(".google.firestore.v1.DocumentTransform.FieldTransform.removeAllFromArray: object expected"); + message.removeAllFromArray = $root.google.firestore.v1.ArrayValue.fromObject(object.removeAllFromArray, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a FieldTransform message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @static + * @param {google.firestore.v1.DocumentTransform.FieldTransform} message FieldTransform + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldTransform.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.fieldPath = ""; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + object.fieldPath = message.fieldPath; + if (message.setToServerValue != null && Object.hasOwnProperty.call(message, "setToServerValue")) { + object.setToServerValue = options.enums === String ? $root.google.firestore.v1.DocumentTransform.FieldTransform.ServerValue[message.setToServerValue] === undefined ? message.setToServerValue : $root.google.firestore.v1.DocumentTransform.FieldTransform.ServerValue[message.setToServerValue] : message.setToServerValue; + if (options.oneofs) + object.transformType = "setToServerValue"; + } + if (message.increment != null && Object.hasOwnProperty.call(message, "increment")) { + object.increment = $root.google.firestore.v1.Value.toObject(message.increment, options, q + 1); + if (options.oneofs) + object.transformType = "increment"; + } + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) { + object.maximum = $root.google.firestore.v1.Value.toObject(message.maximum, options, q + 1); + if (options.oneofs) + object.transformType = "maximum"; + } + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) { + object.minimum = $root.google.firestore.v1.Value.toObject(message.minimum, options, q + 1); + if (options.oneofs) + object.transformType = "minimum"; + } + if (message.appendMissingElements != null && Object.hasOwnProperty.call(message, "appendMissingElements")) { + object.appendMissingElements = $root.google.firestore.v1.ArrayValue.toObject(message.appendMissingElements, options, q + 1); + if (options.oneofs) + object.transformType = "appendMissingElements"; + } + if (message.removeAllFromArray != null && Object.hasOwnProperty.call(message, "removeAllFromArray")) { + object.removeAllFromArray = $root.google.firestore.v1.ArrayValue.toObject(message.removeAllFromArray, options, q + 1); + if (options.oneofs) + object.transformType = "removeAllFromArray"; + } + return object; + }; + + /** + * Converts this FieldTransform to JSON. + * @function toJSON + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @instance + * @returns {Object.} JSON object + */ + FieldTransform.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldTransform + * @function getTypeUrl + * @memberof google.firestore.v1.DocumentTransform.FieldTransform + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldTransform.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.DocumentTransform.FieldTransform"; + }; + + /** + * ServerValue enum. + * @name google.firestore.v1.DocumentTransform.FieldTransform.ServerValue + * @enum {number} + * @property {number} SERVER_VALUE_UNSPECIFIED=0 SERVER_VALUE_UNSPECIFIED value + * @property {number} REQUEST_TIME=1 REQUEST_TIME value + */ + FieldTransform.ServerValue = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SERVER_VALUE_UNSPECIFIED"] = 0; + values[valuesById[1] = "REQUEST_TIME"] = 1; + return values; + })(); + + return FieldTransform; + })(); + + return DocumentTransform; + })(); + + v1.WriteResult = (function() { + + /** + * Properties of a WriteResult. + * @memberof google.firestore.v1 + * @interface IWriteResult + * @property {google.protobuf.ITimestamp|null} [updateTime] WriteResult updateTime + * @property {Array.|null} [transformResults] WriteResult transformResults + */ + + /** + * Constructs a new WriteResult. + * @memberof google.firestore.v1 + * @classdesc Represents a WriteResult. + * @implements IWriteResult + * @constructor + * @param {google.firestore.v1.IWriteResult=} [properties] Properties to set + */ + function WriteResult(properties) { + this.transformResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteResult updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.firestore.v1.WriteResult + * @instance + */ + WriteResult.prototype.updateTime = null; + + /** + * WriteResult transformResults. + * @member {Array.} transformResults + * @memberof google.firestore.v1.WriteResult + * @instance + */ + WriteResult.prototype.transformResults = $util.emptyArray; + + /** + * Creates a new WriteResult instance using the specified properties. + * @function create + * @memberof google.firestore.v1.WriteResult + * @static + * @param {google.firestore.v1.IWriteResult=} [properties] Properties to set + * @returns {google.firestore.v1.WriteResult} WriteResult instance + */ + WriteResult.create = function create(properties) { + return new WriteResult(properties); + }; + + /** + * Encodes the specified WriteResult message. Does not implicitly {@link google.firestore.v1.WriteResult.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.WriteResult + * @static + * @param {google.firestore.v1.IWriteResult} message WriteResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteResult.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.transformResults != null && message.transformResults.length) + for (var i = 0; i < message.transformResults.length; ++i) + $root.google.firestore.v1.Value.encode(message.transformResults[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteResult message, length delimited. Does not implicitly {@link google.firestore.v1.WriteResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.WriteResult + * @static + * @param {google.firestore.v1.IWriteResult} message WriteResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a WriteResult message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.WriteResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.WriteResult} WriteResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteResult.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.WriteResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + if (!(message.transformResults && message.transformResults.length)) + message.transformResults = []; + message.transformResults.push($root.google.firestore.v1.Value.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a WriteResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.WriteResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.WriteResult} WriteResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteResult message. + * @function verify + * @memberof google.firestore.v1.WriteResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteResult.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime, long + 1); + if (error) + return "updateTime." + error; + } + if (message.transformResults != null && Object.hasOwnProperty.call(message, "transformResults")) { + if (!Array.isArray(message.transformResults)) + return "transformResults: array expected"; + for (var i = 0; i < message.transformResults.length; ++i) { + var error = $root.google.firestore.v1.Value.verify(message.transformResults[i], long + 1); + if (error) + return "transformResults." + error; + } + } + return null; + }; + + /** + * Creates a WriteResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.WriteResult + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.WriteResult} WriteResult + */ + WriteResult.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.WriteResult) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.WriteResult: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.WriteResult(); + if (object.updateTime != null) { + if (!$util.isObject(object.updateTime)) + throw TypeError(".google.firestore.v1.WriteResult.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime, long + 1); + } + if (object.transformResults) { + if (!Array.isArray(object.transformResults)) + throw TypeError(".google.firestore.v1.WriteResult.transformResults: array expected"); + message.transformResults = []; + for (var i = 0; i < object.transformResults.length; ++i) { + if (!$util.isObject(object.transformResults[i])) + throw TypeError(".google.firestore.v1.WriteResult.transformResults: object expected"); + message.transformResults[i] = $root.google.firestore.v1.Value.fromObject(object.transformResults[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a WriteResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.WriteResult + * @static + * @param {google.firestore.v1.WriteResult} message WriteResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteResult.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.transformResults = []; + if (options.defaults) + object.updateTime = null; + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options, q + 1); + if (message.transformResults && message.transformResults.length) { + object.transformResults = []; + for (var j = 0; j < message.transformResults.length; ++j) + object.transformResults[j] = $root.google.firestore.v1.Value.toObject(message.transformResults[j], options, q + 1); + } + return object; + }; + + /** + * Converts this WriteResult to JSON. + * @function toJSON + * @memberof google.firestore.v1.WriteResult + * @instance + * @returns {Object.} JSON object + */ + WriteResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteResult + * @function getTypeUrl + * @memberof google.firestore.v1.WriteResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.WriteResult"; + }; + + return WriteResult; + })(); + + v1.DocumentChange = (function() { + + /** + * Properties of a DocumentChange. + * @memberof google.firestore.v1 + * @interface IDocumentChange + * @property {google.firestore.v1.IDocument|null} [document] DocumentChange document + * @property {Array.|null} [targetIds] DocumentChange targetIds + * @property {Array.|null} [removedTargetIds] DocumentChange removedTargetIds + */ + + /** + * Constructs a new DocumentChange. + * @memberof google.firestore.v1 + * @classdesc Represents a DocumentChange. + * @implements IDocumentChange + * @constructor + * @param {google.firestore.v1.IDocumentChange=} [properties] Properties to set + */ + function DocumentChange(properties) { + this.targetIds = []; + this.removedTargetIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentChange document. + * @member {google.firestore.v1.IDocument|null|undefined} document + * @memberof google.firestore.v1.DocumentChange + * @instance + */ + DocumentChange.prototype.document = null; + + /** + * DocumentChange targetIds. + * @member {Array.} targetIds + * @memberof google.firestore.v1.DocumentChange + * @instance + */ + DocumentChange.prototype.targetIds = $util.emptyArray; + + /** + * DocumentChange removedTargetIds. + * @member {Array.} removedTargetIds + * @memberof google.firestore.v1.DocumentChange + * @instance + */ + DocumentChange.prototype.removedTargetIds = $util.emptyArray; + + /** + * Creates a new DocumentChange instance using the specified properties. + * @function create + * @memberof google.firestore.v1.DocumentChange + * @static + * @param {google.firestore.v1.IDocumentChange=} [properties] Properties to set + * @returns {google.firestore.v1.DocumentChange} DocumentChange instance + */ + DocumentChange.create = function create(properties) { + return new DocumentChange(properties); + }; + + /** + * Encodes the specified DocumentChange message. Does not implicitly {@link google.firestore.v1.DocumentChange.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.DocumentChange + * @static + * @param {google.firestore.v1.IDocumentChange} message DocumentChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentChange.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.firestore.v1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.targetIds != null && message.targetIds.length) { + writer.uint32(/* id 5, wireType 2 =*/42).fork(); + for (var i = 0; i < message.targetIds.length; ++i) + writer.int32(message.targetIds[i]); + writer.ldelim(); + } + if (message.removedTargetIds != null && message.removedTargetIds.length) { + writer.uint32(/* id 6, wireType 2 =*/50).fork(); + for (var i = 0; i < message.removedTargetIds.length; ++i) + writer.int32(message.removedTargetIds[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified DocumentChange message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentChange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.DocumentChange + * @static + * @param {google.firestore.v1.IDocumentChange} message DocumentChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentChange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentChange message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.DocumentChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.DocumentChange} DocumentChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentChange.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.DocumentChange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = $root.google.firestore.v1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + if (!(message.targetIds && message.targetIds.length)) + message.targetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.targetIds.push(reader.int32()); + } else + message.targetIds.push(reader.int32()); + break; + } + case 6: { + if (!(message.removedTargetIds && message.removedTargetIds.length)) + message.removedTargetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.removedTargetIds.push(reader.int32()); + } else + message.removedTargetIds.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentChange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.DocumentChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.DocumentChange} DocumentChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentChange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentChange message. + * @function verify + * @memberof google.firestore.v1.DocumentChange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentChange.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) { + var error = $root.google.firestore.v1.Document.verify(message.document, long + 1); + if (error) + return "document." + error; + } + if (message.targetIds != null && Object.hasOwnProperty.call(message, "targetIds")) { + if (!Array.isArray(message.targetIds)) + return "targetIds: array expected"; + for (var i = 0; i < message.targetIds.length; ++i) + if (!$util.isInteger(message.targetIds[i])) + return "targetIds: integer[] expected"; + } + if (message.removedTargetIds != null && Object.hasOwnProperty.call(message, "removedTargetIds")) { + if (!Array.isArray(message.removedTargetIds)) + return "removedTargetIds: array expected"; + for (var i = 0; i < message.removedTargetIds.length; ++i) + if (!$util.isInteger(message.removedTargetIds[i])) + return "removedTargetIds: integer[] expected"; + } + return null; + }; + + /** + * Creates a DocumentChange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.DocumentChange + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.DocumentChange} DocumentChange + */ + DocumentChange.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.DocumentChange) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.DocumentChange: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.DocumentChange(); + if (object.document != null) { + if (!$util.isObject(object.document)) + throw TypeError(".google.firestore.v1.DocumentChange.document: object expected"); + message.document = $root.google.firestore.v1.Document.fromObject(object.document, long + 1); + } + if (object.targetIds) { + if (!Array.isArray(object.targetIds)) + throw TypeError(".google.firestore.v1.DocumentChange.targetIds: array expected"); + message.targetIds = []; + for (var i = 0; i < object.targetIds.length; ++i) + message.targetIds[i] = object.targetIds[i] | 0; + } + if (object.removedTargetIds) { + if (!Array.isArray(object.removedTargetIds)) + throw TypeError(".google.firestore.v1.DocumentChange.removedTargetIds: array expected"); + message.removedTargetIds = []; + for (var i = 0; i < object.removedTargetIds.length; ++i) + message.removedTargetIds[i] = object.removedTargetIds[i] | 0; + } + return message; + }; + + /** + * Creates a plain object from a DocumentChange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.DocumentChange + * @static + * @param {google.firestore.v1.DocumentChange} message DocumentChange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentChange.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.targetIds = []; + object.removedTargetIds = []; + } + if (options.defaults) + object.document = null; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = $root.google.firestore.v1.Document.toObject(message.document, options, q + 1); + if (message.targetIds && message.targetIds.length) { + object.targetIds = []; + for (var j = 0; j < message.targetIds.length; ++j) + object.targetIds[j] = message.targetIds[j]; + } + if (message.removedTargetIds && message.removedTargetIds.length) { + object.removedTargetIds = []; + for (var j = 0; j < message.removedTargetIds.length; ++j) + object.removedTargetIds[j] = message.removedTargetIds[j]; + } + return object; + }; + + /** + * Converts this DocumentChange to JSON. + * @function toJSON + * @memberof google.firestore.v1.DocumentChange + * @instance + * @returns {Object.} JSON object + */ + DocumentChange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentChange + * @function getTypeUrl + * @memberof google.firestore.v1.DocumentChange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentChange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.DocumentChange"; + }; + + return DocumentChange; + })(); + + v1.DocumentDelete = (function() { + + /** + * Properties of a DocumentDelete. + * @memberof google.firestore.v1 + * @interface IDocumentDelete + * @property {string|null} [document] DocumentDelete document + * @property {Array.|null} [removedTargetIds] DocumentDelete removedTargetIds + * @property {google.protobuf.ITimestamp|null} [readTime] DocumentDelete readTime + */ + + /** + * Constructs a new DocumentDelete. + * @memberof google.firestore.v1 + * @classdesc Represents a DocumentDelete. + * @implements IDocumentDelete + * @constructor + * @param {google.firestore.v1.IDocumentDelete=} [properties] Properties to set + */ + function DocumentDelete(properties) { + this.removedTargetIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentDelete document. + * @member {string} document + * @memberof google.firestore.v1.DocumentDelete + * @instance + */ + DocumentDelete.prototype.document = ""; + + /** + * DocumentDelete removedTargetIds. + * @member {Array.} removedTargetIds + * @memberof google.firestore.v1.DocumentDelete + * @instance + */ + DocumentDelete.prototype.removedTargetIds = $util.emptyArray; + + /** + * DocumentDelete readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.DocumentDelete + * @instance + */ + DocumentDelete.prototype.readTime = null; + + /** + * Creates a new DocumentDelete instance using the specified properties. + * @function create + * @memberof google.firestore.v1.DocumentDelete + * @static + * @param {google.firestore.v1.IDocumentDelete=} [properties] Properties to set + * @returns {google.firestore.v1.DocumentDelete} DocumentDelete instance + */ + DocumentDelete.create = function create(properties) { + return new DocumentDelete(properties); + }; + + /** + * Encodes the specified DocumentDelete message. Does not implicitly {@link google.firestore.v1.DocumentDelete.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.DocumentDelete + * @static + * @param {google.firestore.v1.IDocumentDelete} message DocumentDelete message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentDelete.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.document); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.removedTargetIds != null && message.removedTargetIds.length) { + writer.uint32(/* id 6, wireType 2 =*/50).fork(); + for (var i = 0; i < message.removedTargetIds.length; ++i) + writer.int32(message.removedTargetIds[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified DocumentDelete message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentDelete.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.DocumentDelete + * @static + * @param {google.firestore.v1.IDocumentDelete} message DocumentDelete message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentDelete.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentDelete message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.DocumentDelete + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.DocumentDelete} DocumentDelete + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentDelete.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.DocumentDelete(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = reader.string(); + break; + } + case 6: { + if (!(message.removedTargetIds && message.removedTargetIds.length)) + message.removedTargetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.removedTargetIds.push(reader.int32()); + } else + message.removedTargetIds.push(reader.int32()); + break; + } + case 4: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentDelete message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.DocumentDelete + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.DocumentDelete} DocumentDelete + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentDelete.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentDelete message. + * @function verify + * @memberof google.firestore.v1.DocumentDelete + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentDelete.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + if (!$util.isString(message.document)) + return "document: string expected"; + if (message.removedTargetIds != null && Object.hasOwnProperty.call(message, "removedTargetIds")) { + if (!Array.isArray(message.removedTargetIds)) + return "removedTargetIds: array expected"; + for (var i = 0; i < message.removedTargetIds.length; ++i) + if (!$util.isInteger(message.removedTargetIds[i])) + return "removedTargetIds: integer[] expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a DocumentDelete message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.DocumentDelete + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.DocumentDelete} DocumentDelete + */ + DocumentDelete.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.DocumentDelete) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.DocumentDelete: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.DocumentDelete(); + if (object.document != null) + message.document = String(object.document); + if (object.removedTargetIds) { + if (!Array.isArray(object.removedTargetIds)) + throw TypeError(".google.firestore.v1.DocumentDelete.removedTargetIds: array expected"); + message.removedTargetIds = []; + for (var i = 0; i < object.removedTargetIds.length; ++i) + message.removedTargetIds[i] = object.removedTargetIds[i] | 0; + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.DocumentDelete.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a DocumentDelete message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.DocumentDelete + * @static + * @param {google.firestore.v1.DocumentDelete} message DocumentDelete + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentDelete.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.removedTargetIds = []; + if (options.defaults) { + object.document = ""; + object.readTime = null; + } + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = message.document; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (message.removedTargetIds && message.removedTargetIds.length) { + object.removedTargetIds = []; + for (var j = 0; j < message.removedTargetIds.length; ++j) + object.removedTargetIds[j] = message.removedTargetIds[j]; + } + return object; + }; + + /** + * Converts this DocumentDelete to JSON. + * @function toJSON + * @memberof google.firestore.v1.DocumentDelete + * @instance + * @returns {Object.} JSON object + */ + DocumentDelete.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentDelete + * @function getTypeUrl + * @memberof google.firestore.v1.DocumentDelete + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentDelete.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.DocumentDelete"; + }; + + return DocumentDelete; + })(); + + v1.DocumentRemove = (function() { + + /** + * Properties of a DocumentRemove. + * @memberof google.firestore.v1 + * @interface IDocumentRemove + * @property {string|null} [document] DocumentRemove document + * @property {Array.|null} [removedTargetIds] DocumentRemove removedTargetIds + * @property {google.protobuf.ITimestamp|null} [readTime] DocumentRemove readTime + */ + + /** + * Constructs a new DocumentRemove. + * @memberof google.firestore.v1 + * @classdesc Represents a DocumentRemove. + * @implements IDocumentRemove + * @constructor + * @param {google.firestore.v1.IDocumentRemove=} [properties] Properties to set + */ + function DocumentRemove(properties) { + this.removedTargetIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentRemove document. + * @member {string} document + * @memberof google.firestore.v1.DocumentRemove + * @instance + */ + DocumentRemove.prototype.document = ""; + + /** + * DocumentRemove removedTargetIds. + * @member {Array.} removedTargetIds + * @memberof google.firestore.v1.DocumentRemove + * @instance + */ + DocumentRemove.prototype.removedTargetIds = $util.emptyArray; + + /** + * DocumentRemove readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1.DocumentRemove + * @instance + */ + DocumentRemove.prototype.readTime = null; + + /** + * Creates a new DocumentRemove instance using the specified properties. + * @function create + * @memberof google.firestore.v1.DocumentRemove + * @static + * @param {google.firestore.v1.IDocumentRemove=} [properties] Properties to set + * @returns {google.firestore.v1.DocumentRemove} DocumentRemove instance + */ + DocumentRemove.create = function create(properties) { + return new DocumentRemove(properties); + }; + + /** + * Encodes the specified DocumentRemove message. Does not implicitly {@link google.firestore.v1.DocumentRemove.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.DocumentRemove + * @static + * @param {google.firestore.v1.IDocumentRemove} message DocumentRemove message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentRemove.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.document); + if (message.removedTargetIds != null && message.removedTargetIds.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.removedTargetIds.length; ++i) + writer.int32(message.removedTargetIds[i]); + writer.ldelim(); + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentRemove message, length delimited. Does not implicitly {@link google.firestore.v1.DocumentRemove.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.DocumentRemove + * @static + * @param {google.firestore.v1.IDocumentRemove} message DocumentRemove message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentRemove.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentRemove message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.DocumentRemove + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.DocumentRemove} DocumentRemove + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentRemove.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.DocumentRemove(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = reader.string(); + break; + } + case 2: { + if (!(message.removedTargetIds && message.removedTargetIds.length)) + message.removedTargetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.removedTargetIds.push(reader.int32()); + } else + message.removedTargetIds.push(reader.int32()); + break; + } + case 4: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentRemove message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.DocumentRemove + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.DocumentRemove} DocumentRemove + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentRemove.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentRemove message. + * @function verify + * @memberof google.firestore.v1.DocumentRemove + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentRemove.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + if (!$util.isString(message.document)) + return "document: string expected"; + if (message.removedTargetIds != null && Object.hasOwnProperty.call(message, "removedTargetIds")) { + if (!Array.isArray(message.removedTargetIds)) + return "removedTargetIds: array expected"; + for (var i = 0; i < message.removedTargetIds.length; ++i) + if (!$util.isInteger(message.removedTargetIds[i])) + return "removedTargetIds: integer[] expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a DocumentRemove message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.DocumentRemove + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.DocumentRemove} DocumentRemove + */ + DocumentRemove.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.DocumentRemove) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.DocumentRemove: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.DocumentRemove(); + if (object.document != null) + message.document = String(object.document); + if (object.removedTargetIds) { + if (!Array.isArray(object.removedTargetIds)) + throw TypeError(".google.firestore.v1.DocumentRemove.removedTargetIds: array expected"); + message.removedTargetIds = []; + for (var i = 0; i < object.removedTargetIds.length; ++i) + message.removedTargetIds[i] = object.removedTargetIds[i] | 0; + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1.DocumentRemove.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a DocumentRemove message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.DocumentRemove + * @static + * @param {google.firestore.v1.DocumentRemove} message DocumentRemove + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentRemove.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.removedTargetIds = []; + if (options.defaults) { + object.document = ""; + object.readTime = null; + } + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = message.document; + if (message.removedTargetIds && message.removedTargetIds.length) { + object.removedTargetIds = []; + for (var j = 0; j < message.removedTargetIds.length; ++j) + object.removedTargetIds[j] = message.removedTargetIds[j]; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + return object; + }; + + /** + * Converts this DocumentRemove to JSON. + * @function toJSON + * @memberof google.firestore.v1.DocumentRemove + * @instance + * @returns {Object.} JSON object + */ + DocumentRemove.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentRemove + * @function getTypeUrl + * @memberof google.firestore.v1.DocumentRemove + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentRemove.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.DocumentRemove"; + }; + + return DocumentRemove; + })(); + + v1.ExistenceFilter = (function() { + + /** + * Properties of an ExistenceFilter. + * @memberof google.firestore.v1 + * @interface IExistenceFilter + * @property {number|null} [targetId] ExistenceFilter targetId + * @property {number|null} [count] ExistenceFilter count + * @property {google.firestore.v1.IBloomFilter|null} [unchangedNames] ExistenceFilter unchangedNames + */ + + /** + * Constructs a new ExistenceFilter. + * @memberof google.firestore.v1 + * @classdesc Represents an ExistenceFilter. + * @implements IExistenceFilter + * @constructor + * @param {google.firestore.v1.IExistenceFilter=} [properties] Properties to set + */ + function ExistenceFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExistenceFilter targetId. + * @member {number} targetId + * @memberof google.firestore.v1.ExistenceFilter + * @instance + */ + ExistenceFilter.prototype.targetId = 0; + + /** + * ExistenceFilter count. + * @member {number} count + * @memberof google.firestore.v1.ExistenceFilter + * @instance + */ + ExistenceFilter.prototype.count = 0; + + /** + * ExistenceFilter unchangedNames. + * @member {google.firestore.v1.IBloomFilter|null|undefined} unchangedNames + * @memberof google.firestore.v1.ExistenceFilter + * @instance + */ + ExistenceFilter.prototype.unchangedNames = null; + + /** + * Creates a new ExistenceFilter instance using the specified properties. + * @function create + * @memberof google.firestore.v1.ExistenceFilter + * @static + * @param {google.firestore.v1.IExistenceFilter=} [properties] Properties to set + * @returns {google.firestore.v1.ExistenceFilter} ExistenceFilter instance + */ + ExistenceFilter.create = function create(properties) { + return new ExistenceFilter(properties); + }; + + /** + * Encodes the specified ExistenceFilter message. Does not implicitly {@link google.firestore.v1.ExistenceFilter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1.ExistenceFilter + * @static + * @param {google.firestore.v1.IExistenceFilter} message ExistenceFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExistenceFilter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.targetId); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.count); + if (message.unchangedNames != null && Object.hasOwnProperty.call(message, "unchangedNames")) + $root.google.firestore.v1.BloomFilter.encode(message.unchangedNames, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExistenceFilter message, length delimited. Does not implicitly {@link google.firestore.v1.ExistenceFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1.ExistenceFilter + * @static + * @param {google.firestore.v1.IExistenceFilter} message ExistenceFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExistenceFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExistenceFilter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1.ExistenceFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1.ExistenceFilter} ExistenceFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExistenceFilter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1.ExistenceFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.targetId = reader.int32(); + break; + } + case 2: { + message.count = reader.int32(); + break; + } + case 3: { + message.unchangedNames = $root.google.firestore.v1.BloomFilter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExistenceFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1.ExistenceFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1.ExistenceFilter} ExistenceFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExistenceFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExistenceFilter message. + * @function verify + * @memberof google.firestore.v1.ExistenceFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExistenceFilter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + if (!$util.isInteger(message.targetId)) + return "targetId: integer expected"; + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; + if (message.unchangedNames != null && Object.hasOwnProperty.call(message, "unchangedNames")) { + var error = $root.google.firestore.v1.BloomFilter.verify(message.unchangedNames, long + 1); + if (error) + return "unchangedNames." + error; + } + return null; + }; + + /** + * Creates an ExistenceFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1.ExistenceFilter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1.ExistenceFilter} ExistenceFilter + */ + ExistenceFilter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1.ExistenceFilter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1.ExistenceFilter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1.ExistenceFilter(); + if (object.targetId != null) + message.targetId = object.targetId | 0; + if (object.count != null) + message.count = object.count | 0; + if (object.unchangedNames != null) { + if (!$util.isObject(object.unchangedNames)) + throw TypeError(".google.firestore.v1.ExistenceFilter.unchangedNames: object expected"); + message.unchangedNames = $root.google.firestore.v1.BloomFilter.fromObject(object.unchangedNames, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an ExistenceFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1.ExistenceFilter + * @static + * @param {google.firestore.v1.ExistenceFilter} message ExistenceFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExistenceFilter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.targetId = 0; + object.count = 0; + object.unchangedNames = null; + } + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + object.targetId = message.targetId; + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + object.count = message.count; + if (message.unchangedNames != null && Object.hasOwnProperty.call(message, "unchangedNames")) + object.unchangedNames = $root.google.firestore.v1.BloomFilter.toObject(message.unchangedNames, options, q + 1); + return object; + }; + + /** + * Converts this ExistenceFilter to JSON. + * @function toJSON + * @memberof google.firestore.v1.ExistenceFilter + * @instance + * @returns {Object.} JSON object + */ + ExistenceFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExistenceFilter + * @function getTypeUrl + * @memberof google.firestore.v1.ExistenceFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExistenceFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1.ExistenceFilter"; + }; + + return ExistenceFilter; + })(); + + return v1; + })(); + + firestore.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof google.firestore + * @namespace + */ + var v1beta1 = {}; + + v1beta1.DocumentMask = (function() { + + /** + * Properties of a DocumentMask. + * @memberof google.firestore.v1beta1 + * @interface IDocumentMask + * @property {Array.|null} [fieldPaths] DocumentMask fieldPaths + */ + + /** + * Constructs a new DocumentMask. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a DocumentMask. + * @implements IDocumentMask + * @constructor + * @param {google.firestore.v1beta1.IDocumentMask=} [properties] Properties to set + */ + function DocumentMask(properties) { + this.fieldPaths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentMask fieldPaths. + * @member {Array.} fieldPaths + * @memberof google.firestore.v1beta1.DocumentMask + * @instance + */ + DocumentMask.prototype.fieldPaths = $util.emptyArray; + + /** + * Creates a new DocumentMask instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.DocumentMask + * @static + * @param {google.firestore.v1beta1.IDocumentMask=} [properties] Properties to set + * @returns {google.firestore.v1beta1.DocumentMask} DocumentMask instance + */ + DocumentMask.create = function create(properties) { + return new DocumentMask(properties); + }; + + /** + * Encodes the specified DocumentMask message. Does not implicitly {@link google.firestore.v1beta1.DocumentMask.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.DocumentMask + * @static + * @param {google.firestore.v1beta1.IDocumentMask} message DocumentMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentMask.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fieldPaths != null && message.fieldPaths.length) + for (var i = 0; i < message.fieldPaths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fieldPaths[i]); + return writer; + }; + + /** + * Encodes the specified DocumentMask message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.DocumentMask + * @static + * @param {google.firestore.v1beta1.IDocumentMask} message DocumentMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentMask message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.DocumentMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.DocumentMask} DocumentMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentMask.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.DocumentMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.fieldPaths && message.fieldPaths.length)) + message.fieldPaths = []; + message.fieldPaths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.DocumentMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.DocumentMask} DocumentMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentMask message. + * @function verify + * @memberof google.firestore.v1beta1.DocumentMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentMask.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fieldPaths != null && Object.hasOwnProperty.call(message, "fieldPaths")) { + if (!Array.isArray(message.fieldPaths)) + return "fieldPaths: array expected"; + for (var i = 0; i < message.fieldPaths.length; ++i) + if (!$util.isString(message.fieldPaths[i])) + return "fieldPaths: string[] expected"; + } + return null; + }; + + /** + * Creates a DocumentMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.DocumentMask + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.DocumentMask} DocumentMask + */ + DocumentMask.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.DocumentMask) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.DocumentMask: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.DocumentMask(); + if (object.fieldPaths) { + if (!Array.isArray(object.fieldPaths)) + throw TypeError(".google.firestore.v1beta1.DocumentMask.fieldPaths: array expected"); + message.fieldPaths = []; + for (var i = 0; i < object.fieldPaths.length; ++i) + message.fieldPaths[i] = String(object.fieldPaths[i]); + } + return message; + }; + + /** + * Creates a plain object from a DocumentMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.DocumentMask + * @static + * @param {google.firestore.v1beta1.DocumentMask} message DocumentMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentMask.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.fieldPaths = []; + if (message.fieldPaths && message.fieldPaths.length) { + object.fieldPaths = []; + for (var j = 0; j < message.fieldPaths.length; ++j) + object.fieldPaths[j] = message.fieldPaths[j]; + } + return object; + }; + + /** + * Converts this DocumentMask to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.DocumentMask + * @instance + * @returns {Object.} JSON object + */ + DocumentMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentMask + * @function getTypeUrl + * @memberof google.firestore.v1beta1.DocumentMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.DocumentMask"; + }; + + return DocumentMask; + })(); + + v1beta1.Precondition = (function() { + + /** + * Properties of a Precondition. + * @memberof google.firestore.v1beta1 + * @interface IPrecondition + * @property {boolean|null} [exists] Precondition exists + * @property {google.protobuf.ITimestamp|null} [updateTime] Precondition updateTime + */ + + /** + * Constructs a new Precondition. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a Precondition. + * @implements IPrecondition + * @constructor + * @param {google.firestore.v1beta1.IPrecondition=} [properties] Properties to set + */ + function Precondition(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Precondition exists. + * @member {boolean|null|undefined} exists + * @memberof google.firestore.v1beta1.Precondition + * @instance + */ + Precondition.prototype.exists = null; + + /** + * Precondition updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.firestore.v1beta1.Precondition + * @instance + */ + Precondition.prototype.updateTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Precondition conditionType. + * @member {"exists"|"updateTime"|undefined} conditionType + * @memberof google.firestore.v1beta1.Precondition + * @instance + */ + Object.defineProperty(Precondition.prototype, "conditionType", { + get: $util.oneOfGetter($oneOfFields = ["exists", "updateTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Precondition instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.Precondition + * @static + * @param {google.firestore.v1beta1.IPrecondition=} [properties] Properties to set + * @returns {google.firestore.v1beta1.Precondition} Precondition instance + */ + Precondition.create = function create(properties) { + return new Precondition(properties); + }; + + /** + * Encodes the specified Precondition message. Does not implicitly {@link google.firestore.v1beta1.Precondition.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.Precondition + * @static + * @param {google.firestore.v1beta1.IPrecondition} message Precondition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Precondition.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.exists != null && Object.hasOwnProperty.call(message, "exists")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.exists); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Precondition message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Precondition.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.Precondition + * @static + * @param {google.firestore.v1beta1.IPrecondition} message Precondition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Precondition.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Precondition message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.Precondition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.Precondition} Precondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Precondition.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.Precondition(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.exists = reader.bool(); + break; + } + case 2: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Precondition message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.Precondition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.Precondition} Precondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Precondition.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Precondition message. + * @function verify + * @memberof google.firestore.v1beta1.Precondition + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Precondition.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.exists != null && Object.hasOwnProperty.call(message, "exists")) { + properties.conditionType = 1; + if (typeof message.exists !== "boolean") + return "exists: boolean expected"; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + if (properties.conditionType === 1) + return "conditionType: multiple values"; + properties.conditionType = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime, long + 1); + if (error) + return "updateTime." + error; + } + } + return null; + }; + + /** + * Creates a Precondition message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.Precondition + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.Precondition} Precondition + */ + Precondition.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.Precondition) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.Precondition: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.Precondition(); + if (object.exists != null) + message.exists = Boolean(object.exists); + if (object.updateTime != null) { + if (!$util.isObject(object.updateTime)) + throw TypeError(".google.firestore.v1beta1.Precondition.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Precondition message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.Precondition + * @static + * @param {google.firestore.v1beta1.Precondition} message Precondition + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Precondition.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.exists != null && Object.hasOwnProperty.call(message, "exists")) { + object.exists = message.exists; + if (options.oneofs) + object.conditionType = "exists"; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options, q + 1); + if (options.oneofs) + object.conditionType = "updateTime"; + } + return object; + }; + + /** + * Converts this Precondition to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.Precondition + * @instance + * @returns {Object.} JSON object + */ + Precondition.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Precondition + * @function getTypeUrl + * @memberof google.firestore.v1beta1.Precondition + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Precondition.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.Precondition"; + }; + + return Precondition; + })(); + + v1beta1.TransactionOptions = (function() { + + /** + * Properties of a TransactionOptions. + * @memberof google.firestore.v1beta1 + * @interface ITransactionOptions + * @property {google.firestore.v1beta1.TransactionOptions.IReadOnly|null} [readOnly] TransactionOptions readOnly + * @property {google.firestore.v1beta1.TransactionOptions.IReadWrite|null} [readWrite] TransactionOptions readWrite + */ + + /** + * Constructs a new TransactionOptions. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a TransactionOptions. + * @implements ITransactionOptions + * @constructor + * @param {google.firestore.v1beta1.ITransactionOptions=} [properties] Properties to set + */ + function TransactionOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * TransactionOptions readOnly. + * @member {google.firestore.v1beta1.TransactionOptions.IReadOnly|null|undefined} readOnly + * @memberof google.firestore.v1beta1.TransactionOptions + * @instance + */ + TransactionOptions.prototype.readOnly = null; + + /** + * TransactionOptions readWrite. + * @member {google.firestore.v1beta1.TransactionOptions.IReadWrite|null|undefined} readWrite + * @memberof google.firestore.v1beta1.TransactionOptions + * @instance + */ + TransactionOptions.prototype.readWrite = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * TransactionOptions mode. + * @member {"readOnly"|"readWrite"|undefined} mode + * @memberof google.firestore.v1beta1.TransactionOptions + * @instance + */ + Object.defineProperty(TransactionOptions.prototype, "mode", { + get: $util.oneOfGetter($oneOfFields = ["readOnly", "readWrite"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TransactionOptions instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.TransactionOptions + * @static + * @param {google.firestore.v1beta1.ITransactionOptions=} [properties] Properties to set + * @returns {google.firestore.v1beta1.TransactionOptions} TransactionOptions instance + */ + TransactionOptions.create = function create(properties) { + return new TransactionOptions(properties); + }; + + /** + * Encodes the specified TransactionOptions message. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.TransactionOptions + * @static + * @param {google.firestore.v1beta1.ITransactionOptions} message TransactionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.readOnly != null && Object.hasOwnProperty.call(message, "readOnly")) + $root.google.firestore.v1beta1.TransactionOptions.ReadOnly.encode(message.readOnly, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.readWrite != null && Object.hasOwnProperty.call(message, "readWrite")) + $root.google.firestore.v1beta1.TransactionOptions.ReadWrite.encode(message.readWrite, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified TransactionOptions message, length delimited. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.TransactionOptions + * @static + * @param {google.firestore.v1beta1.ITransactionOptions} message TransactionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a TransactionOptions message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.TransactionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.TransactionOptions} TransactionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.TransactionOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.readOnly = $root.google.firestore.v1beta1.TransactionOptions.ReadOnly.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.readWrite = $root.google.firestore.v1beta1.TransactionOptions.ReadWrite.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a TransactionOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.TransactionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.TransactionOptions} TransactionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransactionOptions message. + * @function verify + * @memberof google.firestore.v1beta1.TransactionOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransactionOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.readOnly != null && Object.hasOwnProperty.call(message, "readOnly")) { + properties.mode = 1; + { + var error = $root.google.firestore.v1beta1.TransactionOptions.ReadOnly.verify(message.readOnly, long + 1); + if (error) + return "readOnly." + error; + } + } + if (message.readWrite != null && Object.hasOwnProperty.call(message, "readWrite")) { + if (properties.mode === 1) + return "mode: multiple values"; + properties.mode = 1; + { + var error = $root.google.firestore.v1beta1.TransactionOptions.ReadWrite.verify(message.readWrite, long + 1); + if (error) + return "readWrite." + error; + } + } + return null; + }; + + /** + * Creates a TransactionOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.TransactionOptions + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.TransactionOptions} TransactionOptions + */ + TransactionOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.TransactionOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.TransactionOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.TransactionOptions(); + if (object.readOnly != null) { + if (!$util.isObject(object.readOnly)) + throw TypeError(".google.firestore.v1beta1.TransactionOptions.readOnly: object expected"); + message.readOnly = $root.google.firestore.v1beta1.TransactionOptions.ReadOnly.fromObject(object.readOnly, long + 1); + } + if (object.readWrite != null) { + if (!$util.isObject(object.readWrite)) + throw TypeError(".google.firestore.v1beta1.TransactionOptions.readWrite: object expected"); + message.readWrite = $root.google.firestore.v1beta1.TransactionOptions.ReadWrite.fromObject(object.readWrite, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a TransactionOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.TransactionOptions + * @static + * @param {google.firestore.v1beta1.TransactionOptions} message TransactionOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransactionOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.readOnly != null && Object.hasOwnProperty.call(message, "readOnly")) { + object.readOnly = $root.google.firestore.v1beta1.TransactionOptions.ReadOnly.toObject(message.readOnly, options, q + 1); + if (options.oneofs) + object.mode = "readOnly"; + } + if (message.readWrite != null && Object.hasOwnProperty.call(message, "readWrite")) { + object.readWrite = $root.google.firestore.v1beta1.TransactionOptions.ReadWrite.toObject(message.readWrite, options, q + 1); + if (options.oneofs) + object.mode = "readWrite"; + } + return object; + }; + + /** + * Converts this TransactionOptions to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.TransactionOptions + * @instance + * @returns {Object.} JSON object + */ + TransactionOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TransactionOptions + * @function getTypeUrl + * @memberof google.firestore.v1beta1.TransactionOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TransactionOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.TransactionOptions"; + }; + + TransactionOptions.ReadWrite = (function() { + + /** + * Properties of a ReadWrite. + * @memberof google.firestore.v1beta1.TransactionOptions + * @interface IReadWrite + * @property {Uint8Array|null} [retryTransaction] ReadWrite retryTransaction + */ + + /** + * Constructs a new ReadWrite. + * @memberof google.firestore.v1beta1.TransactionOptions + * @classdesc Represents a ReadWrite. + * @implements IReadWrite + * @constructor + * @param {google.firestore.v1beta1.TransactionOptions.IReadWrite=} [properties] Properties to set + */ + function ReadWrite(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReadWrite retryTransaction. + * @member {Uint8Array} retryTransaction + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @instance + */ + ReadWrite.prototype.retryTransaction = $util.newBuffer([]); + + /** + * Creates a new ReadWrite instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @static + * @param {google.firestore.v1beta1.TransactionOptions.IReadWrite=} [properties] Properties to set + * @returns {google.firestore.v1beta1.TransactionOptions.ReadWrite} ReadWrite instance + */ + ReadWrite.create = function create(properties) { + return new ReadWrite(properties); + }; + + /** + * Encodes the specified ReadWrite message. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.ReadWrite.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @static + * @param {google.firestore.v1beta1.TransactionOptions.IReadWrite} message ReadWrite message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadWrite.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.retryTransaction != null && Object.hasOwnProperty.call(message, "retryTransaction")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.retryTransaction); + return writer; + }; + + /** + * Encodes the specified ReadWrite message, length delimited. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.ReadWrite.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @static + * @param {google.firestore.v1beta1.TransactionOptions.IReadWrite} message ReadWrite message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadWrite.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ReadWrite message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.TransactionOptions.ReadWrite} ReadWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadWrite.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.TransactionOptions.ReadWrite(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.retryTransaction = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ReadWrite message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.TransactionOptions.ReadWrite} ReadWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadWrite.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReadWrite message. + * @function verify + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadWrite.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.retryTransaction != null && Object.hasOwnProperty.call(message, "retryTransaction")) + if (!(message.retryTransaction && typeof message.retryTransaction.length === "number" || $util.isString(message.retryTransaction))) + return "retryTransaction: buffer expected"; + return null; + }; + + /** + * Creates a ReadWrite message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.TransactionOptions.ReadWrite} ReadWrite + */ + ReadWrite.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.TransactionOptions.ReadWrite) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.TransactionOptions.ReadWrite: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.TransactionOptions.ReadWrite(); + if (object.retryTransaction != null) + if (typeof object.retryTransaction === "string") + $util.base64.decode(object.retryTransaction, message.retryTransaction = $util.newBuffer($util.base64.length(object.retryTransaction)), 0); + else if (object.retryTransaction.length >= 0) + message.retryTransaction = object.retryTransaction; + return message; + }; + + /** + * Creates a plain object from a ReadWrite message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @static + * @param {google.firestore.v1beta1.TransactionOptions.ReadWrite} message ReadWrite + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadWrite.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.retryTransaction = ""; + else { + object.retryTransaction = []; + if (options.bytes !== Array) + object.retryTransaction = $util.newBuffer(object.retryTransaction); + } + if (message.retryTransaction != null && Object.hasOwnProperty.call(message, "retryTransaction")) + object.retryTransaction = options.bytes === String ? $util.base64.encode(message.retryTransaction, 0, message.retryTransaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.retryTransaction) : message.retryTransaction; + return object; + }; + + /** + * Converts this ReadWrite to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @instance + * @returns {Object.} JSON object + */ + ReadWrite.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadWrite + * @function getTypeUrl + * @memberof google.firestore.v1beta1.TransactionOptions.ReadWrite + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadWrite.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.TransactionOptions.ReadWrite"; + }; + + return ReadWrite; + })(); + + TransactionOptions.ReadOnly = (function() { + + /** + * Properties of a ReadOnly. + * @memberof google.firestore.v1beta1.TransactionOptions + * @interface IReadOnly + * @property {google.protobuf.ITimestamp|null} [readTime] ReadOnly readTime + */ + + /** + * Constructs a new ReadOnly. + * @memberof google.firestore.v1beta1.TransactionOptions + * @classdesc Represents a ReadOnly. + * @implements IReadOnly + * @constructor + * @param {google.firestore.v1beta1.TransactionOptions.IReadOnly=} [properties] Properties to set + */ + function ReadOnly(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReadOnly readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @instance + */ + ReadOnly.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReadOnly consistencySelector. + * @member {"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @instance + */ + Object.defineProperty(ReadOnly.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReadOnly instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @static + * @param {google.firestore.v1beta1.TransactionOptions.IReadOnly=} [properties] Properties to set + * @returns {google.firestore.v1beta1.TransactionOptions.ReadOnly} ReadOnly instance + */ + ReadOnly.create = function create(properties) { + return new ReadOnly(properties); + }; + + /** + * Encodes the specified ReadOnly message. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.ReadOnly.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @static + * @param {google.firestore.v1beta1.TransactionOptions.IReadOnly} message ReadOnly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadOnly.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReadOnly message, length delimited. Does not implicitly {@link google.firestore.v1beta1.TransactionOptions.ReadOnly.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @static + * @param {google.firestore.v1beta1.TransactionOptions.IReadOnly} message ReadOnly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadOnly.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ReadOnly message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.TransactionOptions.ReadOnly} ReadOnly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadOnly.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.TransactionOptions.ReadOnly(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ReadOnly message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.TransactionOptions.ReadOnly} ReadOnly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadOnly.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReadOnly message. + * @function verify + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadOnly.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + return null; + }; + + /** + * Creates a ReadOnly message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.TransactionOptions.ReadOnly} ReadOnly + */ + ReadOnly.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.TransactionOptions.ReadOnly) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.TransactionOptions.ReadOnly: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.TransactionOptions.ReadOnly(); + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.TransactionOptions.ReadOnly.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a ReadOnly message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @static + * @param {google.firestore.v1beta1.TransactionOptions.ReadOnly} message ReadOnly + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadOnly.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + return object; + }; + + /** + * Converts this ReadOnly to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @instance + * @returns {Object.} JSON object + */ + ReadOnly.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadOnly + * @function getTypeUrl + * @memberof google.firestore.v1beta1.TransactionOptions.ReadOnly + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadOnly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.TransactionOptions.ReadOnly"; + }; + + return ReadOnly; + })(); + + return TransactionOptions; + })(); + + v1beta1.Document = (function() { + + /** + * Properties of a Document. + * @memberof google.firestore.v1beta1 + * @interface IDocument + * @property {string|null} [name] Document name + * @property {Object.|null} [fields] Document fields + * @property {google.protobuf.ITimestamp|null} [createTime] Document createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Document updateTime + */ + + /** + * Constructs a new Document. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a Document. + * @implements IDocument + * @constructor + * @param {google.firestore.v1beta1.IDocument=} [properties] Properties to set + */ + function Document(properties) { + this.fields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Document name. + * @member {string} name + * @memberof google.firestore.v1beta1.Document + * @instance + */ + Document.prototype.name = ""; + + /** + * Document fields. + * @member {Object.} fields + * @memberof google.firestore.v1beta1.Document + * @instance + */ + Document.prototype.fields = $util.emptyObject; + + /** + * Document createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.firestore.v1beta1.Document + * @instance + */ + Document.prototype.createTime = null; + + /** + * Document updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.firestore.v1beta1.Document + * @instance + */ + Document.prototype.updateTime = null; + + /** + * Creates a new Document instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.Document + * @static + * @param {google.firestore.v1beta1.IDocument=} [properties] Properties to set + * @returns {google.firestore.v1beta1.Document} Document instance + */ + Document.create = function create(properties) { + return new Document(properties); + }; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.firestore.v1beta1.Document.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.Document + * @static + * @param {google.firestore.v1beta1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) + for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.firestore.v1beta1.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); + } + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Document.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.Document + * @static + * @param {google.firestore.v1beta1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Document message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.Document(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.firestore.v1beta1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.fields, key); + message.fields[key] = value; + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Document message. + * @function verify + * @memberof google.firestore.v1beta1.Document + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Document.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { + if (!$util.isObject(message.fields)) + return "fields: object expected"; + var key = Object.keys(message.fields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.firestore.v1beta1.Value.verify(message.fields[key[i]], long + 1); + if (error) + return "fields." + error; + } + } + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime, long + 1); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime, long + 1); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.Document + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.Document} Document + */ + Document.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.Document) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.Document: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.Document(); + if (object.name != null) + message.name = String(object.name); + if (object.fields) { + if (!$util.isObject(object.fields)) + throw TypeError(".google.firestore.v1beta1.Document.fields: object expected"); + message.fields = {}; + for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.fields, keys[i]); + if (!$util.isObject(object.fields[keys[i]])) + throw TypeError(".google.firestore.v1beta1.Document.fields: object expected"); + message.fields[keys[i]] = $root.google.firestore.v1beta1.Value.fromObject(object.fields[keys[i]], long + 1); + } + } + if (object.createTime != null) { + if (!$util.isObject(object.createTime)) + throw TypeError(".google.firestore.v1beta1.Document.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime, long + 1); + } + if (object.updateTime != null) { + if (!$util.isObject(object.updateTime)) + throw TypeError(".google.firestore.v1beta1.Document.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.Document + * @static + * @param {google.firestore.v1beta1.Document} message Document + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Document.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.fields = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + var keys2; + if (message.fields && (keys2 = Object.keys(message.fields)).length) { + object.fields = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.fields, keys2[j]); + object.fields[keys2[j]] = $root.google.firestore.v1beta1.Value.toObject(message.fields[keys2[j]], options, q + 1); + } + } + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options, q + 1); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options, q + 1); + return object; + }; + + /** + * Converts this Document to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.Document + * @instance + * @returns {Object.} JSON object + */ + Document.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Document + * @function getTypeUrl + * @memberof google.firestore.v1beta1.Document + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.Document"; + }; + + return Document; + })(); + + v1beta1.Value = (function() { + + /** + * Properties of a Value. + * @memberof google.firestore.v1beta1 + * @interface IValue + * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue + * @property {boolean|null} [booleanValue] Value booleanValue + * @property {number|Long|null} [integerValue] Value integerValue + * @property {number|null} [doubleValue] Value doubleValue + * @property {google.protobuf.ITimestamp|null} [timestampValue] Value timestampValue + * @property {string|null} [stringValue] Value stringValue + * @property {Uint8Array|null} [bytesValue] Value bytesValue + * @property {string|null} [referenceValue] Value referenceValue + * @property {google.type.ILatLng|null} [geoPointValue] Value geoPointValue + * @property {google.firestore.v1beta1.IArrayValue|null} [arrayValue] Value arrayValue + * @property {google.firestore.v1beta1.IMapValue|null} [mapValue] Value mapValue + */ + + /** + * Constructs a new Value. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a Value. + * @implements IValue + * @constructor + * @param {google.firestore.v1beta1.IValue=} [properties] Properties to set + */ + function Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Value nullValue. + * @member {google.protobuf.NullValue|null|undefined} nullValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.nullValue = null; + + /** + * Value booleanValue. + * @member {boolean|null|undefined} booleanValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.booleanValue = null; + + /** + * Value integerValue. + * @member {number|Long|null|undefined} integerValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.integerValue = null; + + /** + * Value doubleValue. + * @member {number|null|undefined} doubleValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.doubleValue = null; + + /** + * Value timestampValue. + * @member {google.protobuf.ITimestamp|null|undefined} timestampValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.timestampValue = null; + + /** + * Value stringValue. + * @member {string|null|undefined} stringValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.stringValue = null; + + /** + * Value bytesValue. + * @member {Uint8Array|null|undefined} bytesValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.bytesValue = null; + + /** + * Value referenceValue. + * @member {string|null|undefined} referenceValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.referenceValue = null; + + /** + * Value geoPointValue. + * @member {google.type.ILatLng|null|undefined} geoPointValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.geoPointValue = null; + + /** + * Value arrayValue. + * @member {google.firestore.v1beta1.IArrayValue|null|undefined} arrayValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.arrayValue = null; + + /** + * Value mapValue. + * @member {google.firestore.v1beta1.IMapValue|null|undefined} mapValue + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Value.prototype.mapValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Value valueType. + * @member {"nullValue"|"booleanValue"|"integerValue"|"doubleValue"|"timestampValue"|"stringValue"|"bytesValue"|"referenceValue"|"geoPointValue"|"arrayValue"|"mapValue"|undefined} valueType + * @memberof google.firestore.v1beta1.Value + * @instance + */ + Object.defineProperty(Value.prototype, "valueType", { + get: $util.oneOfGetter($oneOfFields = ["nullValue", "booleanValue", "integerValue", "doubleValue", "timestampValue", "stringValue", "bytesValue", "referenceValue", "geoPointValue", "arrayValue", "mapValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Value instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.Value + * @static + * @param {google.firestore.v1beta1.IValue=} [properties] Properties to set + * @returns {google.firestore.v1beta1.Value} Value instance + */ + Value.create = function create(properties) { + return new Value(properties); + }; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.firestore.v1beta1.Value.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.Value + * @static + * @param {google.firestore.v1beta1.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.booleanValue); + if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.integerValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.doubleValue); + if (message.referenceValue != null && Object.hasOwnProperty.call(message, "referenceValue")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.referenceValue); + if (message.mapValue != null && Object.hasOwnProperty.call(message, "mapValue")) + $root.google.firestore.v1beta1.MapValue.encode(message.mapValue, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.geoPointValue != null && Object.hasOwnProperty.call(message, "geoPointValue")) + $root.google.type.LatLng.encode(message.geoPointValue, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue")) + $root.google.firestore.v1beta1.ArrayValue.encode(message.arrayValue, writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); + if (message.timestampValue != null && Object.hasOwnProperty.call(message, "timestampValue")) + $root.google.protobuf.Timestamp.encode(message.timestampValue, writer.uint32(/* id 10, wireType 2 =*/82).fork(), q + 1).ldelim(); + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.nullValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.stringValue); + if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue")) + writer.uint32(/* id 18, wireType 2 =*/146).bytes(message.bytesValue); + return writer; + }; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.Value + * @static + * @param {google.firestore.v1beta1.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Value message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 11: { + message.nullValue = reader.int32(); + break; + } + case 1: { + message.booleanValue = reader.bool(); + break; + } + case 2: { + message.integerValue = reader.int64(); + break; + } + case 3: { + message.doubleValue = reader.double(); + break; + } + case 10: { + message.timestampValue = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 17: { + message.stringValue = reader.string(); + break; + } + case 18: { + message.bytesValue = reader.bytes(); + break; + } + case 5: { + message.referenceValue = reader.string(); + break; + } + case 8: { + message.geoPointValue = $root.google.type.LatLng.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 9: { + message.arrayValue = $root.google.firestore.v1beta1.ArrayValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.mapValue = $root.google.firestore.v1beta1.MapValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Value message. + * @function verify + * @memberof google.firestore.v1beta1.Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Value.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) { + properties.valueType = 1; + switch (message.nullValue) { + default: + return "nullValue: enum value expected"; + case 0: + break; + } + } + if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (typeof message.booleanValue !== "boolean") + return "booleanValue: boolean expected"; + } + if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!$util.isInteger(message.integerValue) && !(message.integerValue && $util.isInteger(message.integerValue.low) && $util.isInteger(message.integerValue.high))) + return "integerValue: integer|Long expected"; + } + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + } + if (message.timestampValue != null && Object.hasOwnProperty.call(message, "timestampValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.timestampValue, long + 1); + if (error) + return "timestampValue." + error; + } + } + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!$util.isString(message.stringValue)) + return "stringValue: string expected"; + } + if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!(message.bytesValue && typeof message.bytesValue.length === "number" || $util.isString(message.bytesValue))) + return "bytesValue: buffer expected"; + } + if (message.referenceValue != null && Object.hasOwnProperty.call(message, "referenceValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + if (!$util.isString(message.referenceValue)) + return "referenceValue: string expected"; + } + if (message.geoPointValue != null && Object.hasOwnProperty.call(message, "geoPointValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.type.LatLng.verify(message.geoPointValue, long + 1); + if (error) + return "geoPointValue." + error; + } + } + if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.firestore.v1beta1.ArrayValue.verify(message.arrayValue, long + 1); + if (error) + return "arrayValue." + error; + } + } + if (message.mapValue != null && Object.hasOwnProperty.call(message, "mapValue")) { + if (properties.valueType === 1) + return "valueType: multiple values"; + properties.valueType = 1; + { + var error = $root.google.firestore.v1beta1.MapValue.verify(message.mapValue, long + 1); + if (error) + return "mapValue." + error; + } + } + return null; + }; + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.Value + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.Value} Value + */ + Value.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.Value) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.Value: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.Value(); + switch (object.nullValue) { + default: + if (typeof object.nullValue === "number") { + message.nullValue = object.nullValue; + break; + } + break; + case "NULL_VALUE": + case 0: + message.nullValue = 0; + break; + } + if (object.booleanValue != null) + message.booleanValue = Boolean(object.booleanValue); + if (object.integerValue != null) + if ($util.Long) + message.integerValue = $util.Long.fromValue(object.integerValue, false); + else if (typeof object.integerValue === "string") + message.integerValue = parseInt(object.integerValue, 10); + else if (typeof object.integerValue === "number") + message.integerValue = object.integerValue; + else if (typeof object.integerValue === "object") + message.integerValue = new $util.LongBits(object.integerValue.low >>> 0, object.integerValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.timestampValue != null) { + if (!$util.isObject(object.timestampValue)) + throw TypeError(".google.firestore.v1beta1.Value.timestampValue: object expected"); + message.timestampValue = $root.google.protobuf.Timestamp.fromObject(object.timestampValue, long + 1); + } + if (object.stringValue != null) + message.stringValue = String(object.stringValue); + if (object.bytesValue != null) + if (typeof object.bytesValue === "string") + $util.base64.decode(object.bytesValue, message.bytesValue = $util.newBuffer($util.base64.length(object.bytesValue)), 0); + else if (object.bytesValue.length >= 0) + message.bytesValue = object.bytesValue; + if (object.referenceValue != null) + message.referenceValue = String(object.referenceValue); + if (object.geoPointValue != null) { + if (!$util.isObject(object.geoPointValue)) + throw TypeError(".google.firestore.v1beta1.Value.geoPointValue: object expected"); + message.geoPointValue = $root.google.type.LatLng.fromObject(object.geoPointValue, long + 1); + } + if (object.arrayValue != null) { + if (!$util.isObject(object.arrayValue)) + throw TypeError(".google.firestore.v1beta1.Value.arrayValue: object expected"); + message.arrayValue = $root.google.firestore.v1beta1.ArrayValue.fromObject(object.arrayValue, long + 1); + } + if (object.mapValue != null) { + if (!$util.isObject(object.mapValue)) + throw TypeError(".google.firestore.v1beta1.Value.mapValue: object expected"); + message.mapValue = $root.google.firestore.v1beta1.MapValue.fromObject(object.mapValue, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.Value + * @static + * @param {google.firestore.v1beta1.Value} message Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Value.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) { + object.booleanValue = message.booleanValue; + if (options.oneofs) + object.valueType = "booleanValue"; + } + if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue")) { + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.integerValue = typeof message.integerValue === "number" ? BigInt(message.integerValue) : $util.Long.fromBits(message.integerValue.low >>> 0, message.integerValue.high >>> 0, false).toBigInt(); + else if (typeof message.integerValue === "number") + object.integerValue = options.longs === String ? String(message.integerValue) : message.integerValue; + else + object.integerValue = options.longs === String ? $util.Long.prototype.toString.call(message.integerValue) : options.longs === Number ? new $util.LongBits(message.integerValue.low >>> 0, message.integerValue.high >>> 0).toNumber() : message.integerValue; + if (options.oneofs) + object.valueType = "integerValue"; + } + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) { + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (options.oneofs) + object.valueType = "doubleValue"; + } + if (message.referenceValue != null && Object.hasOwnProperty.call(message, "referenceValue")) { + object.referenceValue = message.referenceValue; + if (options.oneofs) + object.valueType = "referenceValue"; + } + if (message.mapValue != null && Object.hasOwnProperty.call(message, "mapValue")) { + object.mapValue = $root.google.firestore.v1beta1.MapValue.toObject(message.mapValue, options, q + 1); + if (options.oneofs) + object.valueType = "mapValue"; + } + if (message.geoPointValue != null && Object.hasOwnProperty.call(message, "geoPointValue")) { + object.geoPointValue = $root.google.type.LatLng.toObject(message.geoPointValue, options, q + 1); + if (options.oneofs) + object.valueType = "geoPointValue"; + } + if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue")) { + object.arrayValue = $root.google.firestore.v1beta1.ArrayValue.toObject(message.arrayValue, options, q + 1); + if (options.oneofs) + object.valueType = "arrayValue"; + } + if (message.timestampValue != null && Object.hasOwnProperty.call(message, "timestampValue")) { + object.timestampValue = $root.google.protobuf.Timestamp.toObject(message.timestampValue, options, q + 1); + if (options.oneofs) + object.valueType = "timestampValue"; + } + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) { + object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; + if (options.oneofs) + object.valueType = "nullValue"; + } + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) { + object.stringValue = message.stringValue; + if (options.oneofs) + object.valueType = "stringValue"; + } + if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue")) { + object.bytesValue = options.bytes === String ? $util.base64.encode(message.bytesValue, 0, message.bytesValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.bytesValue) : message.bytesValue; + if (options.oneofs) + object.valueType = "bytesValue"; + } + return object; + }; + + /** + * Converts this Value to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.Value + * @instance + * @returns {Object.} JSON object + */ + Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Value + * @function getTypeUrl + * @memberof google.firestore.v1beta1.Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.Value"; + }; + + return Value; + })(); + + v1beta1.ArrayValue = (function() { + + /** + * Properties of an ArrayValue. + * @memberof google.firestore.v1beta1 + * @interface IArrayValue + * @property {Array.|null} [values] ArrayValue values + */ + + /** + * Constructs a new ArrayValue. + * @memberof google.firestore.v1beta1 + * @classdesc Represents an ArrayValue. + * @implements IArrayValue + * @constructor + * @param {google.firestore.v1beta1.IArrayValue=} [properties] Properties to set + */ + function ArrayValue(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ArrayValue values. + * @member {Array.} values + * @memberof google.firestore.v1beta1.ArrayValue + * @instance + */ + ArrayValue.prototype.values = $util.emptyArray; + + /** + * Creates a new ArrayValue instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.ArrayValue + * @static + * @param {google.firestore.v1beta1.IArrayValue=} [properties] Properties to set + * @returns {google.firestore.v1beta1.ArrayValue} ArrayValue instance + */ + ArrayValue.create = function create(properties) { + return new ArrayValue(properties); + }; + + /** + * Encodes the specified ArrayValue message. Does not implicitly {@link google.firestore.v1beta1.ArrayValue.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.ArrayValue + * @static + * @param {google.firestore.v1beta1.IArrayValue} message ArrayValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArrayValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.firestore.v1beta1.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ArrayValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.ArrayValue + * @static + * @param {google.firestore.v1beta1.IArrayValue} message ArrayValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArrayValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ArrayValue message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.ArrayValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.ArrayValue} ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArrayValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.ArrayValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.firestore.v1beta1.Value.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ArrayValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.ArrayValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.ArrayValue} ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArrayValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ArrayValue message. + * @function verify + * @memberof google.firestore.v1beta1.ArrayValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ArrayValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.values != null && Object.hasOwnProperty.call(message, "values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.firestore.v1beta1.Value.verify(message.values[i], long + 1); + if (error) + return "values." + error; + } + } + return null; + }; + + /** + * Creates an ArrayValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.ArrayValue + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.ArrayValue} ArrayValue + */ + ArrayValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.ArrayValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.ArrayValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.ArrayValue(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.firestore.v1beta1.ArrayValue.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (!$util.isObject(object.values[i])) + throw TypeError(".google.firestore.v1beta1.ArrayValue.values: object expected"); + message.values[i] = $root.google.firestore.v1beta1.Value.fromObject(object.values[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from an ArrayValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.ArrayValue + * @static + * @param {google.firestore.v1beta1.ArrayValue} message ArrayValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ArrayValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.firestore.v1beta1.Value.toObject(message.values[j], options, q + 1); + } + return object; + }; + + /** + * Converts this ArrayValue to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.ArrayValue + * @instance + * @returns {Object.} JSON object + */ + ArrayValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ArrayValue + * @function getTypeUrl + * @memberof google.firestore.v1beta1.ArrayValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ArrayValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.ArrayValue"; + }; + + return ArrayValue; + })(); + + v1beta1.MapValue = (function() { + + /** + * Properties of a MapValue. + * @memberof google.firestore.v1beta1 + * @interface IMapValue + * @property {Object.|null} [fields] MapValue fields + */ + + /** + * Constructs a new MapValue. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a MapValue. + * @implements IMapValue + * @constructor + * @param {google.firestore.v1beta1.IMapValue=} [properties] Properties to set + */ + function MapValue(properties) { + this.fields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * MapValue fields. + * @member {Object.} fields + * @memberof google.firestore.v1beta1.MapValue + * @instance + */ + MapValue.prototype.fields = $util.emptyObject; + + /** + * Creates a new MapValue instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.MapValue + * @static + * @param {google.firestore.v1beta1.IMapValue=} [properties] Properties to set + * @returns {google.firestore.v1beta1.MapValue} MapValue instance + */ + MapValue.create = function create(properties) { + return new MapValue(properties); + }; + + /** + * Encodes the specified MapValue message. Does not implicitly {@link google.firestore.v1beta1.MapValue.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.MapValue + * @static + * @param {google.firestore.v1beta1.IMapValue} message MapValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MapValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) + for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.firestore.v1beta1.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified MapValue message, length delimited. Does not implicitly {@link google.firestore.v1beta1.MapValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.MapValue + * @static + * @param {google.firestore.v1beta1.IMapValue} message MapValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MapValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a MapValue message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.MapValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.MapValue} MapValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MapValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.MapValue(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.firestore.v1beta1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.fields, key); + message.fields[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a MapValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.MapValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.MapValue} MapValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MapValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MapValue message. + * @function verify + * @memberof google.firestore.v1beta1.MapValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MapValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { + if (!$util.isObject(message.fields)) + return "fields: object expected"; + var key = Object.keys(message.fields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.firestore.v1beta1.Value.verify(message.fields[key[i]], long + 1); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a MapValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.MapValue + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.MapValue} MapValue + */ + MapValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.MapValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.MapValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.MapValue(); + if (object.fields) { + if (!$util.isObject(object.fields)) + throw TypeError(".google.firestore.v1beta1.MapValue.fields: object expected"); + message.fields = {}; + for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.fields, keys[i]); + if (!$util.isObject(object.fields[keys[i]])) + throw TypeError(".google.firestore.v1beta1.MapValue.fields: object expected"); + message.fields[keys[i]] = $root.google.firestore.v1beta1.Value.fromObject(object.fields[keys[i]], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a MapValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.MapValue + * @static + * @param {google.firestore.v1beta1.MapValue} message MapValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MapValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.fields = {}; + var keys2; + if (message.fields && (keys2 = Object.keys(message.fields)).length) { + object.fields = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.fields, keys2[j]); + object.fields[keys2[j]] = $root.google.firestore.v1beta1.Value.toObject(message.fields[keys2[j]], options, q + 1); + } + } + return object; + }; + + /** + * Converts this MapValue to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.MapValue + * @instance + * @returns {Object.} JSON object + */ + MapValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MapValue + * @function getTypeUrl + * @memberof google.firestore.v1beta1.MapValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MapValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.MapValue"; + }; + + return MapValue; + })(); + + v1beta1.Firestore = (function() { + + /** + * Constructs a new Firestore service. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a Firestore + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Firestore(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Firestore.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Firestore; + + /** + * Creates new Firestore service using the specified rpc implementation. + * @function create + * @memberof google.firestore.v1beta1.Firestore + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Firestore} RPC service. Useful where requests and/or responses are streamed. + */ + Firestore.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|getDocument}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef GetDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.Document} [response] Document + */ + + /** + * Calls GetDocument. + * @function getDocument + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IGetDocumentRequest} request GetDocumentRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.GetDocumentCallback} callback Node-style callback called with the error, if any, and Document + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.getDocument = function getDocument(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getDocument, $root.google.firestore.v1beta1.GetDocumentRequest, $root.google.firestore.v1beta1.Document, request, callback); + }, "name", { value: "GetDocument" }); + + /** + * Calls GetDocument. + * @function getDocument + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IGetDocumentRequest} request GetDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|listDocuments}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef ListDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.ListDocumentsResponse} [response] ListDocumentsResponse + */ + + /** + * Calls ListDocuments. + * @function listDocuments + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IListDocumentsRequest} request ListDocumentsRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.ListDocumentsCallback} callback Node-style callback called with the error, if any, and ListDocumentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.listDocuments = function listDocuments(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listDocuments, $root.google.firestore.v1beta1.ListDocumentsRequest, $root.google.firestore.v1beta1.ListDocumentsResponse, request, callback); + }, "name", { value: "ListDocuments" }); + + /** + * Calls ListDocuments. + * @function listDocuments + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IListDocumentsRequest} request ListDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|updateDocument}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef UpdateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.Document} [response] Document + */ + + /** + * Calls UpdateDocument. + * @function updateDocument + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IUpdateDocumentRequest} request UpdateDocumentRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.UpdateDocumentCallback} callback Node-style callback called with the error, if any, and Document + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.updateDocument = function updateDocument(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, updateDocument, $root.google.firestore.v1beta1.UpdateDocumentRequest, $root.google.firestore.v1beta1.Document, request, callback); + }, "name", { value: "UpdateDocument" }); + + /** + * Calls UpdateDocument. + * @function updateDocument + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IUpdateDocumentRequest} request UpdateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|deleteDocument}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef DeleteDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteDocument. + * @function deleteDocument + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IDeleteDocumentRequest} request DeleteDocumentRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.DeleteDocumentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.deleteDocument = function deleteDocument(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteDocument, $root.google.firestore.v1beta1.DeleteDocumentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteDocument" }); + + /** + * Calls DeleteDocument. + * @function deleteDocument + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IDeleteDocumentRequest} request DeleteDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|batchGetDocuments}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef BatchGetDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.BatchGetDocumentsResponse} [response] BatchGetDocumentsResponse + */ + + /** + * Calls BatchGetDocuments. + * @function batchGetDocuments + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IBatchGetDocumentsRequest} request BatchGetDocumentsRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.BatchGetDocumentsCallback} callback Node-style callback called with the error, if any, and BatchGetDocumentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.batchGetDocuments = function batchGetDocuments(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, batchGetDocuments, $root.google.firestore.v1beta1.BatchGetDocumentsRequest, $root.google.firestore.v1beta1.BatchGetDocumentsResponse, request, callback); + }, "name", { value: "BatchGetDocuments" }); + + /** + * Calls BatchGetDocuments. + * @function batchGetDocuments + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IBatchGetDocumentsRequest} request BatchGetDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|beginTransaction}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef BeginTransactionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.BeginTransactionResponse} [response] BeginTransactionResponse + */ + + /** + * Calls BeginTransaction. + * @function beginTransaction + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IBeginTransactionRequest} request BeginTransactionRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.BeginTransactionCallback} callback Node-style callback called with the error, if any, and BeginTransactionResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.beginTransaction = function beginTransaction(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, beginTransaction, $root.google.firestore.v1beta1.BeginTransactionRequest, $root.google.firestore.v1beta1.BeginTransactionResponse, request, callback); + }, "name", { value: "BeginTransaction" }); + + /** + * Calls BeginTransaction. + * @function beginTransaction + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IBeginTransactionRequest} request BeginTransactionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|commit}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef CommitCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.CommitResponse} [response] CommitResponse + */ + + /** + * Calls Commit. + * @function commit + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.ICommitRequest} request CommitRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.CommitCallback} callback Node-style callback called with the error, if any, and CommitResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.commit = function commit(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, commit, $root.google.firestore.v1beta1.CommitRequest, $root.google.firestore.v1beta1.CommitResponse, request, callback); + }, "name", { value: "Commit" }); + + /** + * Calls Commit. + * @function commit + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.ICommitRequest} request CommitRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|rollback}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef RollbackCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls Rollback. + * @function rollback + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IRollbackRequest} request RollbackRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.RollbackCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.rollback = function rollback(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, rollback, $root.google.firestore.v1beta1.RollbackRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "Rollback" }); + + /** + * Calls Rollback. + * @function rollback + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IRollbackRequest} request RollbackRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|runQuery}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef RunQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.RunQueryResponse} [response] RunQueryResponse + */ + + /** + * Calls RunQuery. + * @function runQuery + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IRunQueryRequest} request RunQueryRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.RunQueryCallback} callback Node-style callback called with the error, if any, and RunQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.runQuery = function runQuery(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, runQuery, $root.google.firestore.v1beta1.RunQueryRequest, $root.google.firestore.v1beta1.RunQueryResponse, request, callback); + }, "name", { value: "RunQuery" }); + + /** + * Calls RunQuery. + * @function runQuery + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IRunQueryRequest} request RunQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|partitionQuery}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef PartitionQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.PartitionQueryResponse} [response] PartitionQueryResponse + */ + + /** + * Calls PartitionQuery. + * @function partitionQuery + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IPartitionQueryRequest} request PartitionQueryRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.PartitionQueryCallback} callback Node-style callback called with the error, if any, and PartitionQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.partitionQuery = function partitionQuery(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, partitionQuery, $root.google.firestore.v1beta1.PartitionQueryRequest, $root.google.firestore.v1beta1.PartitionQueryResponse, request, callback); + }, "name", { value: "PartitionQuery" }); + + /** + * Calls PartitionQuery. + * @function partitionQuery + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IPartitionQueryRequest} request PartitionQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|write}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef WriteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.WriteResponse} [response] WriteResponse + */ + + /** + * Calls Write. + * @function write + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IWriteRequest} request WriteRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.WriteCallback} callback Node-style callback called with the error, if any, and WriteResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.write = function write(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, write, $root.google.firestore.v1beta1.WriteRequest, $root.google.firestore.v1beta1.WriteResponse, request, callback); + }, "name", { value: "Write" }); + + /** + * Calls Write. + * @function write + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IWriteRequest} request WriteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|listen}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef ListenCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.ListenResponse} [response] ListenResponse + */ + + /** + * Calls Listen. + * @function listen + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IListenRequest} request ListenRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.ListenCallback} callback Node-style callback called with the error, if any, and ListenResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.listen = function listen(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listen, $root.google.firestore.v1beta1.ListenRequest, $root.google.firestore.v1beta1.ListenResponse, request, callback); + }, "name", { value: "Listen" }); + + /** + * Calls Listen. + * @function listen + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IListenRequest} request ListenRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|listCollectionIds}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef ListCollectionIdsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.ListCollectionIdsResponse} [response] ListCollectionIdsResponse + */ + + /** + * Calls ListCollectionIds. + * @function listCollectionIds + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IListCollectionIdsRequest} request ListCollectionIdsRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.ListCollectionIdsCallback} callback Node-style callback called with the error, if any, and ListCollectionIdsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.listCollectionIds = function listCollectionIds(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listCollectionIds, $root.google.firestore.v1beta1.ListCollectionIdsRequest, $root.google.firestore.v1beta1.ListCollectionIdsResponse, request, callback); + }, "name", { value: "ListCollectionIds" }); + + /** + * Calls ListCollectionIds. + * @function listCollectionIds + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IListCollectionIdsRequest} request ListCollectionIdsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|batchWrite}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef BatchWriteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.BatchWriteResponse} [response] BatchWriteResponse + */ + + /** + * Calls BatchWrite. + * @function batchWrite + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IBatchWriteRequest} request BatchWriteRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.BatchWriteCallback} callback Node-style callback called with the error, if any, and BatchWriteResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.batchWrite = function batchWrite(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, batchWrite, $root.google.firestore.v1beta1.BatchWriteRequest, $root.google.firestore.v1beta1.BatchWriteResponse, request, callback); + }, "name", { value: "BatchWrite" }); + + /** + * Calls BatchWrite. + * @function batchWrite + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.IBatchWriteRequest} request BatchWriteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.firestore.v1beta1.Firestore|createDocument}. + * @memberof google.firestore.v1beta1.Firestore + * @typedef CreateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.firestore.v1beta1.Document} [response] Document + */ + + /** + * Calls CreateDocument. + * @function createDocument + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.ICreateDocumentRequest} request CreateDocumentRequest message or plain object + * @param {google.firestore.v1beta1.Firestore.CreateDocumentCallback} callback Node-style callback called with the error, if any, and Document + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Firestore.prototype.createDocument = function createDocument(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createDocument, $root.google.firestore.v1beta1.CreateDocumentRequest, $root.google.firestore.v1beta1.Document, request, callback); + }, "name", { value: "CreateDocument" }); + + /** + * Calls CreateDocument. + * @function createDocument + * @memberof google.firestore.v1beta1.Firestore + * @instance + * @param {google.firestore.v1beta1.ICreateDocumentRequest} request CreateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Firestore; + })(); + + v1beta1.GetDocumentRequest = (function() { + + /** + * Properties of a GetDocumentRequest. + * @memberof google.firestore.v1beta1 + * @interface IGetDocumentRequest + * @property {string|null} [name] GetDocumentRequest name + * @property {google.firestore.v1beta1.IDocumentMask|null} [mask] GetDocumentRequest mask + * @property {Uint8Array|null} [transaction] GetDocumentRequest transaction + * @property {google.protobuf.ITimestamp|null} [readTime] GetDocumentRequest readTime + */ + + /** + * Constructs a new GetDocumentRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a GetDocumentRequest. + * @implements IGetDocumentRequest + * @constructor + * @param {google.firestore.v1beta1.IGetDocumentRequest=} [properties] Properties to set + */ + function GetDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDocumentRequest name. + * @member {string} name + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.name = ""; + + /** + * GetDocumentRequest mask. + * @member {google.firestore.v1beta1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.mask = null; + + /** + * GetDocumentRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.transaction = null; + + /** + * GetDocumentRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GetDocumentRequest consistencySelector. + * @member {"transaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @instance + */ + Object.defineProperty(GetDocumentRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GetDocumentRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @static + * @param {google.firestore.v1beta1.IGetDocumentRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.GetDocumentRequest} GetDocumentRequest instance + */ + GetDocumentRequest.create = function create(properties) { + return new GetDocumentRequest(properties); + }; + + /** + * Encodes the specified GetDocumentRequest message. Does not implicitly {@link google.firestore.v1beta1.GetDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @static + * @param {google.firestore.v1beta1.IGetDocumentRequest} message GetDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1beta1.DocumentMask.encode(message.mask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.transaction); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.GetDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @static + * @param {google.firestore.v1beta1.IGetDocumentRequest} message GetDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.GetDocumentRequest} GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.GetDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.mask = $root.google.firestore.v1beta1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.transaction = reader.bytes(); + break; + } + case 5: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.GetDocumentRequest} GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDocumentRequest message. + * @function verify + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDocumentRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1beta1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + return null; + }; + + /** + * Creates a GetDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.GetDocumentRequest} GetDocumentRequest + */ + GetDocumentRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.GetDocumentRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.GetDocumentRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.GetDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1beta1.GetDocumentRequest.mask: object expected"); + message.mask = $root.google.firestore.v1beta1.DocumentMask.fromObject(object.mask, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.GetDocumentRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a GetDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @static + * @param {google.firestore.v1beta1.GetDocumentRequest} message GetDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDocumentRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.mask = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1beta1.DocumentMask.toObject(message.mask, options, q + 1); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + return object; + }; + + /** + * Converts this GetDocumentRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + GetDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetDocumentRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.GetDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.GetDocumentRequest"; + }; + + return GetDocumentRequest; + })(); + + v1beta1.ListDocumentsRequest = (function() { + + /** + * Properties of a ListDocumentsRequest. + * @memberof google.firestore.v1beta1 + * @interface IListDocumentsRequest + * @property {string|null} [parent] ListDocumentsRequest parent + * @property {string|null} [collectionId] ListDocumentsRequest collectionId + * @property {number|null} [pageSize] ListDocumentsRequest pageSize + * @property {string|null} [pageToken] ListDocumentsRequest pageToken + * @property {string|null} [orderBy] ListDocumentsRequest orderBy + * @property {google.firestore.v1beta1.IDocumentMask|null} [mask] ListDocumentsRequest mask + * @property {Uint8Array|null} [transaction] ListDocumentsRequest transaction + * @property {google.protobuf.ITimestamp|null} [readTime] ListDocumentsRequest readTime + * @property {boolean|null} [showMissing] ListDocumentsRequest showMissing + */ + + /** + * Constructs a new ListDocumentsRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a ListDocumentsRequest. + * @implements IListDocumentsRequest + * @constructor + * @param {google.firestore.v1beta1.IListDocumentsRequest=} [properties] Properties to set + */ + function ListDocumentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDocumentsRequest parent. + * @member {string} parent + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.parent = ""; + + /** + * ListDocumentsRequest collectionId. + * @member {string} collectionId + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.collectionId = ""; + + /** + * ListDocumentsRequest pageSize. + * @member {number} pageSize + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.pageSize = 0; + + /** + * ListDocumentsRequest pageToken. + * @member {string} pageToken + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.pageToken = ""; + + /** + * ListDocumentsRequest orderBy. + * @member {string} orderBy + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.orderBy = ""; + + /** + * ListDocumentsRequest mask. + * @member {google.firestore.v1beta1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.mask = null; + + /** + * ListDocumentsRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.transaction = null; + + /** + * ListDocumentsRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.readTime = null; + + /** + * ListDocumentsRequest showMissing. + * @member {boolean} showMissing + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.showMissing = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ListDocumentsRequest consistencySelector. + * @member {"transaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + */ + Object.defineProperty(ListDocumentsRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ListDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @static + * @param {google.firestore.v1beta1.IListDocumentsRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.ListDocumentsRequest} ListDocumentsRequest instance + */ + ListDocumentsRequest.create = function create(properties) { + return new ListDocumentsRequest(properties); + }; + + /** + * Encodes the specified ListDocumentsRequest message. Does not implicitly {@link google.firestore.v1beta1.ListDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @static + * @param {google.firestore.v1beta1.IListDocumentsRequest} message ListDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.collectionId); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1beta1.DocumentMask.encode(message.mask, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.transaction); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 10, wireType 2 =*/82).fork(), q + 1).ldelim(); + if (message.showMissing != null && Object.hasOwnProperty.call(message, "showMissing")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.showMissing); + return writer; + }; + + /** + * Encodes the specified ListDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @static + * @param {google.firestore.v1beta1.IListDocumentsRequest} message ListDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.ListDocumentsRequest} ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.ListDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.collectionId = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 6: { + message.orderBy = reader.string(); + break; + } + case 7: { + message.mask = $root.google.firestore.v1beta1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 8: { + message.transaction = reader.bytes(); + break; + } + case 10: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 12: { + message.showMissing = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.ListDocumentsRequest} ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDocumentsRequest message. + * @function verify + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDocumentsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + if (!$util.isString(message.collectionId)) + return "collectionId: string expected"; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1beta1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + if (message.showMissing != null && Object.hasOwnProperty.call(message, "showMissing")) + if (typeof message.showMissing !== "boolean") + return "showMissing: boolean expected"; + return null; + }; + + /** + * Creates a ListDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.ListDocumentsRequest} ListDocumentsRequest + */ + ListDocumentsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.ListDocumentsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.ListDocumentsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.ListDocumentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.collectionId != null) + message.collectionId = String(object.collectionId); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1beta1.ListDocumentsRequest.mask: object expected"); + message.mask = $root.google.firestore.v1beta1.DocumentMask.fromObject(object.mask, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.ListDocumentsRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.showMissing != null) + message.showMissing = Boolean(object.showMissing); + return message; + }; + + /** + * Creates a plain object from a ListDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @static + * @param {google.firestore.v1beta1.ListDocumentsRequest} message ListDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDocumentsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.collectionId = ""; + object.pageSize = 0; + object.pageToken = ""; + object.orderBy = ""; + object.mask = null; + object.showMissing = false; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + object.collectionId = message.collectionId; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + object.pageToken = message.pageToken; + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + object.orderBy = message.orderBy; + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1beta1.DocumentMask.toObject(message.mask, options, q + 1); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + if (message.showMissing != null && Object.hasOwnProperty.call(message, "showMissing")) + object.showMissing = message.showMissing; + return object; + }; + + /** + * Converts this ListDocumentsRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDocumentsRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.ListDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.ListDocumentsRequest"; + }; + + return ListDocumentsRequest; + })(); + + v1beta1.ListDocumentsResponse = (function() { + + /** + * Properties of a ListDocumentsResponse. + * @memberof google.firestore.v1beta1 + * @interface IListDocumentsResponse + * @property {Array.|null} [documents] ListDocumentsResponse documents + * @property {string|null} [nextPageToken] ListDocumentsResponse nextPageToken + */ + + /** + * Constructs a new ListDocumentsResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a ListDocumentsResponse. + * @implements IListDocumentsResponse + * @constructor + * @param {google.firestore.v1beta1.IListDocumentsResponse=} [properties] Properties to set + */ + function ListDocumentsResponse(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDocumentsResponse documents. + * @member {Array.} documents + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @instance + */ + ListDocumentsResponse.prototype.documents = $util.emptyArray; + + /** + * ListDocumentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @instance + */ + ListDocumentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @static + * @param {google.firestore.v1beta1.IListDocumentsResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.ListDocumentsResponse} ListDocumentsResponse instance + */ + ListDocumentsResponse.create = function create(properties) { + return new ListDocumentsResponse(properties); + }; + + /** + * Encodes the specified ListDocumentsResponse message. Does not implicitly {@link google.firestore.v1beta1.ListDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @static + * @param {google.firestore.v1beta1.IListDocumentsResponse} message ListDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + $root.google.firestore.v1beta1.Document.encode(message.documents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @static + * @param {google.firestore.v1beta1.IListDocumentsResponse} message ListDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.ListDocumentsResponse} ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.ListDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push($root.google.firestore.v1beta1.Document.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.ListDocumentsResponse} ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDocumentsResponse message. + * @function verify + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDocumentsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) { + var error = $root.google.firestore.v1beta1.Document.verify(message.documents[i], long + 1); + if (error) + return "documents." + error; + } + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.ListDocumentsResponse} ListDocumentsResponse + */ + ListDocumentsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.ListDocumentsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.ListDocumentsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.ListDocumentsResponse(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.firestore.v1beta1.ListDocumentsResponse.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) { + if (!$util.isObject(object.documents[i])) + throw TypeError(".google.firestore.v1beta1.ListDocumentsResponse.documents: object expected"); + message.documents[i] = $root.google.firestore.v1beta1.Document.fromObject(object.documents[i], long + 1); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @static + * @param {google.firestore.v1beta1.ListDocumentsResponse} message ListDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDocumentsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = $root.google.firestore.v1beta1.Document.toObject(message.documents[j], options, q + 1); + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListDocumentsResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDocumentsResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.ListDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.ListDocumentsResponse"; + }; + + return ListDocumentsResponse; + })(); + + v1beta1.CreateDocumentRequest = (function() { + + /** + * Properties of a CreateDocumentRequest. + * @memberof google.firestore.v1beta1 + * @interface ICreateDocumentRequest + * @property {string|null} [parent] CreateDocumentRequest parent + * @property {string|null} [collectionId] CreateDocumentRequest collectionId + * @property {string|null} [documentId] CreateDocumentRequest documentId + * @property {google.firestore.v1beta1.IDocument|null} [document] CreateDocumentRequest document + * @property {google.firestore.v1beta1.IDocumentMask|null} [mask] CreateDocumentRequest mask + */ + + /** + * Constructs a new CreateDocumentRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a CreateDocumentRequest. + * @implements ICreateDocumentRequest + * @constructor + * @param {google.firestore.v1beta1.ICreateDocumentRequest=} [properties] Properties to set + */ + function CreateDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateDocumentRequest parent. + * @member {string} parent + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.parent = ""; + + /** + * CreateDocumentRequest collectionId. + * @member {string} collectionId + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.collectionId = ""; + + /** + * CreateDocumentRequest documentId. + * @member {string} documentId + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.documentId = ""; + + /** + * CreateDocumentRequest document. + * @member {google.firestore.v1beta1.IDocument|null|undefined} document + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.document = null; + + /** + * CreateDocumentRequest mask. + * @member {google.firestore.v1beta1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.mask = null; + + /** + * Creates a new CreateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @static + * @param {google.firestore.v1beta1.ICreateDocumentRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.CreateDocumentRequest} CreateDocumentRequest instance + */ + CreateDocumentRequest.create = function create(properties) { + return new CreateDocumentRequest(properties); + }; + + /** + * Encodes the specified CreateDocumentRequest message. Does not implicitly {@link google.firestore.v1beta1.CreateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @static + * @param {google.firestore.v1beta1.ICreateDocumentRequest} message CreateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDocumentRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.collectionId); + if (message.documentId != null && Object.hasOwnProperty.call(message, "documentId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentId); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.firestore.v1beta1.Document.encode(message.document, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1beta1.DocumentMask.encode(message.mask, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.CreateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @static + * @param {google.firestore.v1beta1.ICreateDocumentRequest} message CreateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.CreateDocumentRequest} CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDocumentRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.CreateDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.collectionId = reader.string(); + break; + } + case 3: { + message.documentId = reader.string(); + break; + } + case 4: { + message.document = $root.google.firestore.v1beta1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.mask = $root.google.firestore.v1beta1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.CreateDocumentRequest} CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateDocumentRequest message. + * @function verify + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateDocumentRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + if (!$util.isString(message.collectionId)) + return "collectionId: string expected"; + if (message.documentId != null && Object.hasOwnProperty.call(message, "documentId")) + if (!$util.isString(message.documentId)) + return "documentId: string expected"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) { + var error = $root.google.firestore.v1beta1.Document.verify(message.document, long + 1); + if (error) + return "document." + error; + } + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1beta1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + return null; + }; + + /** + * Creates a CreateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.CreateDocumentRequest} CreateDocumentRequest + */ + CreateDocumentRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.CreateDocumentRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.CreateDocumentRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.CreateDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.collectionId != null) + message.collectionId = String(object.collectionId); + if (object.documentId != null) + message.documentId = String(object.documentId); + if (object.document != null) { + if (!$util.isObject(object.document)) + throw TypeError(".google.firestore.v1beta1.CreateDocumentRequest.document: object expected"); + message.document = $root.google.firestore.v1beta1.Document.fromObject(object.document, long + 1); + } + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1beta1.CreateDocumentRequest.mask: object expected"); + message.mask = $root.google.firestore.v1beta1.DocumentMask.fromObject(object.mask, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a CreateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @static + * @param {google.firestore.v1beta1.CreateDocumentRequest} message CreateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateDocumentRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.collectionId = ""; + object.documentId = ""; + object.document = null; + object.mask = null; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + object.collectionId = message.collectionId; + if (message.documentId != null && Object.hasOwnProperty.call(message, "documentId")) + object.documentId = message.documentId; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = $root.google.firestore.v1beta1.Document.toObject(message.document, options, q + 1); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1beta1.DocumentMask.toObject(message.mask, options, q + 1); + return object; + }; + + /** + * Converts this CreateDocumentRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateDocumentRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.CreateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.CreateDocumentRequest"; + }; + + return CreateDocumentRequest; + })(); + + v1beta1.UpdateDocumentRequest = (function() { + + /** + * Properties of an UpdateDocumentRequest. + * @memberof google.firestore.v1beta1 + * @interface IUpdateDocumentRequest + * @property {google.firestore.v1beta1.IDocument|null} [document] UpdateDocumentRequest document + * @property {google.firestore.v1beta1.IDocumentMask|null} [updateMask] UpdateDocumentRequest updateMask + * @property {google.firestore.v1beta1.IDocumentMask|null} [mask] UpdateDocumentRequest mask + * @property {google.firestore.v1beta1.IPrecondition|null} [currentDocument] UpdateDocumentRequest currentDocument + */ + + /** + * Constructs a new UpdateDocumentRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents an UpdateDocumentRequest. + * @implements IUpdateDocumentRequest + * @constructor + * @param {google.firestore.v1beta1.IUpdateDocumentRequest=} [properties] Properties to set + */ + function UpdateDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateDocumentRequest document. + * @member {google.firestore.v1beta1.IDocument|null|undefined} document + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.document = null; + + /** + * UpdateDocumentRequest updateMask. + * @member {google.firestore.v1beta1.IDocumentMask|null|undefined} updateMask + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.updateMask = null; + + /** + * UpdateDocumentRequest mask. + * @member {google.firestore.v1beta1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.mask = null; + + /** + * UpdateDocumentRequest currentDocument. + * @member {google.firestore.v1beta1.IPrecondition|null|undefined} currentDocument + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.currentDocument = null; + + /** + * Creates a new UpdateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @static + * @param {google.firestore.v1beta1.IUpdateDocumentRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.UpdateDocumentRequest} UpdateDocumentRequest instance + */ + UpdateDocumentRequest.create = function create(properties) { + return new UpdateDocumentRequest(properties); + }; + + /** + * Encodes the specified UpdateDocumentRequest message. Does not implicitly {@link google.firestore.v1beta1.UpdateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @static + * @param {google.firestore.v1beta1.IUpdateDocumentRequest} message UpdateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDocumentRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.firestore.v1beta1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.firestore.v1beta1.DocumentMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1beta1.DocumentMask.encode(message.mask, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + $root.google.firestore.v1beta1.Precondition.encode(message.currentDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.UpdateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @static + * @param {google.firestore.v1beta1.IUpdateDocumentRequest} message UpdateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.UpdateDocumentRequest} UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDocumentRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.UpdateDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = $root.google.firestore.v1beta1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.updateMask = $root.google.firestore.v1beta1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.mask = $root.google.firestore.v1beta1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.currentDocument = $root.google.firestore.v1beta1.Precondition.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.UpdateDocumentRequest} UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateDocumentRequest message. + * @function verify + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateDocumentRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) { + var error = $root.google.firestore.v1beta1.Document.verify(message.document, long + 1); + if (error) + return "document." + error; + } + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { + var error = $root.google.firestore.v1beta1.DocumentMask.verify(message.updateMask, long + 1); + if (error) + return "updateMask." + error; + } + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1beta1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) { + var error = $root.google.firestore.v1beta1.Precondition.verify(message.currentDocument, long + 1); + if (error) + return "currentDocument." + error; + } + return null; + }; + + /** + * Creates an UpdateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.UpdateDocumentRequest} UpdateDocumentRequest + */ + UpdateDocumentRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.UpdateDocumentRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.UpdateDocumentRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.UpdateDocumentRequest(); + if (object.document != null) { + if (!$util.isObject(object.document)) + throw TypeError(".google.firestore.v1beta1.UpdateDocumentRequest.document: object expected"); + message.document = $root.google.firestore.v1beta1.Document.fromObject(object.document, long + 1); + } + if (object.updateMask != null) { + if (!$util.isObject(object.updateMask)) + throw TypeError(".google.firestore.v1beta1.UpdateDocumentRequest.updateMask: object expected"); + message.updateMask = $root.google.firestore.v1beta1.DocumentMask.fromObject(object.updateMask, long + 1); + } + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1beta1.UpdateDocumentRequest.mask: object expected"); + message.mask = $root.google.firestore.v1beta1.DocumentMask.fromObject(object.mask, long + 1); + } + if (object.currentDocument != null) { + if (!$util.isObject(object.currentDocument)) + throw TypeError(".google.firestore.v1beta1.UpdateDocumentRequest.currentDocument: object expected"); + message.currentDocument = $root.google.firestore.v1beta1.Precondition.fromObject(object.currentDocument, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an UpdateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @static + * @param {google.firestore.v1beta1.UpdateDocumentRequest} message UpdateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateDocumentRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.document = null; + object.updateMask = null; + object.mask = null; + object.currentDocument = null; + } + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = $root.google.firestore.v1beta1.Document.toObject(message.document, options, q + 1); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.firestore.v1beta1.DocumentMask.toObject(message.updateMask, options, q + 1); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1beta1.DocumentMask.toObject(message.mask, options, q + 1); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + object.currentDocument = $root.google.firestore.v1beta1.Precondition.toObject(message.currentDocument, options, q + 1); + return object; + }; + + /** + * Converts this UpdateDocumentRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateDocumentRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.UpdateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.UpdateDocumentRequest"; + }; + + return UpdateDocumentRequest; + })(); + + v1beta1.DeleteDocumentRequest = (function() { + + /** + * Properties of a DeleteDocumentRequest. + * @memberof google.firestore.v1beta1 + * @interface IDeleteDocumentRequest + * @property {string|null} [name] DeleteDocumentRequest name + * @property {google.firestore.v1beta1.IPrecondition|null} [currentDocument] DeleteDocumentRequest currentDocument + */ + + /** + * Constructs a new DeleteDocumentRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a DeleteDocumentRequest. + * @implements IDeleteDocumentRequest + * @constructor + * @param {google.firestore.v1beta1.IDeleteDocumentRequest=} [properties] Properties to set + */ + function DeleteDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteDocumentRequest name. + * @member {string} name + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @instance + */ + DeleteDocumentRequest.prototype.name = ""; + + /** + * DeleteDocumentRequest currentDocument. + * @member {google.firestore.v1beta1.IPrecondition|null|undefined} currentDocument + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @instance + */ + DeleteDocumentRequest.prototype.currentDocument = null; + + /** + * Creates a new DeleteDocumentRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @static + * @param {google.firestore.v1beta1.IDeleteDocumentRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.DeleteDocumentRequest} DeleteDocumentRequest instance + */ + DeleteDocumentRequest.create = function create(properties) { + return new DeleteDocumentRequest(properties); + }; + + /** + * Encodes the specified DeleteDocumentRequest message. Does not implicitly {@link google.firestore.v1beta1.DeleteDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @static + * @param {google.firestore.v1beta1.IDeleteDocumentRequest} message DeleteDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDocumentRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + $root.google.firestore.v1beta1.Precondition.encode(message.currentDocument, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteDocumentRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DeleteDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @static + * @param {google.firestore.v1beta1.IDeleteDocumentRequest} message DeleteDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.DeleteDocumentRequest} DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDocumentRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.DeleteDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.currentDocument = $root.google.firestore.v1beta1.Precondition.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.DeleteDocumentRequest} DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteDocumentRequest message. + * @function verify + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteDocumentRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) { + var error = $root.google.firestore.v1beta1.Precondition.verify(message.currentDocument, long + 1); + if (error) + return "currentDocument." + error; + } + return null; + }; + + /** + * Creates a DeleteDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.DeleteDocumentRequest} DeleteDocumentRequest + */ + DeleteDocumentRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.DeleteDocumentRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.DeleteDocumentRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.DeleteDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.currentDocument != null) { + if (!$util.isObject(object.currentDocument)) + throw TypeError(".google.firestore.v1beta1.DeleteDocumentRequest.currentDocument: object expected"); + message.currentDocument = $root.google.firestore.v1beta1.Precondition.fromObject(object.currentDocument, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a DeleteDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @static + * @param {google.firestore.v1beta1.DeleteDocumentRequest} message DeleteDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteDocumentRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.currentDocument = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + object.currentDocument = $root.google.firestore.v1beta1.Precondition.toObject(message.currentDocument, options, q + 1); + return object; + }; + + /** + * Converts this DeleteDocumentRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteDocumentRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.DeleteDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.DeleteDocumentRequest"; + }; + + return DeleteDocumentRequest; + })(); + + v1beta1.BatchGetDocumentsRequest = (function() { + + /** + * Properties of a BatchGetDocumentsRequest. + * @memberof google.firestore.v1beta1 + * @interface IBatchGetDocumentsRequest + * @property {string|null} [database] BatchGetDocumentsRequest database + * @property {Array.|null} [documents] BatchGetDocumentsRequest documents + * @property {google.firestore.v1beta1.IDocumentMask|null} [mask] BatchGetDocumentsRequest mask + * @property {Uint8Array|null} [transaction] BatchGetDocumentsRequest transaction + * @property {google.firestore.v1beta1.ITransactionOptions|null} [newTransaction] BatchGetDocumentsRequest newTransaction + * @property {google.protobuf.ITimestamp|null} [readTime] BatchGetDocumentsRequest readTime + */ + + /** + * Constructs a new BatchGetDocumentsRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a BatchGetDocumentsRequest. + * @implements IBatchGetDocumentsRequest + * @constructor + * @param {google.firestore.v1beta1.IBatchGetDocumentsRequest=} [properties] Properties to set + */ + function BatchGetDocumentsRequest(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchGetDocumentsRequest database. + * @member {string} database + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.database = ""; + + /** + * BatchGetDocumentsRequest documents. + * @member {Array.} documents + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.documents = $util.emptyArray; + + /** + * BatchGetDocumentsRequest mask. + * @member {google.firestore.v1beta1.IDocumentMask|null|undefined} mask + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.mask = null; + + /** + * BatchGetDocumentsRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.transaction = null; + + /** + * BatchGetDocumentsRequest newTransaction. + * @member {google.firestore.v1beta1.ITransactionOptions|null|undefined} newTransaction + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.newTransaction = null; + + /** + * BatchGetDocumentsRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @instance + */ + BatchGetDocumentsRequest.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchGetDocumentsRequest consistencySelector. + * @member {"transaction"|"newTransaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @instance + */ + Object.defineProperty(BatchGetDocumentsRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "newTransaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchGetDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @static + * @param {google.firestore.v1beta1.IBatchGetDocumentsRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.BatchGetDocumentsRequest} BatchGetDocumentsRequest instance + */ + BatchGetDocumentsRequest.create = function create(properties) { + return new BatchGetDocumentsRequest(properties); + }; + + /** + * Encodes the specified BatchGetDocumentsRequest message. Does not implicitly {@link google.firestore.v1beta1.BatchGetDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @static + * @param {google.firestore.v1beta1.IBatchGetDocumentsRequest} message BatchGetDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetDocumentsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documents[i]); + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + $root.google.firestore.v1beta1.DocumentMask.encode(message.mask, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.transaction); + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) + $root.google.firestore.v1beta1.TransactionOptions.encode(message.newTransaction, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchGetDocumentsRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BatchGetDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @static + * @param {google.firestore.v1beta1.IBatchGetDocumentsRequest} message BatchGetDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BatchGetDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.BatchGetDocumentsRequest} BatchGetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetDocumentsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.BatchGetDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push(reader.string()); + break; + } + case 3: { + message.mask = $root.google.firestore.v1beta1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.transaction = reader.bytes(); + break; + } + case 5: { + message.newTransaction = $root.google.firestore.v1beta1.TransactionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BatchGetDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.BatchGetDocumentsRequest} BatchGetDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchGetDocumentsRequest message. + * @function verify + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchGetDocumentsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) + if (!$util.isString(message.documents[i])) + return "documents: string[] expected"; + } + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) { + var error = $root.google.firestore.v1beta1.DocumentMask.verify(message.mask, long + 1); + if (error) + return "mask." + error; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.firestore.v1beta1.TransactionOptions.verify(message.newTransaction, long + 1); + if (error) + return "newTransaction." + error; + } + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + return null; + }; + + /** + * Creates a BatchGetDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.BatchGetDocumentsRequest} BatchGetDocumentsRequest + */ + BatchGetDocumentsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.BatchGetDocumentsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.BatchGetDocumentsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.BatchGetDocumentsRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.firestore.v1beta1.BatchGetDocumentsRequest.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) + message.documents[i] = String(object.documents[i]); + } + if (object.mask != null) { + if (!$util.isObject(object.mask)) + throw TypeError(".google.firestore.v1beta1.BatchGetDocumentsRequest.mask: object expected"); + message.mask = $root.google.firestore.v1beta1.DocumentMask.fromObject(object.mask, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.newTransaction != null) { + if (!$util.isObject(object.newTransaction)) + throw TypeError(".google.firestore.v1beta1.BatchGetDocumentsRequest.newTransaction: object expected"); + message.newTransaction = $root.google.firestore.v1beta1.TransactionOptions.fromObject(object.newTransaction, long + 1); + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.BatchGetDocumentsRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a BatchGetDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @static + * @param {google.firestore.v1beta1.BatchGetDocumentsRequest} message BatchGetDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchGetDocumentsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (options.defaults) { + object.database = ""; + object.mask = null; + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = message.documents[j]; + } + if (message.mask != null && Object.hasOwnProperty.call(message, "mask")) + object.mask = $root.google.firestore.v1beta1.DocumentMask.toObject(message.mask, options, q + 1); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + object.newTransaction = $root.google.firestore.v1beta1.TransactionOptions.toObject(message.newTransaction, options, q + 1); + if (options.oneofs) + object.consistencySelector = "newTransaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + return object; + }; + + /** + * Converts this BatchGetDocumentsRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + BatchGetDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchGetDocumentsRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.BatchGetDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchGetDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.BatchGetDocumentsRequest"; + }; + + return BatchGetDocumentsRequest; + })(); + + v1beta1.BatchGetDocumentsResponse = (function() { + + /** + * Properties of a BatchGetDocumentsResponse. + * @memberof google.firestore.v1beta1 + * @interface IBatchGetDocumentsResponse + * @property {google.firestore.v1beta1.IDocument|null} [found] BatchGetDocumentsResponse found + * @property {string|null} [missing] BatchGetDocumentsResponse missing + * @property {Uint8Array|null} [transaction] BatchGetDocumentsResponse transaction + * @property {google.protobuf.ITimestamp|null} [readTime] BatchGetDocumentsResponse readTime + */ + + /** + * Constructs a new BatchGetDocumentsResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a BatchGetDocumentsResponse. + * @implements IBatchGetDocumentsResponse + * @constructor + * @param {google.firestore.v1beta1.IBatchGetDocumentsResponse=} [properties] Properties to set + */ + function BatchGetDocumentsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchGetDocumentsResponse found. + * @member {google.firestore.v1beta1.IDocument|null|undefined} found + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @instance + */ + BatchGetDocumentsResponse.prototype.found = null; + + /** + * BatchGetDocumentsResponse missing. + * @member {string|null|undefined} missing + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @instance + */ + BatchGetDocumentsResponse.prototype.missing = null; + + /** + * BatchGetDocumentsResponse transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @instance + */ + BatchGetDocumentsResponse.prototype.transaction = $util.newBuffer([]); + + /** + * BatchGetDocumentsResponse readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @instance + */ + BatchGetDocumentsResponse.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchGetDocumentsResponse result. + * @member {"found"|"missing"|undefined} result + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @instance + */ + Object.defineProperty(BatchGetDocumentsResponse.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["found", "missing"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchGetDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @static + * @param {google.firestore.v1beta1.IBatchGetDocumentsResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.BatchGetDocumentsResponse} BatchGetDocumentsResponse instance + */ + BatchGetDocumentsResponse.create = function create(properties) { + return new BatchGetDocumentsResponse(properties); + }; + + /** + * Encodes the specified BatchGetDocumentsResponse message. Does not implicitly {@link google.firestore.v1beta1.BatchGetDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @static + * @param {google.firestore.v1beta1.IBatchGetDocumentsResponse} message BatchGetDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetDocumentsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.found != null && Object.hasOwnProperty.call(message, "found")) + $root.google.firestore.v1beta1.Document.encode(message.found, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.missing != null && Object.hasOwnProperty.call(message, "missing")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.missing); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.transaction); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchGetDocumentsResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BatchGetDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @static + * @param {google.firestore.v1beta1.IBatchGetDocumentsResponse} message BatchGetDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BatchGetDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.BatchGetDocumentsResponse} BatchGetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetDocumentsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.BatchGetDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.found = $root.google.firestore.v1beta1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.missing = reader.string(); + break; + } + case 3: { + message.transaction = reader.bytes(); + break; + } + case 4: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BatchGetDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.BatchGetDocumentsResponse} BatchGetDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchGetDocumentsResponse message. + * @function verify + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchGetDocumentsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.found != null && Object.hasOwnProperty.call(message, "found")) { + properties.result = 1; + { + var error = $root.google.firestore.v1beta1.Document.verify(message.found, long + 1); + if (error) + return "found." + error; + } + } + if (message.missing != null && Object.hasOwnProperty.call(message, "missing")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + if (!$util.isString(message.missing)) + return "missing: string expected"; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a BatchGetDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.BatchGetDocumentsResponse} BatchGetDocumentsResponse + */ + BatchGetDocumentsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.BatchGetDocumentsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.BatchGetDocumentsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.BatchGetDocumentsResponse(); + if (object.found != null) { + if (!$util.isObject(object.found)) + throw TypeError(".google.firestore.v1beta1.BatchGetDocumentsResponse.found: object expected"); + message.found = $root.google.firestore.v1beta1.Document.fromObject(object.found, long + 1); + } + if (object.missing != null) + message.missing = String(object.missing); + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.BatchGetDocumentsResponse.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a BatchGetDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @static + * @param {google.firestore.v1beta1.BatchGetDocumentsResponse} message BatchGetDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchGetDocumentsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + object.readTime = null; + } + if (message.found != null && Object.hasOwnProperty.call(message, "found")) { + object.found = $root.google.firestore.v1beta1.Document.toObject(message.found, options, q + 1); + if (options.oneofs) + object.result = "found"; + } + if (message.missing != null && Object.hasOwnProperty.call(message, "missing")) { + object.missing = message.missing; + if (options.oneofs) + object.result = "missing"; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + return object; + }; + + /** + * Converts this BatchGetDocumentsResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + BatchGetDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchGetDocumentsResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.BatchGetDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchGetDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.BatchGetDocumentsResponse"; + }; + + return BatchGetDocumentsResponse; + })(); + + v1beta1.BeginTransactionRequest = (function() { + + /** + * Properties of a BeginTransactionRequest. + * @memberof google.firestore.v1beta1 + * @interface IBeginTransactionRequest + * @property {string|null} [database] BeginTransactionRequest database + * @property {google.firestore.v1beta1.ITransactionOptions|null} [options] BeginTransactionRequest options + */ + + /** + * Constructs a new BeginTransactionRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a BeginTransactionRequest. + * @implements IBeginTransactionRequest + * @constructor + * @param {google.firestore.v1beta1.IBeginTransactionRequest=} [properties] Properties to set + */ + function BeginTransactionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BeginTransactionRequest database. + * @member {string} database + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @instance + */ + BeginTransactionRequest.prototype.database = ""; + + /** + * BeginTransactionRequest options. + * @member {google.firestore.v1beta1.ITransactionOptions|null|undefined} options + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @instance + */ + BeginTransactionRequest.prototype.options = null; + + /** + * Creates a new BeginTransactionRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @static + * @param {google.firestore.v1beta1.IBeginTransactionRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.BeginTransactionRequest} BeginTransactionRequest instance + */ + BeginTransactionRequest.create = function create(properties) { + return new BeginTransactionRequest(properties); + }; + + /** + * Encodes the specified BeginTransactionRequest message. Does not implicitly {@link google.firestore.v1beta1.BeginTransactionRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @static + * @param {google.firestore.v1beta1.IBeginTransactionRequest} message BeginTransactionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BeginTransactionRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.firestore.v1beta1.TransactionOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BeginTransactionRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BeginTransactionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @static + * @param {google.firestore.v1beta1.IBeginTransactionRequest} message BeginTransactionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BeginTransactionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BeginTransactionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.BeginTransactionRequest} BeginTransactionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BeginTransactionRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.BeginTransactionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.options = $root.google.firestore.v1beta1.TransactionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BeginTransactionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.BeginTransactionRequest} BeginTransactionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BeginTransactionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BeginTransactionRequest message. + * @function verify + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BeginTransactionRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.firestore.v1beta1.TransactionOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a BeginTransactionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.BeginTransactionRequest} BeginTransactionRequest + */ + BeginTransactionRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.BeginTransactionRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.BeginTransactionRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.BeginTransactionRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.firestore.v1beta1.BeginTransactionRequest.options: object expected"); + message.options = $root.google.firestore.v1beta1.TransactionOptions.fromObject(object.options, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a BeginTransactionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @static + * @param {google.firestore.v1beta1.BeginTransactionRequest} message BeginTransactionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BeginTransactionRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.database = ""; + object.options = null; + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.firestore.v1beta1.TransactionOptions.toObject(message.options, options, q + 1); + return object; + }; + + /** + * Converts this BeginTransactionRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @instance + * @returns {Object.} JSON object + */ + BeginTransactionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BeginTransactionRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.BeginTransactionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BeginTransactionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.BeginTransactionRequest"; + }; + + return BeginTransactionRequest; + })(); + + v1beta1.BeginTransactionResponse = (function() { + + /** + * Properties of a BeginTransactionResponse. + * @memberof google.firestore.v1beta1 + * @interface IBeginTransactionResponse + * @property {Uint8Array|null} [transaction] BeginTransactionResponse transaction + */ + + /** + * Constructs a new BeginTransactionResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a BeginTransactionResponse. + * @implements IBeginTransactionResponse + * @constructor + * @param {google.firestore.v1beta1.IBeginTransactionResponse=} [properties] Properties to set + */ + function BeginTransactionResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BeginTransactionResponse transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @instance + */ + BeginTransactionResponse.prototype.transaction = $util.newBuffer([]); + + /** + * Creates a new BeginTransactionResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @static + * @param {google.firestore.v1beta1.IBeginTransactionResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.BeginTransactionResponse} BeginTransactionResponse instance + */ + BeginTransactionResponse.create = function create(properties) { + return new BeginTransactionResponse(properties); + }; + + /** + * Encodes the specified BeginTransactionResponse message. Does not implicitly {@link google.firestore.v1beta1.BeginTransactionResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @static + * @param {google.firestore.v1beta1.IBeginTransactionResponse} message BeginTransactionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BeginTransactionResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.transaction); + return writer; + }; + + /** + * Encodes the specified BeginTransactionResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BeginTransactionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @static + * @param {google.firestore.v1beta1.IBeginTransactionResponse} message BeginTransactionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BeginTransactionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BeginTransactionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.BeginTransactionResponse} BeginTransactionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BeginTransactionResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.BeginTransactionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.transaction = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BeginTransactionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.BeginTransactionResponse} BeginTransactionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BeginTransactionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BeginTransactionResponse message. + * @function verify + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BeginTransactionResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + return null; + }; + + /** + * Creates a BeginTransactionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.BeginTransactionResponse} BeginTransactionResponse + */ + BeginTransactionResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.BeginTransactionResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.BeginTransactionResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.BeginTransactionResponse(); + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + return message; + }; + + /** + * Creates a plain object from a BeginTransactionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @static + * @param {google.firestore.v1beta1.BeginTransactionResponse} message BeginTransactionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BeginTransactionResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + return object; + }; + + /** + * Converts this BeginTransactionResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @instance + * @returns {Object.} JSON object + */ + BeginTransactionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BeginTransactionResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.BeginTransactionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BeginTransactionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.BeginTransactionResponse"; + }; + + return BeginTransactionResponse; + })(); + + v1beta1.CommitRequest = (function() { + + /** + * Properties of a CommitRequest. + * @memberof google.firestore.v1beta1 + * @interface ICommitRequest + * @property {string|null} [database] CommitRequest database + * @property {Array.|null} [writes] CommitRequest writes + * @property {Uint8Array|null} [transaction] CommitRequest transaction + */ + + /** + * Constructs a new CommitRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a CommitRequest. + * @implements ICommitRequest + * @constructor + * @param {google.firestore.v1beta1.ICommitRequest=} [properties] Properties to set + */ + function CommitRequest(properties) { + this.writes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommitRequest database. + * @member {string} database + * @memberof google.firestore.v1beta1.CommitRequest + * @instance + */ + CommitRequest.prototype.database = ""; + + /** + * CommitRequest writes. + * @member {Array.} writes + * @memberof google.firestore.v1beta1.CommitRequest + * @instance + */ + CommitRequest.prototype.writes = $util.emptyArray; + + /** + * CommitRequest transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1beta1.CommitRequest + * @instance + */ + CommitRequest.prototype.transaction = $util.newBuffer([]); + + /** + * Creates a new CommitRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.CommitRequest + * @static + * @param {google.firestore.v1beta1.ICommitRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.CommitRequest} CommitRequest instance + */ + CommitRequest.create = function create(properties) { + return new CommitRequest(properties); + }; + + /** + * Encodes the specified CommitRequest message. Does not implicitly {@link google.firestore.v1beta1.CommitRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.CommitRequest + * @static + * @param {google.firestore.v1beta1.ICommitRequest} message CommitRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.writes != null && message.writes.length) + for (var i = 0; i < message.writes.length; ++i) + $root.google.firestore.v1beta1.Write.encode(message.writes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.transaction); + return writer; + }; + + /** + * Encodes the specified CommitRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.CommitRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.CommitRequest + * @static + * @param {google.firestore.v1beta1.ICommitRequest} message CommitRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CommitRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.CommitRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.CommitRequest} CommitRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.CommitRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + if (!(message.writes && message.writes.length)) + message.writes = []; + message.writes.push($root.google.firestore.v1beta1.Write.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + message.transaction = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CommitRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.CommitRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.CommitRequest} CommitRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommitRequest message. + * @function verify + * @memberof google.firestore.v1beta1.CommitRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommitRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.writes != null && Object.hasOwnProperty.call(message, "writes")) { + if (!Array.isArray(message.writes)) + return "writes: array expected"; + for (var i = 0; i < message.writes.length; ++i) { + var error = $root.google.firestore.v1beta1.Write.verify(message.writes[i], long + 1); + if (error) + return "writes." + error; + } + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + return null; + }; + + /** + * Creates a CommitRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.CommitRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.CommitRequest} CommitRequest + */ + CommitRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.CommitRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.CommitRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.CommitRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.writes) { + if (!Array.isArray(object.writes)) + throw TypeError(".google.firestore.v1beta1.CommitRequest.writes: array expected"); + message.writes = []; + for (var i = 0; i < object.writes.length; ++i) { + if (!$util.isObject(object.writes[i])) + throw TypeError(".google.firestore.v1beta1.CommitRequest.writes: object expected"); + message.writes[i] = $root.google.firestore.v1beta1.Write.fromObject(object.writes[i], long + 1); + } + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + return message; + }; + + /** + * Creates a plain object from a CommitRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.CommitRequest + * @static + * @param {google.firestore.v1beta1.CommitRequest} message CommitRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommitRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writes = []; + if (options.defaults) { + object.database = ""; + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.writes && message.writes.length) { + object.writes = []; + for (var j = 0; j < message.writes.length; ++j) + object.writes[j] = $root.google.firestore.v1beta1.Write.toObject(message.writes[j], options, q + 1); + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + return object; + }; + + /** + * Converts this CommitRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.CommitRequest + * @instance + * @returns {Object.} JSON object + */ + CommitRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CommitRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.CommitRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CommitRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.CommitRequest"; + }; + + return CommitRequest; + })(); + + v1beta1.CommitResponse = (function() { + + /** + * Properties of a CommitResponse. + * @memberof google.firestore.v1beta1 + * @interface ICommitResponse + * @property {Array.|null} [writeResults] CommitResponse writeResults + * @property {google.protobuf.ITimestamp|null} [commitTime] CommitResponse commitTime + */ + + /** + * Constructs a new CommitResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a CommitResponse. + * @implements ICommitResponse + * @constructor + * @param {google.firestore.v1beta1.ICommitResponse=} [properties] Properties to set + */ + function CommitResponse(properties) { + this.writeResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommitResponse writeResults. + * @member {Array.} writeResults + * @memberof google.firestore.v1beta1.CommitResponse + * @instance + */ + CommitResponse.prototype.writeResults = $util.emptyArray; + + /** + * CommitResponse commitTime. + * @member {google.protobuf.ITimestamp|null|undefined} commitTime + * @memberof google.firestore.v1beta1.CommitResponse + * @instance + */ + CommitResponse.prototype.commitTime = null; + + /** + * Creates a new CommitResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.CommitResponse + * @static + * @param {google.firestore.v1beta1.ICommitResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.CommitResponse} CommitResponse instance + */ + CommitResponse.create = function create(properties) { + return new CommitResponse(properties); + }; + + /** + * Encodes the specified CommitResponse message. Does not implicitly {@link google.firestore.v1beta1.CommitResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.CommitResponse + * @static + * @param {google.firestore.v1beta1.ICommitResponse} message CommitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.writeResults != null && message.writeResults.length) + for (var i = 0; i < message.writeResults.length; ++i) + $root.google.firestore.v1beta1.WriteResult.encode(message.writeResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) + $root.google.protobuf.Timestamp.encode(message.commitTime, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommitResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.CommitResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.CommitResponse + * @static + * @param {google.firestore.v1beta1.ICommitResponse} message CommitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CommitResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.CommitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.CommitResponse} CommitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.CommitResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.writeResults && message.writeResults.length)) + message.writeResults = []; + message.writeResults.push($root.google.firestore.v1beta1.WriteResult.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.commitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CommitResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.CommitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.CommitResponse} CommitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommitResponse message. + * @function verify + * @memberof google.firestore.v1beta1.CommitResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommitResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.writeResults != null && Object.hasOwnProperty.call(message, "writeResults")) { + if (!Array.isArray(message.writeResults)) + return "writeResults: array expected"; + for (var i = 0; i < message.writeResults.length; ++i) { + var error = $root.google.firestore.v1beta1.WriteResult.verify(message.writeResults[i], long + 1); + if (error) + return "writeResults." + error; + } + } + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.commitTime, long + 1); + if (error) + return "commitTime." + error; + } + return null; + }; + + /** + * Creates a CommitResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.CommitResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.CommitResponse} CommitResponse + */ + CommitResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.CommitResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.CommitResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.CommitResponse(); + if (object.writeResults) { + if (!Array.isArray(object.writeResults)) + throw TypeError(".google.firestore.v1beta1.CommitResponse.writeResults: array expected"); + message.writeResults = []; + for (var i = 0; i < object.writeResults.length; ++i) { + if (!$util.isObject(object.writeResults[i])) + throw TypeError(".google.firestore.v1beta1.CommitResponse.writeResults: object expected"); + message.writeResults[i] = $root.google.firestore.v1beta1.WriteResult.fromObject(object.writeResults[i], long + 1); + } + } + if (object.commitTime != null) { + if (!$util.isObject(object.commitTime)) + throw TypeError(".google.firestore.v1beta1.CommitResponse.commitTime: object expected"); + message.commitTime = $root.google.protobuf.Timestamp.fromObject(object.commitTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a CommitResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.CommitResponse + * @static + * @param {google.firestore.v1beta1.CommitResponse} message CommitResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommitResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writeResults = []; + if (options.defaults) + object.commitTime = null; + if (message.writeResults && message.writeResults.length) { + object.writeResults = []; + for (var j = 0; j < message.writeResults.length; ++j) + object.writeResults[j] = $root.google.firestore.v1beta1.WriteResult.toObject(message.writeResults[j], options, q + 1); + } + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) + object.commitTime = $root.google.protobuf.Timestamp.toObject(message.commitTime, options, q + 1); + return object; + }; + + /** + * Converts this CommitResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.CommitResponse + * @instance + * @returns {Object.} JSON object + */ + CommitResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CommitResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.CommitResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CommitResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.CommitResponse"; + }; + + return CommitResponse; + })(); + + v1beta1.RollbackRequest = (function() { + + /** + * Properties of a RollbackRequest. + * @memberof google.firestore.v1beta1 + * @interface IRollbackRequest + * @property {string|null} [database] RollbackRequest database + * @property {Uint8Array|null} [transaction] RollbackRequest transaction + */ + + /** + * Constructs a new RollbackRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a RollbackRequest. + * @implements IRollbackRequest + * @constructor + * @param {google.firestore.v1beta1.IRollbackRequest=} [properties] Properties to set + */ + function RollbackRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RollbackRequest database. + * @member {string} database + * @memberof google.firestore.v1beta1.RollbackRequest + * @instance + */ + RollbackRequest.prototype.database = ""; + + /** + * RollbackRequest transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1beta1.RollbackRequest + * @instance + */ + RollbackRequest.prototype.transaction = $util.newBuffer([]); + + /** + * Creates a new RollbackRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.RollbackRequest + * @static + * @param {google.firestore.v1beta1.IRollbackRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.RollbackRequest} RollbackRequest instance + */ + RollbackRequest.create = function create(properties) { + return new RollbackRequest(properties); + }; + + /** + * Encodes the specified RollbackRequest message. Does not implicitly {@link google.firestore.v1beta1.RollbackRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.RollbackRequest + * @static + * @param {google.firestore.v1beta1.IRollbackRequest} message RollbackRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RollbackRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.transaction); + return writer; + }; + + /** + * Encodes the specified RollbackRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.RollbackRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.RollbackRequest + * @static + * @param {google.firestore.v1beta1.IRollbackRequest} message RollbackRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RollbackRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RollbackRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.RollbackRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.RollbackRequest} RollbackRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RollbackRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.RollbackRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.transaction = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RollbackRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.RollbackRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.RollbackRequest} RollbackRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RollbackRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RollbackRequest message. + * @function verify + * @memberof google.firestore.v1beta1.RollbackRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RollbackRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + return null; + }; + + /** + * Creates a RollbackRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.RollbackRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.RollbackRequest} RollbackRequest + */ + RollbackRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.RollbackRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.RollbackRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.RollbackRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + return message; + }; + + /** + * Creates a plain object from a RollbackRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.RollbackRequest + * @static + * @param {google.firestore.v1beta1.RollbackRequest} message RollbackRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RollbackRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.database = ""; + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + return object; + }; + + /** + * Converts this RollbackRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.RollbackRequest + * @instance + * @returns {Object.} JSON object + */ + RollbackRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RollbackRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.RollbackRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RollbackRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.RollbackRequest"; + }; + + return RollbackRequest; + })(); + + v1beta1.RunQueryRequest = (function() { + + /** + * Properties of a RunQueryRequest. + * @memberof google.firestore.v1beta1 + * @interface IRunQueryRequest + * @property {string|null} [parent] RunQueryRequest parent + * @property {google.firestore.v1beta1.IStructuredQuery|null} [structuredQuery] RunQueryRequest structuredQuery + * @property {Uint8Array|null} [transaction] RunQueryRequest transaction + * @property {google.firestore.v1beta1.ITransactionOptions|null} [newTransaction] RunQueryRequest newTransaction + * @property {google.protobuf.ITimestamp|null} [readTime] RunQueryRequest readTime + */ + + /** + * Constructs a new RunQueryRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a RunQueryRequest. + * @implements IRunQueryRequest + * @constructor + * @param {google.firestore.v1beta1.IRunQueryRequest=} [properties] Properties to set + */ + function RunQueryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RunQueryRequest parent. + * @member {string} parent + * @memberof google.firestore.v1beta1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.parent = ""; + + /** + * RunQueryRequest structuredQuery. + * @member {google.firestore.v1beta1.IStructuredQuery|null|undefined} structuredQuery + * @memberof google.firestore.v1beta1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.structuredQuery = null; + + /** + * RunQueryRequest transaction. + * @member {Uint8Array|null|undefined} transaction + * @memberof google.firestore.v1beta1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.transaction = null; + + /** + * RunQueryRequest newTransaction. + * @member {google.firestore.v1beta1.ITransactionOptions|null|undefined} newTransaction + * @memberof google.firestore.v1beta1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.newTransaction = null; + + /** + * RunQueryRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.RunQueryRequest + * @instance + */ + RunQueryRequest.prototype.readTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RunQueryRequest queryType. + * @member {"structuredQuery"|undefined} queryType + * @memberof google.firestore.v1beta1.RunQueryRequest + * @instance + */ + Object.defineProperty(RunQueryRequest.prototype, "queryType", { + get: $util.oneOfGetter($oneOfFields = ["structuredQuery"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * RunQueryRequest consistencySelector. + * @member {"transaction"|"newTransaction"|"readTime"|undefined} consistencySelector + * @memberof google.firestore.v1beta1.RunQueryRequest + * @instance + */ + Object.defineProperty(RunQueryRequest.prototype, "consistencySelector", { + get: $util.oneOfGetter($oneOfFields = ["transaction", "newTransaction", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RunQueryRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.RunQueryRequest + * @static + * @param {google.firestore.v1beta1.IRunQueryRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.RunQueryRequest} RunQueryRequest instance + */ + RunQueryRequest.create = function create(properties) { + return new RunQueryRequest(properties); + }; + + /** + * Encodes the specified RunQueryRequest message. Does not implicitly {@link google.firestore.v1beta1.RunQueryRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.RunQueryRequest + * @static + * @param {google.firestore.v1beta1.IRunQueryRequest} message RunQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunQueryRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) + $root.google.firestore.v1beta1.StructuredQuery.encode(message.structuredQuery, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.transaction); + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) + $root.google.firestore.v1beta1.TransactionOptions.encode(message.newTransaction, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified RunQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.RunQueryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.RunQueryRequest + * @static + * @param {google.firestore.v1beta1.IRunQueryRequest} message RunQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RunQueryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.RunQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.RunQueryRequest} RunQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunQueryRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.RunQueryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.structuredQuery = $root.google.firestore.v1beta1.StructuredQuery.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.transaction = reader.bytes(); + break; + } + case 6: { + message.newTransaction = $root.google.firestore.v1beta1.TransactionOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RunQueryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.RunQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.RunQueryRequest} RunQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunQueryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RunQueryRequest message. + * @function verify + * @memberof google.firestore.v1beta1.RunQueryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RunQueryRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + properties.queryType = 1; + { + var error = $root.google.firestore.v1beta1.StructuredQuery.verify(message.structuredQuery, long + 1); + if (error) + return "structuredQuery." + error; + } + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + properties.consistencySelector = 1; + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.firestore.v1beta1.TransactionOptions.verify(message.newTransaction, long + 1); + if (error) + return "newTransaction." + error; + } + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.consistencySelector === 1) + return "consistencySelector: multiple values"; + properties.consistencySelector = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + return null; + }; + + /** + * Creates a RunQueryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.RunQueryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.RunQueryRequest} RunQueryRequest + */ + RunQueryRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.RunQueryRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.RunQueryRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.RunQueryRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.structuredQuery != null) { + if (!$util.isObject(object.structuredQuery)) + throw TypeError(".google.firestore.v1beta1.RunQueryRequest.structuredQuery: object expected"); + message.structuredQuery = $root.google.firestore.v1beta1.StructuredQuery.fromObject(object.structuredQuery, long + 1); + } + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.newTransaction != null) { + if (!$util.isObject(object.newTransaction)) + throw TypeError(".google.firestore.v1beta1.RunQueryRequest.newTransaction: object expected"); + message.newTransaction = $root.google.firestore.v1beta1.TransactionOptions.fromObject(object.newTransaction, long + 1); + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.RunQueryRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a RunQueryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.RunQueryRequest + * @static + * @param {google.firestore.v1beta1.RunQueryRequest} message RunQueryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RunQueryRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + object.structuredQuery = $root.google.firestore.v1beta1.StructuredQuery.toObject(message.structuredQuery, options, q + 1); + if (options.oneofs) + object.queryType = "structuredQuery"; + } + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) { + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (options.oneofs) + object.consistencySelector = "transaction"; + } + if (message.newTransaction != null && Object.hasOwnProperty.call(message, "newTransaction")) { + object.newTransaction = $root.google.firestore.v1beta1.TransactionOptions.toObject(message.newTransaction, options, q + 1); + if (options.oneofs) + object.consistencySelector = "newTransaction"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.consistencySelector = "readTime"; + } + return object; + }; + + /** + * Converts this RunQueryRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.RunQueryRequest + * @instance + * @returns {Object.} JSON object + */ + RunQueryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RunQueryRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.RunQueryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RunQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.RunQueryRequest"; + }; + + return RunQueryRequest; + })(); + + v1beta1.RunQueryResponse = (function() { + + /** + * Properties of a RunQueryResponse. + * @memberof google.firestore.v1beta1 + * @interface IRunQueryResponse + * @property {Uint8Array|null} [transaction] RunQueryResponse transaction + * @property {google.firestore.v1beta1.IDocument|null} [document] RunQueryResponse document + * @property {google.protobuf.ITimestamp|null} [readTime] RunQueryResponse readTime + * @property {number|null} [skippedResults] RunQueryResponse skippedResults + */ + + /** + * Constructs a new RunQueryResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a RunQueryResponse. + * @implements IRunQueryResponse + * @constructor + * @param {google.firestore.v1beta1.IRunQueryResponse=} [properties] Properties to set + */ + function RunQueryResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RunQueryResponse transaction. + * @member {Uint8Array} transaction + * @memberof google.firestore.v1beta1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.transaction = $util.newBuffer([]); + + /** + * RunQueryResponse document. + * @member {google.firestore.v1beta1.IDocument|null|undefined} document + * @memberof google.firestore.v1beta1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.document = null; + + /** + * RunQueryResponse readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.readTime = null; + + /** + * RunQueryResponse skippedResults. + * @member {number} skippedResults + * @memberof google.firestore.v1beta1.RunQueryResponse + * @instance + */ + RunQueryResponse.prototype.skippedResults = 0; + + /** + * Creates a new RunQueryResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.RunQueryResponse + * @static + * @param {google.firestore.v1beta1.IRunQueryResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.RunQueryResponse} RunQueryResponse instance + */ + RunQueryResponse.create = function create(properties) { + return new RunQueryResponse(properties); + }; + + /** + * Encodes the specified RunQueryResponse message. Does not implicitly {@link google.firestore.v1beta1.RunQueryResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.RunQueryResponse + * @static + * @param {google.firestore.v1beta1.IRunQueryResponse} message RunQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunQueryResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.firestore.v1beta1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.transaction); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.skippedResults != null && Object.hasOwnProperty.call(message, "skippedResults")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.skippedResults); + return writer; + }; + + /** + * Encodes the specified RunQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.RunQueryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.RunQueryResponse + * @static + * @param {google.firestore.v1beta1.IRunQueryResponse} message RunQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RunQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RunQueryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.RunQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.RunQueryResponse} RunQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunQueryResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.RunQueryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.transaction = reader.bytes(); + break; + } + case 1: { + message.document = $root.google.firestore.v1beta1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.skippedResults = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RunQueryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.RunQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.RunQueryResponse} RunQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RunQueryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RunQueryResponse message. + * @function verify + * @memberof google.firestore.v1beta1.RunQueryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RunQueryResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + if (!(message.transaction && typeof message.transaction.length === "number" || $util.isString(message.transaction))) + return "transaction: buffer expected"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) { + var error = $root.google.firestore.v1beta1.Document.verify(message.document, long + 1); + if (error) + return "document." + error; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + if (message.skippedResults != null && Object.hasOwnProperty.call(message, "skippedResults")) + if (!$util.isInteger(message.skippedResults)) + return "skippedResults: integer expected"; + return null; + }; + + /** + * Creates a RunQueryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.RunQueryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.RunQueryResponse} RunQueryResponse + */ + RunQueryResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.RunQueryResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.RunQueryResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.RunQueryResponse(); + if (object.transaction != null) + if (typeof object.transaction === "string") + $util.base64.decode(object.transaction, message.transaction = $util.newBuffer($util.base64.length(object.transaction)), 0); + else if (object.transaction.length >= 0) + message.transaction = object.transaction; + if (object.document != null) { + if (!$util.isObject(object.document)) + throw TypeError(".google.firestore.v1beta1.RunQueryResponse.document: object expected"); + message.document = $root.google.firestore.v1beta1.Document.fromObject(object.document, long + 1); + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.RunQueryResponse.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.skippedResults != null) + message.skippedResults = object.skippedResults | 0; + return message; + }; + + /** + * Creates a plain object from a RunQueryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.RunQueryResponse + * @static + * @param {google.firestore.v1beta1.RunQueryResponse} message RunQueryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RunQueryResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.document = null; + if (options.bytes === String) + object.transaction = ""; + else { + object.transaction = []; + if (options.bytes !== Array) + object.transaction = $util.newBuffer(object.transaction); + } + object.readTime = null; + object.skippedResults = 0; + } + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = $root.google.firestore.v1beta1.Document.toObject(message.document, options, q + 1); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + object.transaction = options.bytes === String ? $util.base64.encode(message.transaction, 0, message.transaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.transaction) : message.transaction; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (message.skippedResults != null && Object.hasOwnProperty.call(message, "skippedResults")) + object.skippedResults = message.skippedResults; + return object; + }; + + /** + * Converts this RunQueryResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.RunQueryResponse + * @instance + * @returns {Object.} JSON object + */ + RunQueryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RunQueryResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.RunQueryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RunQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.RunQueryResponse"; + }; + + return RunQueryResponse; + })(); + + v1beta1.PartitionQueryRequest = (function() { + + /** + * Properties of a PartitionQueryRequest. + * @memberof google.firestore.v1beta1 + * @interface IPartitionQueryRequest + * @property {string|null} [parent] PartitionQueryRequest parent + * @property {google.firestore.v1beta1.IStructuredQuery|null} [structuredQuery] PartitionQueryRequest structuredQuery + * @property {number|Long|null} [partitionCount] PartitionQueryRequest partitionCount + * @property {string|null} [pageToken] PartitionQueryRequest pageToken + * @property {number|null} [pageSize] PartitionQueryRequest pageSize + */ + + /** + * Constructs a new PartitionQueryRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a PartitionQueryRequest. + * @implements IPartitionQueryRequest + * @constructor + * @param {google.firestore.v1beta1.IPartitionQueryRequest=} [properties] Properties to set + */ + function PartitionQueryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * PartitionQueryRequest parent. + * @member {string} parent + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.parent = ""; + + /** + * PartitionQueryRequest structuredQuery. + * @member {google.firestore.v1beta1.IStructuredQuery|null|undefined} structuredQuery + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.structuredQuery = null; + + /** + * PartitionQueryRequest partitionCount. + * @member {number|Long} partitionCount + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.partitionCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * PartitionQueryRequest pageToken. + * @member {string} pageToken + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.pageToken = ""; + + /** + * PartitionQueryRequest pageSize. + * @member {number} pageSize + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @instance + */ + PartitionQueryRequest.prototype.pageSize = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * PartitionQueryRequest queryType. + * @member {"structuredQuery"|undefined} queryType + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @instance + */ + Object.defineProperty(PartitionQueryRequest.prototype, "queryType", { + get: $util.oneOfGetter($oneOfFields = ["structuredQuery"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PartitionQueryRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @static + * @param {google.firestore.v1beta1.IPartitionQueryRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.PartitionQueryRequest} PartitionQueryRequest instance + */ + PartitionQueryRequest.create = function create(properties) { + return new PartitionQueryRequest(properties); + }; + + /** + * Encodes the specified PartitionQueryRequest message. Does not implicitly {@link google.firestore.v1beta1.PartitionQueryRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @static + * @param {google.firestore.v1beta1.IPartitionQueryRequest} message PartitionQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartitionQueryRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) + $root.google.firestore.v1beta1.StructuredQuery.encode(message.structuredQuery, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.partitionCount != null && Object.hasOwnProperty.call(message, "partitionCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.partitionCount); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.pageSize); + return writer; + }; + + /** + * Encodes the specified PartitionQueryRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.PartitionQueryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @static + * @param {google.firestore.v1beta1.IPartitionQueryRequest} message PartitionQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartitionQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a PartitionQueryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.PartitionQueryRequest} PartitionQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartitionQueryRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.PartitionQueryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.structuredQuery = $root.google.firestore.v1beta1.StructuredQuery.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.partitionCount = reader.int64(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.pageSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a PartitionQueryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.PartitionQueryRequest} PartitionQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartitionQueryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PartitionQueryRequest message. + * @function verify + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PartitionQueryRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + properties.queryType = 1; + { + var error = $root.google.firestore.v1beta1.StructuredQuery.verify(message.structuredQuery, long + 1); + if (error) + return "structuredQuery." + error; + } + } + if (message.partitionCount != null && Object.hasOwnProperty.call(message, "partitionCount")) + if (!$util.isInteger(message.partitionCount) && !(message.partitionCount && $util.isInteger(message.partitionCount.low) && $util.isInteger(message.partitionCount.high))) + return "partitionCount: integer|Long expected"; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + return null; + }; + + /** + * Creates a PartitionQueryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.PartitionQueryRequest} PartitionQueryRequest + */ + PartitionQueryRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.PartitionQueryRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.PartitionQueryRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.PartitionQueryRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.structuredQuery != null) { + if (!$util.isObject(object.structuredQuery)) + throw TypeError(".google.firestore.v1beta1.PartitionQueryRequest.structuredQuery: object expected"); + message.structuredQuery = $root.google.firestore.v1beta1.StructuredQuery.fromObject(object.structuredQuery, long + 1); + } + if (object.partitionCount != null) + if ($util.Long) + message.partitionCount = $util.Long.fromValue(object.partitionCount, false); + else if (typeof object.partitionCount === "string") + message.partitionCount = parseInt(object.partitionCount, 10); + else if (typeof object.partitionCount === "number") + message.partitionCount = object.partitionCount; + else if (typeof object.partitionCount === "object") + message.partitionCount = new $util.LongBits(object.partitionCount.low >>> 0, object.partitionCount.high >>> 0).toNumber(); + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + return message; + }; + + /** + * Creates a plain object from a PartitionQueryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @static + * @param {google.firestore.v1beta1.PartitionQueryRequest} message PartitionQueryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PartitionQueryRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.partitionCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.partitionCount = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + object.pageToken = ""; + object.pageSize = 0; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + object.structuredQuery = $root.google.firestore.v1beta1.StructuredQuery.toObject(message.structuredQuery, options, q + 1); + if (options.oneofs) + object.queryType = "structuredQuery"; + } + if (message.partitionCount != null && Object.hasOwnProperty.call(message, "partitionCount")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.partitionCount = typeof message.partitionCount === "number" ? BigInt(message.partitionCount) : $util.Long.fromBits(message.partitionCount.low >>> 0, message.partitionCount.high >>> 0, false).toBigInt(); + else if (typeof message.partitionCount === "number") + object.partitionCount = options.longs === String ? String(message.partitionCount) : message.partitionCount; + else + object.partitionCount = options.longs === String ? $util.Long.prototype.toString.call(message.partitionCount) : options.longs === Number ? new $util.LongBits(message.partitionCount.low >>> 0, message.partitionCount.high >>> 0).toNumber() : message.partitionCount; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + object.pageToken = message.pageToken; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + object.pageSize = message.pageSize; + return object; + }; + + /** + * Converts this PartitionQueryRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @instance + * @returns {Object.} JSON object + */ + PartitionQueryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PartitionQueryRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.PartitionQueryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PartitionQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.PartitionQueryRequest"; + }; + + return PartitionQueryRequest; + })(); + + v1beta1.PartitionQueryResponse = (function() { + + /** + * Properties of a PartitionQueryResponse. + * @memberof google.firestore.v1beta1 + * @interface IPartitionQueryResponse + * @property {Array.|null} [partitions] PartitionQueryResponse partitions + * @property {string|null} [nextPageToken] PartitionQueryResponse nextPageToken + */ + + /** + * Constructs a new PartitionQueryResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a PartitionQueryResponse. + * @implements IPartitionQueryResponse + * @constructor + * @param {google.firestore.v1beta1.IPartitionQueryResponse=} [properties] Properties to set + */ + function PartitionQueryResponse(properties) { + this.partitions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * PartitionQueryResponse partitions. + * @member {Array.} partitions + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @instance + */ + PartitionQueryResponse.prototype.partitions = $util.emptyArray; + + /** + * PartitionQueryResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @instance + */ + PartitionQueryResponse.prototype.nextPageToken = ""; + + /** + * Creates a new PartitionQueryResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @static + * @param {google.firestore.v1beta1.IPartitionQueryResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.PartitionQueryResponse} PartitionQueryResponse instance + */ + PartitionQueryResponse.create = function create(properties) { + return new PartitionQueryResponse(properties); + }; + + /** + * Encodes the specified PartitionQueryResponse message. Does not implicitly {@link google.firestore.v1beta1.PartitionQueryResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @static + * @param {google.firestore.v1beta1.IPartitionQueryResponse} message PartitionQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartitionQueryResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.partitions != null && message.partitions.length) + for (var i = 0; i < message.partitions.length; ++i) + $root.google.firestore.v1beta1.Cursor.encode(message.partitions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified PartitionQueryResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.PartitionQueryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @static + * @param {google.firestore.v1beta1.IPartitionQueryResponse} message PartitionQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartitionQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a PartitionQueryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.PartitionQueryResponse} PartitionQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartitionQueryResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.PartitionQueryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.partitions && message.partitions.length)) + message.partitions = []; + message.partitions.push($root.google.firestore.v1beta1.Cursor.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a PartitionQueryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.PartitionQueryResponse} PartitionQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartitionQueryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PartitionQueryResponse message. + * @function verify + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PartitionQueryResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.partitions != null && Object.hasOwnProperty.call(message, "partitions")) { + if (!Array.isArray(message.partitions)) + return "partitions: array expected"; + for (var i = 0; i < message.partitions.length; ++i) { + var error = $root.google.firestore.v1beta1.Cursor.verify(message.partitions[i], long + 1); + if (error) + return "partitions." + error; + } + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a PartitionQueryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.PartitionQueryResponse} PartitionQueryResponse + */ + PartitionQueryResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.PartitionQueryResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.PartitionQueryResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.PartitionQueryResponse(); + if (object.partitions) { + if (!Array.isArray(object.partitions)) + throw TypeError(".google.firestore.v1beta1.PartitionQueryResponse.partitions: array expected"); + message.partitions = []; + for (var i = 0; i < object.partitions.length; ++i) { + if (!$util.isObject(object.partitions[i])) + throw TypeError(".google.firestore.v1beta1.PartitionQueryResponse.partitions: object expected"); + message.partitions[i] = $root.google.firestore.v1beta1.Cursor.fromObject(object.partitions[i], long + 1); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a PartitionQueryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @static + * @param {google.firestore.v1beta1.PartitionQueryResponse} message PartitionQueryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PartitionQueryResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.partitions = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.partitions && message.partitions.length) { + object.partitions = []; + for (var j = 0; j < message.partitions.length; ++j) + object.partitions[j] = $root.google.firestore.v1beta1.Cursor.toObject(message.partitions[j], options, q + 1); + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this PartitionQueryResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @instance + * @returns {Object.} JSON object + */ + PartitionQueryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PartitionQueryResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.PartitionQueryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PartitionQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.PartitionQueryResponse"; + }; + + return PartitionQueryResponse; + })(); + + v1beta1.WriteRequest = (function() { + + /** + * Properties of a WriteRequest. + * @memberof google.firestore.v1beta1 + * @interface IWriteRequest + * @property {string|null} [database] WriteRequest database + * @property {string|null} [streamId] WriteRequest streamId + * @property {Array.|null} [writes] WriteRequest writes + * @property {Uint8Array|null} [streamToken] WriteRequest streamToken + * @property {Object.|null} [labels] WriteRequest labels + */ + + /** + * Constructs a new WriteRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a WriteRequest. + * @implements IWriteRequest + * @constructor + * @param {google.firestore.v1beta1.IWriteRequest=} [properties] Properties to set + */ + function WriteRequest(properties) { + this.writes = []; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteRequest database. + * @member {string} database + * @memberof google.firestore.v1beta1.WriteRequest + * @instance + */ + WriteRequest.prototype.database = ""; + + /** + * WriteRequest streamId. + * @member {string} streamId + * @memberof google.firestore.v1beta1.WriteRequest + * @instance + */ + WriteRequest.prototype.streamId = ""; + + /** + * WriteRequest writes. + * @member {Array.} writes + * @memberof google.firestore.v1beta1.WriteRequest + * @instance + */ + WriteRequest.prototype.writes = $util.emptyArray; + + /** + * WriteRequest streamToken. + * @member {Uint8Array} streamToken + * @memberof google.firestore.v1beta1.WriteRequest + * @instance + */ + WriteRequest.prototype.streamToken = $util.newBuffer([]); + + /** + * WriteRequest labels. + * @member {Object.} labels + * @memberof google.firestore.v1beta1.WriteRequest + * @instance + */ + WriteRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new WriteRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.WriteRequest + * @static + * @param {google.firestore.v1beta1.IWriteRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.WriteRequest} WriteRequest instance + */ + WriteRequest.create = function create(properties) { + return new WriteRequest(properties); + }; + + /** + * Encodes the specified WriteRequest message. Does not implicitly {@link google.firestore.v1beta1.WriteRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.WriteRequest + * @static + * @param {google.firestore.v1beta1.IWriteRequest} message WriteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.streamId); + if (message.writes != null && message.writes.length) + for (var i = 0; i < message.writes.length; ++i) + $root.google.firestore.v1beta1.Write.encode(message.writes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.streamToken); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.WriteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.WriteRequest + * @static + * @param {google.firestore.v1beta1.IWriteRequest} message WriteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a WriteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.WriteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.WriteRequest} WriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.WriteRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.streamId = reader.string(); + break; + } + case 3: { + if (!(message.writes && message.writes.length)) + message.writes = []; + message.writes.push($root.google.firestore.v1beta1.Write.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 4: { + message.streamToken = reader.bytes(); + break; + } + case 5: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.labels, key); + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a WriteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.WriteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.WriteRequest} WriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteRequest message. + * @function verify + * @memberof google.firestore.v1beta1.WriteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + if (!$util.isString(message.streamId)) + return "streamId: string expected"; + if (message.writes != null && Object.hasOwnProperty.call(message, "writes")) { + if (!Array.isArray(message.writes)) + return "writes: array expected"; + for (var i = 0; i < message.writes.length; ++i) { + var error = $root.google.firestore.v1beta1.Write.verify(message.writes[i], long + 1); + if (error) + return "writes." + error; + } + } + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + if (!(message.streamToken && typeof message.streamToken.length === "number" || $util.isString(message.streamToken))) + return "streamToken: buffer expected"; + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a WriteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.WriteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.WriteRequest} WriteRequest + */ + WriteRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.WriteRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.WriteRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.WriteRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.streamId != null) + message.streamId = String(object.streamId); + if (object.writes) { + if (!Array.isArray(object.writes)) + throw TypeError(".google.firestore.v1beta1.WriteRequest.writes: array expected"); + message.writes = []; + for (var i = 0; i < object.writes.length; ++i) { + if (!$util.isObject(object.writes[i])) + throw TypeError(".google.firestore.v1beta1.WriteRequest.writes: object expected"); + message.writes[i] = $root.google.firestore.v1beta1.Write.fromObject(object.writes[i], long + 1); + } + } + if (object.streamToken != null) + if (typeof object.streamToken === "string") + $util.base64.decode(object.streamToken, message.streamToken = $util.newBuffer($util.base64.length(object.streamToken)), 0); + else if (object.streamToken.length >= 0) + message.streamToken = object.streamToken; + if (object.labels) { + if (!$util.isObject(object.labels)) + throw TypeError(".google.firestore.v1beta1.WriteRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a WriteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.WriteRequest + * @static + * @param {google.firestore.v1beta1.WriteRequest} message WriteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writes = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.database = ""; + object.streamId = ""; + if (options.bytes === String) + object.streamToken = ""; + else { + object.streamToken = []; + if (options.bytes !== Array) + object.streamToken = $util.newBuffer(object.streamToken); + } + } + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + object.streamId = message.streamId; + if (message.writes && message.writes.length) { + object.writes = []; + for (var j = 0; j < message.writes.length; ++j) + object.writes[j] = $root.google.firestore.v1beta1.Write.toObject(message.writes[j], options, q + 1); + } + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + object.streamToken = options.bytes === String ? $util.base64.encode(message.streamToken, 0, message.streamToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.streamToken) : message.streamToken; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + } + return object; + }; + + /** + * Converts this WriteRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.WriteRequest + * @instance + * @returns {Object.} JSON object + */ + WriteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.WriteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.WriteRequest"; + }; + + return WriteRequest; + })(); + + v1beta1.WriteResponse = (function() { + + /** + * Properties of a WriteResponse. + * @memberof google.firestore.v1beta1 + * @interface IWriteResponse + * @property {string|null} [streamId] WriteResponse streamId + * @property {Uint8Array|null} [streamToken] WriteResponse streamToken + * @property {Array.|null} [writeResults] WriteResponse writeResults + * @property {google.protobuf.ITimestamp|null} [commitTime] WriteResponse commitTime + */ + + /** + * Constructs a new WriteResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a WriteResponse. + * @implements IWriteResponse + * @constructor + * @param {google.firestore.v1beta1.IWriteResponse=} [properties] Properties to set + */ + function WriteResponse(properties) { + this.writeResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteResponse streamId. + * @member {string} streamId + * @memberof google.firestore.v1beta1.WriteResponse + * @instance + */ + WriteResponse.prototype.streamId = ""; + + /** + * WriteResponse streamToken. + * @member {Uint8Array} streamToken + * @memberof google.firestore.v1beta1.WriteResponse + * @instance + */ + WriteResponse.prototype.streamToken = $util.newBuffer([]); + + /** + * WriteResponse writeResults. + * @member {Array.} writeResults + * @memberof google.firestore.v1beta1.WriteResponse + * @instance + */ + WriteResponse.prototype.writeResults = $util.emptyArray; + + /** + * WriteResponse commitTime. + * @member {google.protobuf.ITimestamp|null|undefined} commitTime + * @memberof google.firestore.v1beta1.WriteResponse + * @instance + */ + WriteResponse.prototype.commitTime = null; + + /** + * Creates a new WriteResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.WriteResponse + * @static + * @param {google.firestore.v1beta1.IWriteResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.WriteResponse} WriteResponse instance + */ + WriteResponse.create = function create(properties) { + return new WriteResponse(properties); + }; + + /** + * Encodes the specified WriteResponse message. Does not implicitly {@link google.firestore.v1beta1.WriteResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.WriteResponse + * @static + * @param {google.firestore.v1beta1.IWriteResponse} message WriteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.streamId); + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.streamToken); + if (message.writeResults != null && message.writeResults.length) + for (var i = 0; i < message.writeResults.length; ++i) + $root.google.firestore.v1beta1.WriteResult.encode(message.writeResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) + $root.google.protobuf.Timestamp.encode(message.commitTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.WriteResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.WriteResponse + * @static + * @param {google.firestore.v1beta1.IWriteResponse} message WriteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a WriteResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.WriteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.WriteResponse} WriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.WriteResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.streamId = reader.string(); + break; + } + case 2: { + message.streamToken = reader.bytes(); + break; + } + case 3: { + if (!(message.writeResults && message.writeResults.length)) + message.writeResults = []; + message.writeResults.push($root.google.firestore.v1beta1.WriteResult.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 4: { + message.commitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a WriteResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.WriteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.WriteResponse} WriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteResponse message. + * @function verify + * @memberof google.firestore.v1beta1.WriteResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + if (!$util.isString(message.streamId)) + return "streamId: string expected"; + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + if (!(message.streamToken && typeof message.streamToken.length === "number" || $util.isString(message.streamToken))) + return "streamToken: buffer expected"; + if (message.writeResults != null && Object.hasOwnProperty.call(message, "writeResults")) { + if (!Array.isArray(message.writeResults)) + return "writeResults: array expected"; + for (var i = 0; i < message.writeResults.length; ++i) { + var error = $root.google.firestore.v1beta1.WriteResult.verify(message.writeResults[i], long + 1); + if (error) + return "writeResults." + error; + } + } + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.commitTime, long + 1); + if (error) + return "commitTime." + error; + } + return null; + }; + + /** + * Creates a WriteResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.WriteResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.WriteResponse} WriteResponse + */ + WriteResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.WriteResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.WriteResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.WriteResponse(); + if (object.streamId != null) + message.streamId = String(object.streamId); + if (object.streamToken != null) + if (typeof object.streamToken === "string") + $util.base64.decode(object.streamToken, message.streamToken = $util.newBuffer($util.base64.length(object.streamToken)), 0); + else if (object.streamToken.length >= 0) + message.streamToken = object.streamToken; + if (object.writeResults) { + if (!Array.isArray(object.writeResults)) + throw TypeError(".google.firestore.v1beta1.WriteResponse.writeResults: array expected"); + message.writeResults = []; + for (var i = 0; i < object.writeResults.length; ++i) { + if (!$util.isObject(object.writeResults[i])) + throw TypeError(".google.firestore.v1beta1.WriteResponse.writeResults: object expected"); + message.writeResults[i] = $root.google.firestore.v1beta1.WriteResult.fromObject(object.writeResults[i], long + 1); + } + } + if (object.commitTime != null) { + if (!$util.isObject(object.commitTime)) + throw TypeError(".google.firestore.v1beta1.WriteResponse.commitTime: object expected"); + message.commitTime = $root.google.protobuf.Timestamp.fromObject(object.commitTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a WriteResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.WriteResponse + * @static + * @param {google.firestore.v1beta1.WriteResponse} message WriteResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writeResults = []; + if (options.defaults) { + object.streamId = ""; + if (options.bytes === String) + object.streamToken = ""; + else { + object.streamToken = []; + if (options.bytes !== Array) + object.streamToken = $util.newBuffer(object.streamToken); + } + object.commitTime = null; + } + if (message.streamId != null && Object.hasOwnProperty.call(message, "streamId")) + object.streamId = message.streamId; + if (message.streamToken != null && Object.hasOwnProperty.call(message, "streamToken")) + object.streamToken = options.bytes === String ? $util.base64.encode(message.streamToken, 0, message.streamToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.streamToken) : message.streamToken; + if (message.writeResults && message.writeResults.length) { + object.writeResults = []; + for (var j = 0; j < message.writeResults.length; ++j) + object.writeResults[j] = $root.google.firestore.v1beta1.WriteResult.toObject(message.writeResults[j], options, q + 1); + } + if (message.commitTime != null && Object.hasOwnProperty.call(message, "commitTime")) + object.commitTime = $root.google.protobuf.Timestamp.toObject(message.commitTime, options, q + 1); + return object; + }; + + /** + * Converts this WriteResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.WriteResponse + * @instance + * @returns {Object.} JSON object + */ + WriteResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.WriteResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.WriteResponse"; + }; + + return WriteResponse; + })(); + + v1beta1.ListenRequest = (function() { + + /** + * Properties of a ListenRequest. + * @memberof google.firestore.v1beta1 + * @interface IListenRequest + * @property {string|null} [database] ListenRequest database + * @property {google.firestore.v1beta1.ITarget|null} [addTarget] ListenRequest addTarget + * @property {number|null} [removeTarget] ListenRequest removeTarget + * @property {Object.|null} [labels] ListenRequest labels + */ + + /** + * Constructs a new ListenRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a ListenRequest. + * @implements IListenRequest + * @constructor + * @param {google.firestore.v1beta1.IListenRequest=} [properties] Properties to set + */ + function ListenRequest(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListenRequest database. + * @member {string} database + * @memberof google.firestore.v1beta1.ListenRequest + * @instance + */ + ListenRequest.prototype.database = ""; + + /** + * ListenRequest addTarget. + * @member {google.firestore.v1beta1.ITarget|null|undefined} addTarget + * @memberof google.firestore.v1beta1.ListenRequest + * @instance + */ + ListenRequest.prototype.addTarget = null; + + /** + * ListenRequest removeTarget. + * @member {number|null|undefined} removeTarget + * @memberof google.firestore.v1beta1.ListenRequest + * @instance + */ + ListenRequest.prototype.removeTarget = null; + + /** + * ListenRequest labels. + * @member {Object.} labels + * @memberof google.firestore.v1beta1.ListenRequest + * @instance + */ + ListenRequest.prototype.labels = $util.emptyObject; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ListenRequest targetChange. + * @member {"addTarget"|"removeTarget"|undefined} targetChange + * @memberof google.firestore.v1beta1.ListenRequest + * @instance + */ + Object.defineProperty(ListenRequest.prototype, "targetChange", { + get: $util.oneOfGetter($oneOfFields = ["addTarget", "removeTarget"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ListenRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.ListenRequest + * @static + * @param {google.firestore.v1beta1.IListenRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.ListenRequest} ListenRequest instance + */ + ListenRequest.create = function create(properties) { + return new ListenRequest(properties); + }; + + /** + * Encodes the specified ListenRequest message. Does not implicitly {@link google.firestore.v1beta1.ListenRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.ListenRequest + * @static + * @param {google.firestore.v1beta1.IListenRequest} message ListenRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListenRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.addTarget != null && Object.hasOwnProperty.call(message, "addTarget")) + $root.google.firestore.v1beta1.Target.encode(message.addTarget, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.removeTarget != null && Object.hasOwnProperty.call(message, "removeTarget")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.removeTarget); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListenRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListenRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.ListenRequest + * @static + * @param {google.firestore.v1beta1.IListenRequest} message ListenRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListenRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListenRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.ListenRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.ListenRequest} ListenRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListenRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.ListenRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.addTarget = $root.google.firestore.v1beta1.Target.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.removeTarget = reader.int32(); + break; + } + case 4: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.labels, key); + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListenRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.ListenRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.ListenRequest} ListenRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListenRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListenRequest message. + * @function verify + * @memberof google.firestore.v1beta1.ListenRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListenRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.addTarget != null && Object.hasOwnProperty.call(message, "addTarget")) { + properties.targetChange = 1; + { + var error = $root.google.firestore.v1beta1.Target.verify(message.addTarget, long + 1); + if (error) + return "addTarget." + error; + } + } + if (message.removeTarget != null && Object.hasOwnProperty.call(message, "removeTarget")) { + if (properties.targetChange === 1) + return "targetChange: multiple values"; + properties.targetChange = 1; + if (!$util.isInteger(message.removeTarget)) + return "removeTarget: integer expected"; + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a ListenRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.ListenRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.ListenRequest} ListenRequest + */ + ListenRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.ListenRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.ListenRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.ListenRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.addTarget != null) { + if (!$util.isObject(object.addTarget)) + throw TypeError(".google.firestore.v1beta1.ListenRequest.addTarget: object expected"); + message.addTarget = $root.google.firestore.v1beta1.Target.fromObject(object.addTarget, long + 1); + } + if (object.removeTarget != null) + message.removeTarget = object.removeTarget | 0; + if (object.labels) { + if (!$util.isObject(object.labels)) + throw TypeError(".google.firestore.v1beta1.ListenRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListenRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.ListenRequest + * @static + * @param {google.firestore.v1beta1.ListenRequest} message ListenRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListenRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) + object.database = ""; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.addTarget != null && Object.hasOwnProperty.call(message, "addTarget")) { + object.addTarget = $root.google.firestore.v1beta1.Target.toObject(message.addTarget, options, q + 1); + if (options.oneofs) + object.targetChange = "addTarget"; + } + if (message.removeTarget != null && Object.hasOwnProperty.call(message, "removeTarget")) { + object.removeTarget = message.removeTarget; + if (options.oneofs) + object.targetChange = "removeTarget"; + } + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + } + return object; + }; + + /** + * Converts this ListenRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.ListenRequest + * @instance + * @returns {Object.} JSON object + */ + ListenRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListenRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.ListenRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListenRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.ListenRequest"; + }; + + return ListenRequest; + })(); + + v1beta1.ListenResponse = (function() { + + /** + * Properties of a ListenResponse. + * @memberof google.firestore.v1beta1 + * @interface IListenResponse + * @property {google.firestore.v1beta1.ITargetChange|null} [targetChange] ListenResponse targetChange + * @property {google.firestore.v1beta1.IDocumentChange|null} [documentChange] ListenResponse documentChange + * @property {google.firestore.v1beta1.IDocumentDelete|null} [documentDelete] ListenResponse documentDelete + * @property {google.firestore.v1beta1.IDocumentRemove|null} [documentRemove] ListenResponse documentRemove + * @property {google.firestore.v1beta1.IExistenceFilter|null} [filter] ListenResponse filter + */ + + /** + * Constructs a new ListenResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a ListenResponse. + * @implements IListenResponse + * @constructor + * @param {google.firestore.v1beta1.IListenResponse=} [properties] Properties to set + */ + function ListenResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListenResponse targetChange. + * @member {google.firestore.v1beta1.ITargetChange|null|undefined} targetChange + * @memberof google.firestore.v1beta1.ListenResponse + * @instance + */ + ListenResponse.prototype.targetChange = null; + + /** + * ListenResponse documentChange. + * @member {google.firestore.v1beta1.IDocumentChange|null|undefined} documentChange + * @memberof google.firestore.v1beta1.ListenResponse + * @instance + */ + ListenResponse.prototype.documentChange = null; + + /** + * ListenResponse documentDelete. + * @member {google.firestore.v1beta1.IDocumentDelete|null|undefined} documentDelete + * @memberof google.firestore.v1beta1.ListenResponse + * @instance + */ + ListenResponse.prototype.documentDelete = null; + + /** + * ListenResponse documentRemove. + * @member {google.firestore.v1beta1.IDocumentRemove|null|undefined} documentRemove + * @memberof google.firestore.v1beta1.ListenResponse + * @instance + */ + ListenResponse.prototype.documentRemove = null; + + /** + * ListenResponse filter. + * @member {google.firestore.v1beta1.IExistenceFilter|null|undefined} filter + * @memberof google.firestore.v1beta1.ListenResponse + * @instance + */ + ListenResponse.prototype.filter = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ListenResponse responseType. + * @member {"targetChange"|"documentChange"|"documentDelete"|"documentRemove"|"filter"|undefined} responseType + * @memberof google.firestore.v1beta1.ListenResponse + * @instance + */ + Object.defineProperty(ListenResponse.prototype, "responseType", { + get: $util.oneOfGetter($oneOfFields = ["targetChange", "documentChange", "documentDelete", "documentRemove", "filter"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ListenResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.ListenResponse + * @static + * @param {google.firestore.v1beta1.IListenResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.ListenResponse} ListenResponse instance + */ + ListenResponse.create = function create(properties) { + return new ListenResponse(properties); + }; + + /** + * Encodes the specified ListenResponse message. Does not implicitly {@link google.firestore.v1beta1.ListenResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.ListenResponse + * @static + * @param {google.firestore.v1beta1.IListenResponse} message ListenResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListenResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.targetChange != null && Object.hasOwnProperty.call(message, "targetChange")) + $root.google.firestore.v1beta1.TargetChange.encode(message.targetChange, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.documentChange != null && Object.hasOwnProperty.call(message, "documentChange")) + $root.google.firestore.v1beta1.DocumentChange.encode(message.documentChange, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.documentDelete != null && Object.hasOwnProperty.call(message, "documentDelete")) + $root.google.firestore.v1beta1.DocumentDelete.encode(message.documentDelete, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + $root.google.firestore.v1beta1.ExistenceFilter.encode(message.filter, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.documentRemove != null && Object.hasOwnProperty.call(message, "documentRemove")) + $root.google.firestore.v1beta1.DocumentRemove.encode(message.documentRemove, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListenResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListenResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.ListenResponse + * @static + * @param {google.firestore.v1beta1.IListenResponse} message ListenResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListenResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListenResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.ListenResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.ListenResponse} ListenResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListenResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.ListenResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.targetChange = $root.google.firestore.v1beta1.TargetChange.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.documentChange = $root.google.firestore.v1beta1.DocumentChange.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.documentDelete = $root.google.firestore.v1beta1.DocumentDelete.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.documentRemove = $root.google.firestore.v1beta1.DocumentRemove.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.filter = $root.google.firestore.v1beta1.ExistenceFilter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListenResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.ListenResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.ListenResponse} ListenResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListenResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListenResponse message. + * @function verify + * @memberof google.firestore.v1beta1.ListenResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListenResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.targetChange != null && Object.hasOwnProperty.call(message, "targetChange")) { + properties.responseType = 1; + { + var error = $root.google.firestore.v1beta1.TargetChange.verify(message.targetChange, long + 1); + if (error) + return "targetChange." + error; + } + } + if (message.documentChange != null && Object.hasOwnProperty.call(message, "documentChange")) { + if (properties.responseType === 1) + return "responseType: multiple values"; + properties.responseType = 1; + { + var error = $root.google.firestore.v1beta1.DocumentChange.verify(message.documentChange, long + 1); + if (error) + return "documentChange." + error; + } + } + if (message.documentDelete != null && Object.hasOwnProperty.call(message, "documentDelete")) { + if (properties.responseType === 1) + return "responseType: multiple values"; + properties.responseType = 1; + { + var error = $root.google.firestore.v1beta1.DocumentDelete.verify(message.documentDelete, long + 1); + if (error) + return "documentDelete." + error; + } + } + if (message.documentRemove != null && Object.hasOwnProperty.call(message, "documentRemove")) { + if (properties.responseType === 1) + return "responseType: multiple values"; + properties.responseType = 1; + { + var error = $root.google.firestore.v1beta1.DocumentRemove.verify(message.documentRemove, long + 1); + if (error) + return "documentRemove." + error; + } + } + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) { + if (properties.responseType === 1) + return "responseType: multiple values"; + properties.responseType = 1; + { + var error = $root.google.firestore.v1beta1.ExistenceFilter.verify(message.filter, long + 1); + if (error) + return "filter." + error; + } + } + return null; + }; + + /** + * Creates a ListenResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.ListenResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.ListenResponse} ListenResponse + */ + ListenResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.ListenResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.ListenResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.ListenResponse(); + if (object.targetChange != null) { + if (!$util.isObject(object.targetChange)) + throw TypeError(".google.firestore.v1beta1.ListenResponse.targetChange: object expected"); + message.targetChange = $root.google.firestore.v1beta1.TargetChange.fromObject(object.targetChange, long + 1); + } + if (object.documentChange != null) { + if (!$util.isObject(object.documentChange)) + throw TypeError(".google.firestore.v1beta1.ListenResponse.documentChange: object expected"); + message.documentChange = $root.google.firestore.v1beta1.DocumentChange.fromObject(object.documentChange, long + 1); + } + if (object.documentDelete != null) { + if (!$util.isObject(object.documentDelete)) + throw TypeError(".google.firestore.v1beta1.ListenResponse.documentDelete: object expected"); + message.documentDelete = $root.google.firestore.v1beta1.DocumentDelete.fromObject(object.documentDelete, long + 1); + } + if (object.documentRemove != null) { + if (!$util.isObject(object.documentRemove)) + throw TypeError(".google.firestore.v1beta1.ListenResponse.documentRemove: object expected"); + message.documentRemove = $root.google.firestore.v1beta1.DocumentRemove.fromObject(object.documentRemove, long + 1); + } + if (object.filter != null) { + if (!$util.isObject(object.filter)) + throw TypeError(".google.firestore.v1beta1.ListenResponse.filter: object expected"); + message.filter = $root.google.firestore.v1beta1.ExistenceFilter.fromObject(object.filter, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a ListenResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.ListenResponse + * @static + * @param {google.firestore.v1beta1.ListenResponse} message ListenResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListenResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.targetChange != null && Object.hasOwnProperty.call(message, "targetChange")) { + object.targetChange = $root.google.firestore.v1beta1.TargetChange.toObject(message.targetChange, options, q + 1); + if (options.oneofs) + object.responseType = "targetChange"; + } + if (message.documentChange != null && Object.hasOwnProperty.call(message, "documentChange")) { + object.documentChange = $root.google.firestore.v1beta1.DocumentChange.toObject(message.documentChange, options, q + 1); + if (options.oneofs) + object.responseType = "documentChange"; + } + if (message.documentDelete != null && Object.hasOwnProperty.call(message, "documentDelete")) { + object.documentDelete = $root.google.firestore.v1beta1.DocumentDelete.toObject(message.documentDelete, options, q + 1); + if (options.oneofs) + object.responseType = "documentDelete"; + } + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) { + object.filter = $root.google.firestore.v1beta1.ExistenceFilter.toObject(message.filter, options, q + 1); + if (options.oneofs) + object.responseType = "filter"; + } + if (message.documentRemove != null && Object.hasOwnProperty.call(message, "documentRemove")) { + object.documentRemove = $root.google.firestore.v1beta1.DocumentRemove.toObject(message.documentRemove, options, q + 1); + if (options.oneofs) + object.responseType = "documentRemove"; + } + return object; + }; + + /** + * Converts this ListenResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.ListenResponse + * @instance + * @returns {Object.} JSON object + */ + ListenResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListenResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.ListenResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListenResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.ListenResponse"; + }; + + return ListenResponse; + })(); + + v1beta1.Target = (function() { + + /** + * Properties of a Target. + * @memberof google.firestore.v1beta1 + * @interface ITarget + * @property {google.firestore.v1beta1.Target.IQueryTarget|null} [query] Target query + * @property {google.firestore.v1beta1.Target.IDocumentsTarget|null} [documents] Target documents + * @property {Uint8Array|null} [resumeToken] Target resumeToken + * @property {google.protobuf.ITimestamp|null} [readTime] Target readTime + * @property {number|null} [targetId] Target targetId + * @property {boolean|null} [once] Target once + */ + + /** + * Constructs a new Target. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a Target. + * @implements ITarget + * @constructor + * @param {google.firestore.v1beta1.ITarget=} [properties] Properties to set + */ + function Target(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Target query. + * @member {google.firestore.v1beta1.Target.IQueryTarget|null|undefined} query + * @memberof google.firestore.v1beta1.Target + * @instance + */ + Target.prototype.query = null; + + /** + * Target documents. + * @member {google.firestore.v1beta1.Target.IDocumentsTarget|null|undefined} documents + * @memberof google.firestore.v1beta1.Target + * @instance + */ + Target.prototype.documents = null; + + /** + * Target resumeToken. + * @member {Uint8Array|null|undefined} resumeToken + * @memberof google.firestore.v1beta1.Target + * @instance + */ + Target.prototype.resumeToken = null; + + /** + * Target readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.Target + * @instance + */ + Target.prototype.readTime = null; + + /** + * Target targetId. + * @member {number} targetId + * @memberof google.firestore.v1beta1.Target + * @instance + */ + Target.prototype.targetId = 0; + + /** + * Target once. + * @member {boolean} once + * @memberof google.firestore.v1beta1.Target + * @instance + */ + Target.prototype.once = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Target targetType. + * @member {"query"|"documents"|undefined} targetType + * @memberof google.firestore.v1beta1.Target + * @instance + */ + Object.defineProperty(Target.prototype, "targetType", { + get: $util.oneOfGetter($oneOfFields = ["query", "documents"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Target resumeType. + * @member {"resumeToken"|"readTime"|undefined} resumeType + * @memberof google.firestore.v1beta1.Target + * @instance + */ + Object.defineProperty(Target.prototype, "resumeType", { + get: $util.oneOfGetter($oneOfFields = ["resumeToken", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Target instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.Target + * @static + * @param {google.firestore.v1beta1.ITarget=} [properties] Properties to set + * @returns {google.firestore.v1beta1.Target} Target instance + */ + Target.create = function create(properties) { + return new Target(properties); + }; + + /** + * Encodes the specified Target message. Does not implicitly {@link google.firestore.v1beta1.Target.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.Target + * @static + * @param {google.firestore.v1beta1.ITarget} message Target message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Target.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + $root.google.firestore.v1beta1.Target.QueryTarget.encode(message.query, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) + $root.google.firestore.v1beta1.Target.DocumentsTarget.encode(message.documents, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.resumeToken); + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.targetId); + if (message.once != null && Object.hasOwnProperty.call(message, "once")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.once); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 11, wireType 2 =*/90).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Target message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Target.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.Target + * @static + * @param {google.firestore.v1beta1.ITarget} message Target message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Target.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Target message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.Target + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.Target} Target + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Target.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.Target(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.query = $root.google.firestore.v1beta1.Target.QueryTarget.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.documents = $root.google.firestore.v1beta1.Target.DocumentsTarget.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.resumeToken = reader.bytes(); + break; + } + case 11: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.targetId = reader.int32(); + break; + } + case 6: { + message.once = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Target message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.Target + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.Target} Target + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Target.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Target message. + * @function verify + * @memberof google.firestore.v1beta1.Target + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Target.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.query != null && Object.hasOwnProperty.call(message, "query")) { + properties.targetType = 1; + { + var error = $root.google.firestore.v1beta1.Target.QueryTarget.verify(message.query, long + 1); + if (error) + return "query." + error; + } + } + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + if (properties.targetType === 1) + return "targetType: multiple values"; + properties.targetType = 1; + { + var error = $root.google.firestore.v1beta1.Target.DocumentsTarget.verify(message.documents, long + 1); + if (error) + return "documents." + error; + } + } + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) { + properties.resumeType = 1; + if (!(message.resumeToken && typeof message.resumeToken.length === "number" || $util.isString(message.resumeToken))) + return "resumeToken: buffer expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + if (properties.resumeType === 1) + return "resumeType: multiple values"; + properties.resumeType = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + } + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + if (!$util.isInteger(message.targetId)) + return "targetId: integer expected"; + if (message.once != null && Object.hasOwnProperty.call(message, "once")) + if (typeof message.once !== "boolean") + return "once: boolean expected"; + return null; + }; + + /** + * Creates a Target message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.Target + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.Target} Target + */ + Target.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.Target) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.Target: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.Target(); + if (object.query != null) { + if (!$util.isObject(object.query)) + throw TypeError(".google.firestore.v1beta1.Target.query: object expected"); + message.query = $root.google.firestore.v1beta1.Target.QueryTarget.fromObject(object.query, long + 1); + } + if (object.documents != null) { + if (!$util.isObject(object.documents)) + throw TypeError(".google.firestore.v1beta1.Target.documents: object expected"); + message.documents = $root.google.firestore.v1beta1.Target.DocumentsTarget.fromObject(object.documents, long + 1); + } + if (object.resumeToken != null) + if (typeof object.resumeToken === "string") + $util.base64.decode(object.resumeToken, message.resumeToken = $util.newBuffer($util.base64.length(object.resumeToken)), 0); + else if (object.resumeToken.length >= 0) + message.resumeToken = object.resumeToken; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.Target.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + if (object.targetId != null) + message.targetId = object.targetId | 0; + if (object.once != null) + message.once = Boolean(object.once); + return message; + }; + + /** + * Creates a plain object from a Target message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.Target + * @static + * @param {google.firestore.v1beta1.Target} message Target + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Target.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.targetId = 0; + object.once = false; + } + if (message.query != null && Object.hasOwnProperty.call(message, "query")) { + object.query = $root.google.firestore.v1beta1.Target.QueryTarget.toObject(message.query, options, q + 1); + if (options.oneofs) + object.targetType = "query"; + } + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + object.documents = $root.google.firestore.v1beta1.Target.DocumentsTarget.toObject(message.documents, options, q + 1); + if (options.oneofs) + object.targetType = "documents"; + } + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) { + object.resumeToken = options.bytes === String ? $util.base64.encode(message.resumeToken, 0, message.resumeToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.resumeToken) : message.resumeToken; + if (options.oneofs) + object.resumeType = "resumeToken"; + } + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + object.targetId = message.targetId; + if (message.once != null && Object.hasOwnProperty.call(message, "once")) + object.once = message.once; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (options.oneofs) + object.resumeType = "readTime"; + } + return object; + }; + + /** + * Converts this Target to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.Target + * @instance + * @returns {Object.} JSON object + */ + Target.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Target + * @function getTypeUrl + * @memberof google.firestore.v1beta1.Target + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Target.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.Target"; + }; + + Target.DocumentsTarget = (function() { + + /** + * Properties of a DocumentsTarget. + * @memberof google.firestore.v1beta1.Target + * @interface IDocumentsTarget + * @property {Array.|null} [documents] DocumentsTarget documents + */ + + /** + * Constructs a new DocumentsTarget. + * @memberof google.firestore.v1beta1.Target + * @classdesc Represents a DocumentsTarget. + * @implements IDocumentsTarget + * @constructor + * @param {google.firestore.v1beta1.Target.IDocumentsTarget=} [properties] Properties to set + */ + function DocumentsTarget(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentsTarget documents. + * @member {Array.} documents + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @instance + */ + DocumentsTarget.prototype.documents = $util.emptyArray; + + /** + * Creates a new DocumentsTarget instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @static + * @param {google.firestore.v1beta1.Target.IDocumentsTarget=} [properties] Properties to set + * @returns {google.firestore.v1beta1.Target.DocumentsTarget} DocumentsTarget instance + */ + DocumentsTarget.create = function create(properties) { + return new DocumentsTarget(properties); + }; + + /** + * Encodes the specified DocumentsTarget message. Does not implicitly {@link google.firestore.v1beta1.Target.DocumentsTarget.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @static + * @param {google.firestore.v1beta1.Target.IDocumentsTarget} message DocumentsTarget message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentsTarget.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.documents[i]); + return writer; + }; + + /** + * Encodes the specified DocumentsTarget message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Target.DocumentsTarget.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @static + * @param {google.firestore.v1beta1.Target.IDocumentsTarget} message DocumentsTarget message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentsTarget.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentsTarget message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.Target.DocumentsTarget} DocumentsTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentsTarget.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.Target.DocumentsTarget(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentsTarget message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.Target.DocumentsTarget} DocumentsTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentsTarget.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentsTarget message. + * @function verify + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentsTarget.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.documents != null && Object.hasOwnProperty.call(message, "documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) + if (!$util.isString(message.documents[i])) + return "documents: string[] expected"; + } + return null; + }; + + /** + * Creates a DocumentsTarget message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.Target.DocumentsTarget} DocumentsTarget + */ + DocumentsTarget.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.Target.DocumentsTarget) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.Target.DocumentsTarget: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.Target.DocumentsTarget(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.firestore.v1beta1.Target.DocumentsTarget.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) + message.documents[i] = String(object.documents[i]); + } + return message; + }; + + /** + * Creates a plain object from a DocumentsTarget message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @static + * @param {google.firestore.v1beta1.Target.DocumentsTarget} message DocumentsTarget + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentsTarget.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = message.documents[j]; + } + return object; + }; + + /** + * Converts this DocumentsTarget to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @instance + * @returns {Object.} JSON object + */ + DocumentsTarget.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentsTarget + * @function getTypeUrl + * @memberof google.firestore.v1beta1.Target.DocumentsTarget + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentsTarget.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.Target.DocumentsTarget"; + }; + + return DocumentsTarget; + })(); + + Target.QueryTarget = (function() { + + /** + * Properties of a QueryTarget. + * @memberof google.firestore.v1beta1.Target + * @interface IQueryTarget + * @property {string|null} [parent] QueryTarget parent + * @property {google.firestore.v1beta1.IStructuredQuery|null} [structuredQuery] QueryTarget structuredQuery + */ + + /** + * Constructs a new QueryTarget. + * @memberof google.firestore.v1beta1.Target + * @classdesc Represents a QueryTarget. + * @implements IQueryTarget + * @constructor + * @param {google.firestore.v1beta1.Target.IQueryTarget=} [properties] Properties to set + */ + function QueryTarget(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTarget parent. + * @member {string} parent + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @instance + */ + QueryTarget.prototype.parent = ""; + + /** + * QueryTarget structuredQuery. + * @member {google.firestore.v1beta1.IStructuredQuery|null|undefined} structuredQuery + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @instance + */ + QueryTarget.prototype.structuredQuery = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueryTarget queryType. + * @member {"structuredQuery"|undefined} queryType + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @instance + */ + Object.defineProperty(QueryTarget.prototype, "queryType", { + get: $util.oneOfGetter($oneOfFields = ["structuredQuery"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueryTarget instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @static + * @param {google.firestore.v1beta1.Target.IQueryTarget=} [properties] Properties to set + * @returns {google.firestore.v1beta1.Target.QueryTarget} QueryTarget instance + */ + QueryTarget.create = function create(properties) { + return new QueryTarget(properties); + }; + + /** + * Encodes the specified QueryTarget message. Does not implicitly {@link google.firestore.v1beta1.Target.QueryTarget.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @static + * @param {google.firestore.v1beta1.Target.IQueryTarget} message QueryTarget message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTarget.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) + $root.google.firestore.v1beta1.StructuredQuery.encode(message.structuredQuery, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryTarget message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Target.QueryTarget.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @static + * @param {google.firestore.v1beta1.Target.IQueryTarget} message QueryTarget message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTarget.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a QueryTarget message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.Target.QueryTarget} QueryTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTarget.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.Target.QueryTarget(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.structuredQuery = $root.google.firestore.v1beta1.StructuredQuery.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTarget message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.Target.QueryTarget} QueryTarget + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTarget.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTarget message. + * @function verify + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTarget.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + properties.queryType = 1; + { + var error = $root.google.firestore.v1beta1.StructuredQuery.verify(message.structuredQuery, long + 1); + if (error) + return "structuredQuery." + error; + } + } + return null; + }; + + /** + * Creates a QueryTarget message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.Target.QueryTarget} QueryTarget + */ + QueryTarget.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.Target.QueryTarget) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.Target.QueryTarget: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.Target.QueryTarget(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.structuredQuery != null) { + if (!$util.isObject(object.structuredQuery)) + throw TypeError(".google.firestore.v1beta1.Target.QueryTarget.structuredQuery: object expected"); + message.structuredQuery = $root.google.firestore.v1beta1.StructuredQuery.fromObject(object.structuredQuery, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a QueryTarget message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @static + * @param {google.firestore.v1beta1.Target.QueryTarget} message QueryTarget + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTarget.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.structuredQuery != null && Object.hasOwnProperty.call(message, "structuredQuery")) { + object.structuredQuery = $root.google.firestore.v1beta1.StructuredQuery.toObject(message.structuredQuery, options, q + 1); + if (options.oneofs) + object.queryType = "structuredQuery"; + } + return object; + }; + + /** + * Converts this QueryTarget to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @instance + * @returns {Object.} JSON object + */ + QueryTarget.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryTarget + * @function getTypeUrl + * @memberof google.firestore.v1beta1.Target.QueryTarget + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryTarget.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.Target.QueryTarget"; + }; + + return QueryTarget; + })(); + + return Target; + })(); + + v1beta1.TargetChange = (function() { + + /** + * Properties of a TargetChange. + * @memberof google.firestore.v1beta1 + * @interface ITargetChange + * @property {google.firestore.v1beta1.TargetChange.TargetChangeType|null} [targetChangeType] TargetChange targetChangeType + * @property {Array.|null} [targetIds] TargetChange targetIds + * @property {google.rpc.IStatus|null} [cause] TargetChange cause + * @property {Uint8Array|null} [resumeToken] TargetChange resumeToken + * @property {google.protobuf.ITimestamp|null} [readTime] TargetChange readTime + */ + + /** + * Constructs a new TargetChange. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a TargetChange. + * @implements ITargetChange + * @constructor + * @param {google.firestore.v1beta1.ITargetChange=} [properties] Properties to set + */ + function TargetChange(properties) { + this.targetIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * TargetChange targetChangeType. + * @member {google.firestore.v1beta1.TargetChange.TargetChangeType} targetChangeType + * @memberof google.firestore.v1beta1.TargetChange + * @instance + */ + TargetChange.prototype.targetChangeType = 0; + + /** + * TargetChange targetIds. + * @member {Array.} targetIds + * @memberof google.firestore.v1beta1.TargetChange + * @instance + */ + TargetChange.prototype.targetIds = $util.emptyArray; + + /** + * TargetChange cause. + * @member {google.rpc.IStatus|null|undefined} cause + * @memberof google.firestore.v1beta1.TargetChange + * @instance + */ + TargetChange.prototype.cause = null; + + /** + * TargetChange resumeToken. + * @member {Uint8Array} resumeToken + * @memberof google.firestore.v1beta1.TargetChange + * @instance + */ + TargetChange.prototype.resumeToken = $util.newBuffer([]); + + /** + * TargetChange readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.TargetChange + * @instance + */ + TargetChange.prototype.readTime = null; + + /** + * Creates a new TargetChange instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.TargetChange + * @static + * @param {google.firestore.v1beta1.ITargetChange=} [properties] Properties to set + * @returns {google.firestore.v1beta1.TargetChange} TargetChange instance + */ + TargetChange.create = function create(properties) { + return new TargetChange(properties); + }; + + /** + * Encodes the specified TargetChange message. Does not implicitly {@link google.firestore.v1beta1.TargetChange.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.TargetChange + * @static + * @param {google.firestore.v1beta1.ITargetChange} message TargetChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TargetChange.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.targetChangeType != null && Object.hasOwnProperty.call(message, "targetChangeType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.targetChangeType); + if (message.targetIds != null && message.targetIds.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.targetIds.length; ++i) + writer.int32(message.targetIds[i]); + writer.ldelim(); + } + if (message.cause != null && Object.hasOwnProperty.call(message, "cause")) + $root.google.rpc.Status.encode(message.cause, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.resumeToken); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified TargetChange message, length delimited. Does not implicitly {@link google.firestore.v1beta1.TargetChange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.TargetChange + * @static + * @param {google.firestore.v1beta1.ITargetChange} message TargetChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TargetChange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a TargetChange message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.TargetChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.TargetChange} TargetChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TargetChange.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.TargetChange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.targetChangeType = reader.int32(); + break; + } + case 2: { + if (!(message.targetIds && message.targetIds.length)) + message.targetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.targetIds.push(reader.int32()); + } else + message.targetIds.push(reader.int32()); + break; + } + case 3: { + message.cause = $root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.resumeToken = reader.bytes(); + break; + } + case 6: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a TargetChange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.TargetChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.TargetChange} TargetChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TargetChange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TargetChange message. + * @function verify + * @memberof google.firestore.v1beta1.TargetChange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TargetChange.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.targetChangeType != null && Object.hasOwnProperty.call(message, "targetChangeType")) + switch (message.targetChangeType) { + default: + return "targetChangeType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.targetIds != null && Object.hasOwnProperty.call(message, "targetIds")) { + if (!Array.isArray(message.targetIds)) + return "targetIds: array expected"; + for (var i = 0; i < message.targetIds.length; ++i) + if (!$util.isInteger(message.targetIds[i])) + return "targetIds: integer[] expected"; + } + if (message.cause != null && Object.hasOwnProperty.call(message, "cause")) { + var error = $root.google.rpc.Status.verify(message.cause, long + 1); + if (error) + return "cause." + error; + } + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) + if (!(message.resumeToken && typeof message.resumeToken.length === "number" || $util.isString(message.resumeToken))) + return "resumeToken: buffer expected"; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a TargetChange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.TargetChange + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.TargetChange} TargetChange + */ + TargetChange.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.TargetChange) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.TargetChange: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.TargetChange(); + switch (object.targetChangeType) { + default: + if (typeof object.targetChangeType === "number") { + message.targetChangeType = object.targetChangeType; + break; + } + break; + case "NO_CHANGE": + case 0: + message.targetChangeType = 0; + break; + case "ADD": + case 1: + message.targetChangeType = 1; + break; + case "REMOVE": + case 2: + message.targetChangeType = 2; + break; + case "CURRENT": + case 3: + message.targetChangeType = 3; + break; + case "RESET": + case 4: + message.targetChangeType = 4; + break; + } + if (object.targetIds) { + if (!Array.isArray(object.targetIds)) + throw TypeError(".google.firestore.v1beta1.TargetChange.targetIds: array expected"); + message.targetIds = []; + for (var i = 0; i < object.targetIds.length; ++i) + message.targetIds[i] = object.targetIds[i] | 0; + } + if (object.cause != null) { + if (!$util.isObject(object.cause)) + throw TypeError(".google.firestore.v1beta1.TargetChange.cause: object expected"); + message.cause = $root.google.rpc.Status.fromObject(object.cause, long + 1); + } + if (object.resumeToken != null) + if (typeof object.resumeToken === "string") + $util.base64.decode(object.resumeToken, message.resumeToken = $util.newBuffer($util.base64.length(object.resumeToken)), 0); + else if (object.resumeToken.length >= 0) + message.resumeToken = object.resumeToken; + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.TargetChange.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a TargetChange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.TargetChange + * @static + * @param {google.firestore.v1beta1.TargetChange} message TargetChange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TargetChange.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.targetIds = []; + if (options.defaults) { + object.targetChangeType = options.enums === String ? "NO_CHANGE" : 0; + object.cause = null; + if (options.bytes === String) + object.resumeToken = ""; + else { + object.resumeToken = []; + if (options.bytes !== Array) + object.resumeToken = $util.newBuffer(object.resumeToken); + } + object.readTime = null; + } + if (message.targetChangeType != null && Object.hasOwnProperty.call(message, "targetChangeType")) + object.targetChangeType = options.enums === String ? $root.google.firestore.v1beta1.TargetChange.TargetChangeType[message.targetChangeType] === undefined ? message.targetChangeType : $root.google.firestore.v1beta1.TargetChange.TargetChangeType[message.targetChangeType] : message.targetChangeType; + if (message.targetIds && message.targetIds.length) { + object.targetIds = []; + for (var j = 0; j < message.targetIds.length; ++j) + object.targetIds[j] = message.targetIds[j]; + } + if (message.cause != null && Object.hasOwnProperty.call(message, "cause")) + object.cause = $root.google.rpc.Status.toObject(message.cause, options, q + 1); + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) + object.resumeToken = options.bytes === String ? $util.base64.encode(message.resumeToken, 0, message.resumeToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.resumeToken) : message.resumeToken; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + return object; + }; + + /** + * Converts this TargetChange to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.TargetChange + * @instance + * @returns {Object.} JSON object + */ + TargetChange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TargetChange + * @function getTypeUrl + * @memberof google.firestore.v1beta1.TargetChange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TargetChange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.TargetChange"; + }; + + /** + * TargetChangeType enum. + * @name google.firestore.v1beta1.TargetChange.TargetChangeType + * @enum {number} + * @property {number} NO_CHANGE=0 NO_CHANGE value + * @property {number} ADD=1 ADD value + * @property {number} REMOVE=2 REMOVE value + * @property {number} CURRENT=3 CURRENT value + * @property {number} RESET=4 RESET value + */ + TargetChange.TargetChangeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NO_CHANGE"] = 0; + values[valuesById[1] = "ADD"] = 1; + values[valuesById[2] = "REMOVE"] = 2; + values[valuesById[3] = "CURRENT"] = 3; + values[valuesById[4] = "RESET"] = 4; + return values; + })(); + + return TargetChange; + })(); + + v1beta1.ListCollectionIdsRequest = (function() { + + /** + * Properties of a ListCollectionIdsRequest. + * @memberof google.firestore.v1beta1 + * @interface IListCollectionIdsRequest + * @property {string|null} [parent] ListCollectionIdsRequest parent + * @property {number|null} [pageSize] ListCollectionIdsRequest pageSize + * @property {string|null} [pageToken] ListCollectionIdsRequest pageToken + */ + + /** + * Constructs a new ListCollectionIdsRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a ListCollectionIdsRequest. + * @implements IListCollectionIdsRequest + * @constructor + * @param {google.firestore.v1beta1.IListCollectionIdsRequest=} [properties] Properties to set + */ + function ListCollectionIdsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCollectionIdsRequest parent. + * @member {string} parent + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @instance + */ + ListCollectionIdsRequest.prototype.parent = ""; + + /** + * ListCollectionIdsRequest pageSize. + * @member {number} pageSize + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @instance + */ + ListCollectionIdsRequest.prototype.pageSize = 0; + + /** + * ListCollectionIdsRequest pageToken. + * @member {string} pageToken + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @instance + */ + ListCollectionIdsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListCollectionIdsRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @static + * @param {google.firestore.v1beta1.IListCollectionIdsRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.ListCollectionIdsRequest} ListCollectionIdsRequest instance + */ + ListCollectionIdsRequest.create = function create(properties) { + return new ListCollectionIdsRequest(properties); + }; + + /** + * Encodes the specified ListCollectionIdsRequest message. Does not implicitly {@link google.firestore.v1beta1.ListCollectionIdsRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @static + * @param {google.firestore.v1beta1.IListCollectionIdsRequest} message ListCollectionIdsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCollectionIdsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListCollectionIdsRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListCollectionIdsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @static + * @param {google.firestore.v1beta1.IListCollectionIdsRequest} message ListCollectionIdsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCollectionIdsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListCollectionIdsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.ListCollectionIdsRequest} ListCollectionIdsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCollectionIdsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.ListCollectionIdsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListCollectionIdsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.ListCollectionIdsRequest} ListCollectionIdsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCollectionIdsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCollectionIdsRequest message. + * @function verify + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCollectionIdsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListCollectionIdsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.ListCollectionIdsRequest} ListCollectionIdsRequest + */ + ListCollectionIdsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.ListCollectionIdsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.ListCollectionIdsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.ListCollectionIdsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListCollectionIdsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @static + * @param {google.firestore.v1beta1.ListCollectionIdsRequest} message ListCollectionIdsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCollectionIdsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + object.parent = message.parent; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListCollectionIdsRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @instance + * @returns {Object.} JSON object + */ + ListCollectionIdsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListCollectionIdsRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.ListCollectionIdsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCollectionIdsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.ListCollectionIdsRequest"; + }; + + return ListCollectionIdsRequest; + })(); + + v1beta1.ListCollectionIdsResponse = (function() { + + /** + * Properties of a ListCollectionIdsResponse. + * @memberof google.firestore.v1beta1 + * @interface IListCollectionIdsResponse + * @property {Array.|null} [collectionIds] ListCollectionIdsResponse collectionIds + * @property {string|null} [nextPageToken] ListCollectionIdsResponse nextPageToken + */ + + /** + * Constructs a new ListCollectionIdsResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a ListCollectionIdsResponse. + * @implements IListCollectionIdsResponse + * @constructor + * @param {google.firestore.v1beta1.IListCollectionIdsResponse=} [properties] Properties to set + */ + function ListCollectionIdsResponse(properties) { + this.collectionIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCollectionIdsResponse collectionIds. + * @member {Array.} collectionIds + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @instance + */ + ListCollectionIdsResponse.prototype.collectionIds = $util.emptyArray; + + /** + * ListCollectionIdsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @instance + */ + ListCollectionIdsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListCollectionIdsResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @static + * @param {google.firestore.v1beta1.IListCollectionIdsResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.ListCollectionIdsResponse} ListCollectionIdsResponse instance + */ + ListCollectionIdsResponse.create = function create(properties) { + return new ListCollectionIdsResponse(properties); + }; + + /** + * Encodes the specified ListCollectionIdsResponse message. Does not implicitly {@link google.firestore.v1beta1.ListCollectionIdsResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @static + * @param {google.firestore.v1beta1.IListCollectionIdsResponse} message ListCollectionIdsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCollectionIdsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.collectionIds != null && message.collectionIds.length) + for (var i = 0; i < message.collectionIds.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.collectionIds[i]); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListCollectionIdsResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ListCollectionIdsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @static + * @param {google.firestore.v1beta1.IListCollectionIdsResponse} message ListCollectionIdsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCollectionIdsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListCollectionIdsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.ListCollectionIdsResponse} ListCollectionIdsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCollectionIdsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.ListCollectionIdsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.collectionIds && message.collectionIds.length)) + message.collectionIds = []; + message.collectionIds.push(reader.string()); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListCollectionIdsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.ListCollectionIdsResponse} ListCollectionIdsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCollectionIdsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCollectionIdsResponse message. + * @function verify + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCollectionIdsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.collectionIds != null && Object.hasOwnProperty.call(message, "collectionIds")) { + if (!Array.isArray(message.collectionIds)) + return "collectionIds: array expected"; + for (var i = 0; i < message.collectionIds.length; ++i) + if (!$util.isString(message.collectionIds[i])) + return "collectionIds: string[] expected"; + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListCollectionIdsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.ListCollectionIdsResponse} ListCollectionIdsResponse + */ + ListCollectionIdsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.ListCollectionIdsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.ListCollectionIdsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.ListCollectionIdsResponse(); + if (object.collectionIds) { + if (!Array.isArray(object.collectionIds)) + throw TypeError(".google.firestore.v1beta1.ListCollectionIdsResponse.collectionIds: array expected"); + message.collectionIds = []; + for (var i = 0; i < object.collectionIds.length; ++i) + message.collectionIds[i] = String(object.collectionIds[i]); + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListCollectionIdsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @static + * @param {google.firestore.v1beta1.ListCollectionIdsResponse} message ListCollectionIdsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCollectionIdsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.collectionIds = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.collectionIds && message.collectionIds.length) { + object.collectionIds = []; + for (var j = 0; j < message.collectionIds.length; ++j) + object.collectionIds[j] = message.collectionIds[j]; + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListCollectionIdsResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @instance + * @returns {Object.} JSON object + */ + ListCollectionIdsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListCollectionIdsResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.ListCollectionIdsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCollectionIdsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.ListCollectionIdsResponse"; + }; + + return ListCollectionIdsResponse; + })(); + + v1beta1.BatchWriteRequest = (function() { + + /** + * Properties of a BatchWriteRequest. + * @memberof google.firestore.v1beta1 + * @interface IBatchWriteRequest + * @property {string|null} [database] BatchWriteRequest database + * @property {Array.|null} [writes] BatchWriteRequest writes + * @property {Object.|null} [labels] BatchWriteRequest labels + */ + + /** + * Constructs a new BatchWriteRequest. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a BatchWriteRequest. + * @implements IBatchWriteRequest + * @constructor + * @param {google.firestore.v1beta1.IBatchWriteRequest=} [properties] Properties to set + */ + function BatchWriteRequest(properties) { + this.writes = []; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchWriteRequest database. + * @member {string} database + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @instance + */ + BatchWriteRequest.prototype.database = ""; + + /** + * BatchWriteRequest writes. + * @member {Array.} writes + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @instance + */ + BatchWriteRequest.prototype.writes = $util.emptyArray; + + /** + * BatchWriteRequest labels. + * @member {Object.} labels + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @instance + */ + BatchWriteRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new BatchWriteRequest instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @static + * @param {google.firestore.v1beta1.IBatchWriteRequest=} [properties] Properties to set + * @returns {google.firestore.v1beta1.BatchWriteRequest} BatchWriteRequest instance + */ + BatchWriteRequest.create = function create(properties) { + return new BatchWriteRequest(properties); + }; + + /** + * Encodes the specified BatchWriteRequest message. Does not implicitly {@link google.firestore.v1beta1.BatchWriteRequest.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @static + * @param {google.firestore.v1beta1.IBatchWriteRequest} message BatchWriteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchWriteRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.writes != null && message.writes.length) + for (var i = 0; i < message.writes.length; ++i) + $root.google.firestore.v1beta1.Write.encode(message.writes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchWriteRequest message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BatchWriteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @static + * @param {google.firestore.v1beta1.IBatchWriteRequest} message BatchWriteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchWriteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BatchWriteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.BatchWriteRequest} BatchWriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchWriteRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.BatchWriteRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + if (!(message.writes && message.writes.length)) + message.writes = []; + message.writes.push($root.google.firestore.v1beta1.Write.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.labels, key); + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BatchWriteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.BatchWriteRequest} BatchWriteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchWriteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchWriteRequest message. + * @function verify + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchWriteRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.writes != null && Object.hasOwnProperty.call(message, "writes")) { + if (!Array.isArray(message.writes)) + return "writes: array expected"; + for (var i = 0; i < message.writes.length; ++i) { + var error = $root.google.firestore.v1beta1.Write.verify(message.writes[i], long + 1); + if (error) + return "writes." + error; + } + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a BatchWriteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.BatchWriteRequest} BatchWriteRequest + */ + BatchWriteRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.BatchWriteRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.BatchWriteRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.BatchWriteRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.writes) { + if (!Array.isArray(object.writes)) + throw TypeError(".google.firestore.v1beta1.BatchWriteRequest.writes: array expected"); + message.writes = []; + for (var i = 0; i < object.writes.length; ++i) { + if (!$util.isObject(object.writes[i])) + throw TypeError(".google.firestore.v1beta1.BatchWriteRequest.writes: object expected"); + message.writes[i] = $root.google.firestore.v1beta1.Write.fromObject(object.writes[i], long + 1); + } + } + if (object.labels) { + if (!$util.isObject(object.labels)) + throw TypeError(".google.firestore.v1beta1.BatchWriteRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchWriteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @static + * @param {google.firestore.v1beta1.BatchWriteRequest} message BatchWriteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchWriteRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.writes = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) + object.database = ""; + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + object.database = message.database; + if (message.writes && message.writes.length) { + object.writes = []; + for (var j = 0; j < message.writes.length; ++j) + object.writes[j] = $root.google.firestore.v1beta1.Write.toObject(message.writes[j], options, q + 1); + } + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + } + return object; + }; + + /** + * Converts this BatchWriteRequest to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @instance + * @returns {Object.} JSON object + */ + BatchWriteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchWriteRequest + * @function getTypeUrl + * @memberof google.firestore.v1beta1.BatchWriteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchWriteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.BatchWriteRequest"; + }; + + return BatchWriteRequest; + })(); + + v1beta1.BatchWriteResponse = (function() { + + /** + * Properties of a BatchWriteResponse. + * @memberof google.firestore.v1beta1 + * @interface IBatchWriteResponse + * @property {Array.|null} [writeResults] BatchWriteResponse writeResults + * @property {Array.|null} [status] BatchWriteResponse status + */ + + /** + * Constructs a new BatchWriteResponse. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a BatchWriteResponse. + * @implements IBatchWriteResponse + * @constructor + * @param {google.firestore.v1beta1.IBatchWriteResponse=} [properties] Properties to set + */ + function BatchWriteResponse(properties) { + this.writeResults = []; + this.status = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchWriteResponse writeResults. + * @member {Array.} writeResults + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @instance + */ + BatchWriteResponse.prototype.writeResults = $util.emptyArray; + + /** + * BatchWriteResponse status. + * @member {Array.} status + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @instance + */ + BatchWriteResponse.prototype.status = $util.emptyArray; + + /** + * Creates a new BatchWriteResponse instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @static + * @param {google.firestore.v1beta1.IBatchWriteResponse=} [properties] Properties to set + * @returns {google.firestore.v1beta1.BatchWriteResponse} BatchWriteResponse instance + */ + BatchWriteResponse.create = function create(properties) { + return new BatchWriteResponse(properties); + }; + + /** + * Encodes the specified BatchWriteResponse message. Does not implicitly {@link google.firestore.v1beta1.BatchWriteResponse.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @static + * @param {google.firestore.v1beta1.IBatchWriteResponse} message BatchWriteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchWriteResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.writeResults != null && message.writeResults.length) + for (var i = 0; i < message.writeResults.length; ++i) + $root.google.firestore.v1beta1.WriteResult.encode(message.writeResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.status != null && message.status.length) + for (var i = 0; i < message.status.length; ++i) + $root.google.rpc.Status.encode(message.status[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchWriteResponse message, length delimited. Does not implicitly {@link google.firestore.v1beta1.BatchWriteResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @static + * @param {google.firestore.v1beta1.IBatchWriteResponse} message BatchWriteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchWriteResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BatchWriteResponse message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.BatchWriteResponse} BatchWriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchWriteResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.BatchWriteResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.writeResults && message.writeResults.length)) + message.writeResults = []; + message.writeResults.push($root.google.firestore.v1beta1.WriteResult.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + if (!(message.status && message.status.length)) + message.status = []; + message.status.push($root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BatchWriteResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.BatchWriteResponse} BatchWriteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchWriteResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchWriteResponse message. + * @function verify + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchWriteResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.writeResults != null && Object.hasOwnProperty.call(message, "writeResults")) { + if (!Array.isArray(message.writeResults)) + return "writeResults: array expected"; + for (var i = 0; i < message.writeResults.length; ++i) { + var error = $root.google.firestore.v1beta1.WriteResult.verify(message.writeResults[i], long + 1); + if (error) + return "writeResults." + error; + } + } + if (message.status != null && Object.hasOwnProperty.call(message, "status")) { + if (!Array.isArray(message.status)) + return "status: array expected"; + for (var i = 0; i < message.status.length; ++i) { + var error = $root.google.rpc.Status.verify(message.status[i], long + 1); + if (error) + return "status." + error; + } + } + return null; + }; + + /** + * Creates a BatchWriteResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.BatchWriteResponse} BatchWriteResponse + */ + BatchWriteResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.BatchWriteResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.BatchWriteResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.BatchWriteResponse(); + if (object.writeResults) { + if (!Array.isArray(object.writeResults)) + throw TypeError(".google.firestore.v1beta1.BatchWriteResponse.writeResults: array expected"); + message.writeResults = []; + for (var i = 0; i < object.writeResults.length; ++i) { + if (!$util.isObject(object.writeResults[i])) + throw TypeError(".google.firestore.v1beta1.BatchWriteResponse.writeResults: object expected"); + message.writeResults[i] = $root.google.firestore.v1beta1.WriteResult.fromObject(object.writeResults[i], long + 1); + } + } + if (object.status) { + if (!Array.isArray(object.status)) + throw TypeError(".google.firestore.v1beta1.BatchWriteResponse.status: array expected"); + message.status = []; + for (var i = 0; i < object.status.length; ++i) { + if (!$util.isObject(object.status[i])) + throw TypeError(".google.firestore.v1beta1.BatchWriteResponse.status: object expected"); + message.status[i] = $root.google.rpc.Status.fromObject(object.status[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchWriteResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @static + * @param {google.firestore.v1beta1.BatchWriteResponse} message BatchWriteResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchWriteResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.writeResults = []; + object.status = []; + } + if (message.writeResults && message.writeResults.length) { + object.writeResults = []; + for (var j = 0; j < message.writeResults.length; ++j) + object.writeResults[j] = $root.google.firestore.v1beta1.WriteResult.toObject(message.writeResults[j], options, q + 1); + } + if (message.status && message.status.length) { + object.status = []; + for (var j = 0; j < message.status.length; ++j) + object.status[j] = $root.google.rpc.Status.toObject(message.status[j], options, q + 1); + } + return object; + }; + + /** + * Converts this BatchWriteResponse to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @instance + * @returns {Object.} JSON object + */ + BatchWriteResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchWriteResponse + * @function getTypeUrl + * @memberof google.firestore.v1beta1.BatchWriteResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchWriteResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.BatchWriteResponse"; + }; + + return BatchWriteResponse; + })(); + + v1beta1.StructuredQuery = (function() { + + /** + * Properties of a StructuredQuery. + * @memberof google.firestore.v1beta1 + * @interface IStructuredQuery + * @property {google.firestore.v1beta1.StructuredQuery.IProjection|null} [select] StructuredQuery select + * @property {Array.|null} [from] StructuredQuery from + * @property {google.firestore.v1beta1.StructuredQuery.IFilter|null} [where] StructuredQuery where + * @property {Array.|null} [orderBy] StructuredQuery orderBy + * @property {google.firestore.v1beta1.ICursor|null} [startAt] StructuredQuery startAt + * @property {google.firestore.v1beta1.ICursor|null} [endAt] StructuredQuery endAt + * @property {number|null} [offset] StructuredQuery offset + * @property {google.protobuf.IInt32Value|null} [limit] StructuredQuery limit + */ + + /** + * Constructs a new StructuredQuery. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a StructuredQuery. + * @implements IStructuredQuery + * @constructor + * @param {google.firestore.v1beta1.IStructuredQuery=} [properties] Properties to set + */ + function StructuredQuery(properties) { + this.from = []; + this.orderBy = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * StructuredQuery select. + * @member {google.firestore.v1beta1.StructuredQuery.IProjection|null|undefined} select + * @memberof google.firestore.v1beta1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.select = null; + + /** + * StructuredQuery from. + * @member {Array.} from + * @memberof google.firestore.v1beta1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.from = $util.emptyArray; + + /** + * StructuredQuery where. + * @member {google.firestore.v1beta1.StructuredQuery.IFilter|null|undefined} where + * @memberof google.firestore.v1beta1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.where = null; + + /** + * StructuredQuery orderBy. + * @member {Array.} orderBy + * @memberof google.firestore.v1beta1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.orderBy = $util.emptyArray; + + /** + * StructuredQuery startAt. + * @member {google.firestore.v1beta1.ICursor|null|undefined} startAt + * @memberof google.firestore.v1beta1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.startAt = null; + + /** + * StructuredQuery endAt. + * @member {google.firestore.v1beta1.ICursor|null|undefined} endAt + * @memberof google.firestore.v1beta1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.endAt = null; + + /** + * StructuredQuery offset. + * @member {number} offset + * @memberof google.firestore.v1beta1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.offset = 0; + + /** + * StructuredQuery limit. + * @member {google.protobuf.IInt32Value|null|undefined} limit + * @memberof google.firestore.v1beta1.StructuredQuery + * @instance + */ + StructuredQuery.prototype.limit = null; + + /** + * Creates a new StructuredQuery instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.StructuredQuery + * @static + * @param {google.firestore.v1beta1.IStructuredQuery=} [properties] Properties to set + * @returns {google.firestore.v1beta1.StructuredQuery} StructuredQuery instance + */ + StructuredQuery.create = function create(properties) { + return new StructuredQuery(properties); + }; + + /** + * Encodes the specified StructuredQuery message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.StructuredQuery + * @static + * @param {google.firestore.v1beta1.IStructuredQuery} message StructuredQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StructuredQuery.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.select != null && Object.hasOwnProperty.call(message, "select")) + $root.google.firestore.v1beta1.StructuredQuery.Projection.encode(message.select, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.from != null && message.from.length) + for (var i = 0; i < message.from.length; ++i) + $root.google.firestore.v1beta1.StructuredQuery.CollectionSelector.encode(message.from[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.where != null && Object.hasOwnProperty.call(message, "where")) + $root.google.firestore.v1beta1.StructuredQuery.Filter.encode(message.where, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.orderBy != null && message.orderBy.length) + for (var i = 0; i < message.orderBy.length; ++i) + $root.google.firestore.v1beta1.StructuredQuery.Order.encode(message.orderBy[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + $root.google.protobuf.Int32Value.encode(message.limit, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.offset); + if (message.startAt != null && Object.hasOwnProperty.call(message, "startAt")) + $root.google.firestore.v1beta1.Cursor.encode(message.startAt, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.endAt != null && Object.hasOwnProperty.call(message, "endAt")) + $root.google.firestore.v1beta1.Cursor.encode(message.endAt, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified StructuredQuery message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery + * @static + * @param {google.firestore.v1beta1.IStructuredQuery} message StructuredQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StructuredQuery.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a StructuredQuery message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.StructuredQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.StructuredQuery} StructuredQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StructuredQuery.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.StructuredQuery(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.select = $root.google.firestore.v1beta1.StructuredQuery.Projection.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + if (!(message.from && message.from.length)) + message.from = []; + message.from.push($root.google.firestore.v1beta1.StructuredQuery.CollectionSelector.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + message.where = $root.google.firestore.v1beta1.StructuredQuery.Filter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + if (!(message.orderBy && message.orderBy.length)) + message.orderBy = []; + message.orderBy.push($root.google.firestore.v1beta1.StructuredQuery.Order.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 7: { + message.startAt = $root.google.firestore.v1beta1.Cursor.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 8: { + message.endAt = $root.google.firestore.v1beta1.Cursor.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.offset = reader.int32(); + break; + } + case 5: { + message.limit = $root.google.protobuf.Int32Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a StructuredQuery message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.StructuredQuery} StructuredQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StructuredQuery.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StructuredQuery message. + * @function verify + * @memberof google.firestore.v1beta1.StructuredQuery + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StructuredQuery.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.select != null && Object.hasOwnProperty.call(message, "select")) { + var error = $root.google.firestore.v1beta1.StructuredQuery.Projection.verify(message.select, long + 1); + if (error) + return "select." + error; + } + if (message.from != null && Object.hasOwnProperty.call(message, "from")) { + if (!Array.isArray(message.from)) + return "from: array expected"; + for (var i = 0; i < message.from.length; ++i) { + var error = $root.google.firestore.v1beta1.StructuredQuery.CollectionSelector.verify(message.from[i], long + 1); + if (error) + return "from." + error; + } + } + if (message.where != null && Object.hasOwnProperty.call(message, "where")) { + var error = $root.google.firestore.v1beta1.StructuredQuery.Filter.verify(message.where, long + 1); + if (error) + return "where." + error; + } + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) { + if (!Array.isArray(message.orderBy)) + return "orderBy: array expected"; + for (var i = 0; i < message.orderBy.length; ++i) { + var error = $root.google.firestore.v1beta1.StructuredQuery.Order.verify(message.orderBy[i], long + 1); + if (error) + return "orderBy." + error; + } + } + if (message.startAt != null && Object.hasOwnProperty.call(message, "startAt")) { + var error = $root.google.firestore.v1beta1.Cursor.verify(message.startAt, long + 1); + if (error) + return "startAt." + error; + } + if (message.endAt != null && Object.hasOwnProperty.call(message, "endAt")) { + var error = $root.google.firestore.v1beta1.Cursor.verify(message.endAt, long + 1); + if (error) + return "endAt." + error; + } + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) { + var error = $root.google.protobuf.Int32Value.verify(message.limit, long + 1); + if (error) + return "limit." + error; + } + return null; + }; + + /** + * Creates a StructuredQuery message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.StructuredQuery + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.StructuredQuery} StructuredQuery + */ + StructuredQuery.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.StructuredQuery) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.StructuredQuery(); + if (object.select != null) { + if (!$util.isObject(object.select)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.select: object expected"); + message.select = $root.google.firestore.v1beta1.StructuredQuery.Projection.fromObject(object.select, long + 1); + } + if (object.from) { + if (!Array.isArray(object.from)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.from: array expected"); + message.from = []; + for (var i = 0; i < object.from.length; ++i) { + if (!$util.isObject(object.from[i])) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.from: object expected"); + message.from[i] = $root.google.firestore.v1beta1.StructuredQuery.CollectionSelector.fromObject(object.from[i], long + 1); + } + } + if (object.where != null) { + if (!$util.isObject(object.where)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.where: object expected"); + message.where = $root.google.firestore.v1beta1.StructuredQuery.Filter.fromObject(object.where, long + 1); + } + if (object.orderBy) { + if (!Array.isArray(object.orderBy)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.orderBy: array expected"); + message.orderBy = []; + for (var i = 0; i < object.orderBy.length; ++i) { + if (!$util.isObject(object.orderBy[i])) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.orderBy: object expected"); + message.orderBy[i] = $root.google.firestore.v1beta1.StructuredQuery.Order.fromObject(object.orderBy[i], long + 1); + } + } + if (object.startAt != null) { + if (!$util.isObject(object.startAt)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.startAt: object expected"); + message.startAt = $root.google.firestore.v1beta1.Cursor.fromObject(object.startAt, long + 1); + } + if (object.endAt != null) { + if (!$util.isObject(object.endAt)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.endAt: object expected"); + message.endAt = $root.google.firestore.v1beta1.Cursor.fromObject(object.endAt, long + 1); + } + if (object.offset != null) + message.offset = object.offset | 0; + if (object.limit != null) { + if (!$util.isObject(object.limit)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.limit: object expected"); + message.limit = $root.google.protobuf.Int32Value.fromObject(object.limit, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a StructuredQuery message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.StructuredQuery + * @static + * @param {google.firestore.v1beta1.StructuredQuery} message StructuredQuery + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StructuredQuery.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.from = []; + object.orderBy = []; + } + if (options.defaults) { + object.select = null; + object.where = null; + object.limit = null; + object.offset = 0; + object.startAt = null; + object.endAt = null; + } + if (message.select != null && Object.hasOwnProperty.call(message, "select")) + object.select = $root.google.firestore.v1beta1.StructuredQuery.Projection.toObject(message.select, options, q + 1); + if (message.from && message.from.length) { + object.from = []; + for (var j = 0; j < message.from.length; ++j) + object.from[j] = $root.google.firestore.v1beta1.StructuredQuery.CollectionSelector.toObject(message.from[j], options, q + 1); + } + if (message.where != null && Object.hasOwnProperty.call(message, "where")) + object.where = $root.google.firestore.v1beta1.StructuredQuery.Filter.toObject(message.where, options, q + 1); + if (message.orderBy && message.orderBy.length) { + object.orderBy = []; + for (var j = 0; j < message.orderBy.length; ++j) + object.orderBy[j] = $root.google.firestore.v1beta1.StructuredQuery.Order.toObject(message.orderBy[j], options, q + 1); + } + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + object.limit = $root.google.protobuf.Int32Value.toObject(message.limit, options, q + 1); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + object.offset = message.offset; + if (message.startAt != null && Object.hasOwnProperty.call(message, "startAt")) + object.startAt = $root.google.firestore.v1beta1.Cursor.toObject(message.startAt, options, q + 1); + if (message.endAt != null && Object.hasOwnProperty.call(message, "endAt")) + object.endAt = $root.google.firestore.v1beta1.Cursor.toObject(message.endAt, options, q + 1); + return object; + }; + + /** + * Converts this StructuredQuery to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.StructuredQuery + * @instance + * @returns {Object.} JSON object + */ + StructuredQuery.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StructuredQuery + * @function getTypeUrl + * @memberof google.firestore.v1beta1.StructuredQuery + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StructuredQuery.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.StructuredQuery"; + }; + + StructuredQuery.CollectionSelector = (function() { + + /** + * Properties of a CollectionSelector. + * @memberof google.firestore.v1beta1.StructuredQuery + * @interface ICollectionSelector + * @property {string|null} [collectionId] CollectionSelector collectionId + * @property {boolean|null} [allDescendants] CollectionSelector allDescendants + */ + + /** + * Constructs a new CollectionSelector. + * @memberof google.firestore.v1beta1.StructuredQuery + * @classdesc Represents a CollectionSelector. + * @implements ICollectionSelector + * @constructor + * @param {google.firestore.v1beta1.StructuredQuery.ICollectionSelector=} [properties] Properties to set + */ + function CollectionSelector(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CollectionSelector collectionId. + * @member {string} collectionId + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @instance + */ + CollectionSelector.prototype.collectionId = ""; + + /** + * CollectionSelector allDescendants. + * @member {boolean} allDescendants + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @instance + */ + CollectionSelector.prototype.allDescendants = false; + + /** + * Creates a new CollectionSelector instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @static + * @param {google.firestore.v1beta1.StructuredQuery.ICollectionSelector=} [properties] Properties to set + * @returns {google.firestore.v1beta1.StructuredQuery.CollectionSelector} CollectionSelector instance + */ + CollectionSelector.create = function create(properties) { + return new CollectionSelector(properties); + }; + + /** + * Encodes the specified CollectionSelector message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.CollectionSelector.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @static + * @param {google.firestore.v1beta1.StructuredQuery.ICollectionSelector} message CollectionSelector message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectionSelector.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.collectionId); + if (message.allDescendants != null && Object.hasOwnProperty.call(message, "allDescendants")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allDescendants); + return writer; + }; + + /** + * Encodes the specified CollectionSelector message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.CollectionSelector.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @static + * @param {google.firestore.v1beta1.StructuredQuery.ICollectionSelector} message CollectionSelector message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectionSelector.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CollectionSelector message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.StructuredQuery.CollectionSelector} CollectionSelector + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectionSelector.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.StructuredQuery.CollectionSelector(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.collectionId = reader.string(); + break; + } + case 3: { + message.allDescendants = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CollectionSelector message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.StructuredQuery.CollectionSelector} CollectionSelector + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectionSelector.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CollectionSelector message. + * @function verify + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CollectionSelector.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + if (!$util.isString(message.collectionId)) + return "collectionId: string expected"; + if (message.allDescendants != null && Object.hasOwnProperty.call(message, "allDescendants")) + if (typeof message.allDescendants !== "boolean") + return "allDescendants: boolean expected"; + return null; + }; + + /** + * Creates a CollectionSelector message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.StructuredQuery.CollectionSelector} CollectionSelector + */ + CollectionSelector.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.StructuredQuery.CollectionSelector) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.CollectionSelector: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.StructuredQuery.CollectionSelector(); + if (object.collectionId != null) + message.collectionId = String(object.collectionId); + if (object.allDescendants != null) + message.allDescendants = Boolean(object.allDescendants); + return message; + }; + + /** + * Creates a plain object from a CollectionSelector message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @static + * @param {google.firestore.v1beta1.StructuredQuery.CollectionSelector} message CollectionSelector + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CollectionSelector.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.collectionId = ""; + object.allDescendants = false; + } + if (message.collectionId != null && Object.hasOwnProperty.call(message, "collectionId")) + object.collectionId = message.collectionId; + if (message.allDescendants != null && Object.hasOwnProperty.call(message, "allDescendants")) + object.allDescendants = message.allDescendants; + return object; + }; + + /** + * Converts this CollectionSelector to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @instance + * @returns {Object.} JSON object + */ + CollectionSelector.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CollectionSelector + * @function getTypeUrl + * @memberof google.firestore.v1beta1.StructuredQuery.CollectionSelector + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CollectionSelector.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.StructuredQuery.CollectionSelector"; + }; + + return CollectionSelector; + })(); + + StructuredQuery.Filter = (function() { + + /** + * Properties of a Filter. + * @memberof google.firestore.v1beta1.StructuredQuery + * @interface IFilter + * @property {google.firestore.v1beta1.StructuredQuery.ICompositeFilter|null} [compositeFilter] Filter compositeFilter + * @property {google.firestore.v1beta1.StructuredQuery.IFieldFilter|null} [fieldFilter] Filter fieldFilter + * @property {google.firestore.v1beta1.StructuredQuery.IUnaryFilter|null} [unaryFilter] Filter unaryFilter + */ + + /** + * Constructs a new Filter. + * @memberof google.firestore.v1beta1.StructuredQuery + * @classdesc Represents a Filter. + * @implements IFilter + * @constructor + * @param {google.firestore.v1beta1.StructuredQuery.IFilter=} [properties] Properties to set + */ + function Filter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Filter compositeFilter. + * @member {google.firestore.v1beta1.StructuredQuery.ICompositeFilter|null|undefined} compositeFilter + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @instance + */ + Filter.prototype.compositeFilter = null; + + /** + * Filter fieldFilter. + * @member {google.firestore.v1beta1.StructuredQuery.IFieldFilter|null|undefined} fieldFilter + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @instance + */ + Filter.prototype.fieldFilter = null; + + /** + * Filter unaryFilter. + * @member {google.firestore.v1beta1.StructuredQuery.IUnaryFilter|null|undefined} unaryFilter + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @instance + */ + Filter.prototype.unaryFilter = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Filter filterType. + * @member {"compositeFilter"|"fieldFilter"|"unaryFilter"|undefined} filterType + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @instance + */ + Object.defineProperty(Filter.prototype, "filterType", { + get: $util.oneOfGetter($oneOfFields = ["compositeFilter", "fieldFilter", "unaryFilter"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Filter instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IFilter=} [properties] Properties to set + * @returns {google.firestore.v1beta1.StructuredQuery.Filter} Filter instance + */ + Filter.create = function create(properties) { + return new Filter(properties); + }; + + /** + * Encodes the specified Filter message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Filter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IFilter} message Filter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Filter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.compositeFilter != null && Object.hasOwnProperty.call(message, "compositeFilter")) + $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter.encode(message.compositeFilter, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.fieldFilter != null && Object.hasOwnProperty.call(message, "fieldFilter")) + $root.google.firestore.v1beta1.StructuredQuery.FieldFilter.encode(message.fieldFilter, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.unaryFilter != null && Object.hasOwnProperty.call(message, "unaryFilter")) + $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter.encode(message.unaryFilter, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Filter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Filter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IFilter} message Filter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Filter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Filter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.StructuredQuery.Filter} Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Filter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.StructuredQuery.Filter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.compositeFilter = $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.fieldFilter = $root.google.firestore.v1beta1.StructuredQuery.FieldFilter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.unaryFilter = $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Filter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.StructuredQuery.Filter} Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Filter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Filter message. + * @function verify + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Filter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.compositeFilter != null && Object.hasOwnProperty.call(message, "compositeFilter")) { + properties.filterType = 1; + { + var error = $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter.verify(message.compositeFilter, long + 1); + if (error) + return "compositeFilter." + error; + } + } + if (message.fieldFilter != null && Object.hasOwnProperty.call(message, "fieldFilter")) { + if (properties.filterType === 1) + return "filterType: multiple values"; + properties.filterType = 1; + { + var error = $root.google.firestore.v1beta1.StructuredQuery.FieldFilter.verify(message.fieldFilter, long + 1); + if (error) + return "fieldFilter." + error; + } + } + if (message.unaryFilter != null && Object.hasOwnProperty.call(message, "unaryFilter")) { + if (properties.filterType === 1) + return "filterType: multiple values"; + properties.filterType = 1; + { + var error = $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter.verify(message.unaryFilter, long + 1); + if (error) + return "unaryFilter." + error; + } + } + return null; + }; + + /** + * Creates a Filter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.StructuredQuery.Filter} Filter + */ + Filter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.StructuredQuery.Filter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.Filter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.StructuredQuery.Filter(); + if (object.compositeFilter != null) { + if (!$util.isObject(object.compositeFilter)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.Filter.compositeFilter: object expected"); + message.compositeFilter = $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter.fromObject(object.compositeFilter, long + 1); + } + if (object.fieldFilter != null) { + if (!$util.isObject(object.fieldFilter)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.Filter.fieldFilter: object expected"); + message.fieldFilter = $root.google.firestore.v1beta1.StructuredQuery.FieldFilter.fromObject(object.fieldFilter, long + 1); + } + if (object.unaryFilter != null) { + if (!$util.isObject(object.unaryFilter)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.Filter.unaryFilter: object expected"); + message.unaryFilter = $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter.fromObject(object.unaryFilter, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Filter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.Filter} message Filter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Filter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.compositeFilter != null && Object.hasOwnProperty.call(message, "compositeFilter")) { + object.compositeFilter = $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter.toObject(message.compositeFilter, options, q + 1); + if (options.oneofs) + object.filterType = "compositeFilter"; + } + if (message.fieldFilter != null && Object.hasOwnProperty.call(message, "fieldFilter")) { + object.fieldFilter = $root.google.firestore.v1beta1.StructuredQuery.FieldFilter.toObject(message.fieldFilter, options, q + 1); + if (options.oneofs) + object.filterType = "fieldFilter"; + } + if (message.unaryFilter != null && Object.hasOwnProperty.call(message, "unaryFilter")) { + object.unaryFilter = $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter.toObject(message.unaryFilter, options, q + 1); + if (options.oneofs) + object.filterType = "unaryFilter"; + } + return object; + }; + + /** + * Converts this Filter to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @instance + * @returns {Object.} JSON object + */ + Filter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Filter + * @function getTypeUrl + * @memberof google.firestore.v1beta1.StructuredQuery.Filter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Filter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.StructuredQuery.Filter"; + }; + + return Filter; + })(); + + StructuredQuery.CompositeFilter = (function() { + + /** + * Properties of a CompositeFilter. + * @memberof google.firestore.v1beta1.StructuredQuery + * @interface ICompositeFilter + * @property {google.firestore.v1beta1.StructuredQuery.CompositeFilter.Operator|null} [op] CompositeFilter op + * @property {Array.|null} [filters] CompositeFilter filters + */ + + /** + * Constructs a new CompositeFilter. + * @memberof google.firestore.v1beta1.StructuredQuery + * @classdesc Represents a CompositeFilter. + * @implements ICompositeFilter + * @constructor + * @param {google.firestore.v1beta1.StructuredQuery.ICompositeFilter=} [properties] Properties to set + */ + function CompositeFilter(properties) { + this.filters = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompositeFilter op. + * @member {google.firestore.v1beta1.StructuredQuery.CompositeFilter.Operator} op + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @instance + */ + CompositeFilter.prototype.op = 0; + + /** + * CompositeFilter filters. + * @member {Array.} filters + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @instance + */ + CompositeFilter.prototype.filters = $util.emptyArray; + + /** + * Creates a new CompositeFilter instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.ICompositeFilter=} [properties] Properties to set + * @returns {google.firestore.v1beta1.StructuredQuery.CompositeFilter} CompositeFilter instance + */ + CompositeFilter.create = function create(properties) { + return new CompositeFilter(properties); + }; + + /** + * Encodes the specified CompositeFilter message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.CompositeFilter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.ICompositeFilter} message CompositeFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompositeFilter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.op); + if (message.filters != null && message.filters.length) + for (var i = 0; i < message.filters.length; ++i) + $root.google.firestore.v1beta1.StructuredQuery.Filter.encode(message.filters[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompositeFilter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.CompositeFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.ICompositeFilter} message CompositeFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompositeFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CompositeFilter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.StructuredQuery.CompositeFilter} CompositeFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompositeFilter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.op = reader.int32(); + break; + } + case 2: { + if (!(message.filters && message.filters.length)) + message.filters = []; + message.filters.push($root.google.firestore.v1beta1.StructuredQuery.Filter.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CompositeFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.StructuredQuery.CompositeFilter} CompositeFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompositeFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompositeFilter message. + * @function verify + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompositeFilter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + switch (message.op) { + default: + return "op: enum value expected"; + case 0: + case 1: + break; + } + if (message.filters != null && Object.hasOwnProperty.call(message, "filters")) { + if (!Array.isArray(message.filters)) + return "filters: array expected"; + for (var i = 0; i < message.filters.length; ++i) { + var error = $root.google.firestore.v1beta1.StructuredQuery.Filter.verify(message.filters[i], long + 1); + if (error) + return "filters." + error; + } + } + return null; + }; + + /** + * Creates a CompositeFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.StructuredQuery.CompositeFilter} CompositeFilter + */ + CompositeFilter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.CompositeFilter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter(); + switch (object.op) { + default: + if (typeof object.op === "number") { + message.op = object.op; + break; + } + break; + case "OPERATOR_UNSPECIFIED": + case 0: + message.op = 0; + break; + case "AND": + case 1: + message.op = 1; + break; + } + if (object.filters) { + if (!Array.isArray(object.filters)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.CompositeFilter.filters: array expected"); + message.filters = []; + for (var i = 0; i < object.filters.length; ++i) { + if (!$util.isObject(object.filters[i])) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.CompositeFilter.filters: object expected"); + message.filters[i] = $root.google.firestore.v1beta1.StructuredQuery.Filter.fromObject(object.filters[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a CompositeFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.CompositeFilter} message CompositeFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompositeFilter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.filters = []; + if (options.defaults) + object.op = options.enums === String ? "OPERATOR_UNSPECIFIED" : 0; + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + object.op = options.enums === String ? $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter.Operator[message.op] === undefined ? message.op : $root.google.firestore.v1beta1.StructuredQuery.CompositeFilter.Operator[message.op] : message.op; + if (message.filters && message.filters.length) { + object.filters = []; + for (var j = 0; j < message.filters.length; ++j) + object.filters[j] = $root.google.firestore.v1beta1.StructuredQuery.Filter.toObject(message.filters[j], options, q + 1); + } + return object; + }; + + /** + * Converts this CompositeFilter to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @instance + * @returns {Object.} JSON object + */ + CompositeFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CompositeFilter + * @function getTypeUrl + * @memberof google.firestore.v1beta1.StructuredQuery.CompositeFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompositeFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.StructuredQuery.CompositeFilter"; + }; + + /** + * Operator enum. + * @name google.firestore.v1beta1.StructuredQuery.CompositeFilter.Operator + * @enum {number} + * @property {number} OPERATOR_UNSPECIFIED=0 OPERATOR_UNSPECIFIED value + * @property {number} AND=1 AND value + */ + CompositeFilter.Operator = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "AND"] = 1; + return values; + })(); + + return CompositeFilter; + })(); + + StructuredQuery.FieldFilter = (function() { + + /** + * Properties of a FieldFilter. + * @memberof google.firestore.v1beta1.StructuredQuery + * @interface IFieldFilter + * @property {google.firestore.v1beta1.StructuredQuery.IFieldReference|null} [field] FieldFilter field + * @property {google.firestore.v1beta1.StructuredQuery.FieldFilter.Operator|null} [op] FieldFilter op + * @property {google.firestore.v1beta1.IValue|null} [value] FieldFilter value + */ + + /** + * Constructs a new FieldFilter. + * @memberof google.firestore.v1beta1.StructuredQuery + * @classdesc Represents a FieldFilter. + * @implements IFieldFilter + * @constructor + * @param {google.firestore.v1beta1.StructuredQuery.IFieldFilter=} [properties] Properties to set + */ + function FieldFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldFilter field. + * @member {google.firestore.v1beta1.StructuredQuery.IFieldReference|null|undefined} field + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @instance + */ + FieldFilter.prototype.field = null; + + /** + * FieldFilter op. + * @member {google.firestore.v1beta1.StructuredQuery.FieldFilter.Operator} op + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @instance + */ + FieldFilter.prototype.op = 0; + + /** + * FieldFilter value. + * @member {google.firestore.v1beta1.IValue|null|undefined} value + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @instance + */ + FieldFilter.prototype.value = null; + + /** + * Creates a new FieldFilter instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IFieldFilter=} [properties] Properties to set + * @returns {google.firestore.v1beta1.StructuredQuery.FieldFilter} FieldFilter instance + */ + FieldFilter.create = function create(properties) { + return new FieldFilter(properties); + }; + + /** + * Encodes the specified FieldFilter message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.FieldFilter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IFieldFilter} message FieldFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldFilter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + $root.google.firestore.v1beta1.StructuredQuery.FieldReference.encode(message.field, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.op); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + $root.google.firestore.v1beta1.Value.encode(message.value, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldFilter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.FieldFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IFieldFilter} message FieldFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldFilter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.StructuredQuery.FieldFilter} FieldFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldFilter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.StructuredQuery.FieldFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.field = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.op = reader.int32(); + break; + } + case 3: { + message.value = $root.google.firestore.v1beta1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.StructuredQuery.FieldFilter} FieldFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldFilter message. + * @function verify + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldFilter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + var error = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.verify(message.field, long + 1); + if (error) + return "field." + error; + } + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + switch (message.op) { + default: + return "op: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + break; + } + if (message.value != null && Object.hasOwnProperty.call(message, "value")) { + var error = $root.google.firestore.v1beta1.Value.verify(message.value, long + 1); + if (error) + return "value." + error; + } + return null; + }; + + /** + * Creates a FieldFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.StructuredQuery.FieldFilter} FieldFilter + */ + FieldFilter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.StructuredQuery.FieldFilter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.FieldFilter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.StructuredQuery.FieldFilter(); + if (object.field != null) { + if (!$util.isObject(object.field)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.FieldFilter.field: object expected"); + message.field = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.fromObject(object.field, long + 1); + } + switch (object.op) { + default: + if (typeof object.op === "number") { + message.op = object.op; + break; + } + break; + case "OPERATOR_UNSPECIFIED": + case 0: + message.op = 0; + break; + case "LESS_THAN": + case 1: + message.op = 1; + break; + case "LESS_THAN_OR_EQUAL": + case 2: + message.op = 2; + break; + case "GREATER_THAN": + case 3: + message.op = 3; + break; + case "GREATER_THAN_OR_EQUAL": + case 4: + message.op = 4; + break; + case "EQUAL": + case 5: + message.op = 5; + break; + case "NOT_EQUAL": + case 6: + message.op = 6; + break; + case "ARRAY_CONTAINS": + case 7: + message.op = 7; + break; + case "IN": + case 8: + message.op = 8; + break; + case "ARRAY_CONTAINS_ANY": + case 9: + message.op = 9; + break; + case "NOT_IN": + case 10: + message.op = 10; + break; + } + if (object.value != null) { + if (!$util.isObject(object.value)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.FieldFilter.value: object expected"); + message.value = $root.google.firestore.v1beta1.Value.fromObject(object.value, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a FieldFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.FieldFilter} message FieldFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldFilter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.field = null; + object.op = options.enums === String ? "OPERATOR_UNSPECIFIED" : 0; + object.value = null; + } + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + object.field = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.toObject(message.field, options, q + 1); + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + object.op = options.enums === String ? $root.google.firestore.v1beta1.StructuredQuery.FieldFilter.Operator[message.op] === undefined ? message.op : $root.google.firestore.v1beta1.StructuredQuery.FieldFilter.Operator[message.op] : message.op; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = $root.google.firestore.v1beta1.Value.toObject(message.value, options, q + 1); + return object; + }; + + /** + * Converts this FieldFilter to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @instance + * @returns {Object.} JSON object + */ + FieldFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldFilter + * @function getTypeUrl + * @memberof google.firestore.v1beta1.StructuredQuery.FieldFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.StructuredQuery.FieldFilter"; + }; + + /** + * Operator enum. + * @name google.firestore.v1beta1.StructuredQuery.FieldFilter.Operator + * @enum {number} + * @property {number} OPERATOR_UNSPECIFIED=0 OPERATOR_UNSPECIFIED value + * @property {number} LESS_THAN=1 LESS_THAN value + * @property {number} LESS_THAN_OR_EQUAL=2 LESS_THAN_OR_EQUAL value + * @property {number} GREATER_THAN=3 GREATER_THAN value + * @property {number} GREATER_THAN_OR_EQUAL=4 GREATER_THAN_OR_EQUAL value + * @property {number} EQUAL=5 EQUAL value + * @property {number} NOT_EQUAL=6 NOT_EQUAL value + * @property {number} ARRAY_CONTAINS=7 ARRAY_CONTAINS value + * @property {number} IN=8 IN value + * @property {number} ARRAY_CONTAINS_ANY=9 ARRAY_CONTAINS_ANY value + * @property {number} NOT_IN=10 NOT_IN value + */ + FieldFilter.Operator = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "LESS_THAN"] = 1; + values[valuesById[2] = "LESS_THAN_OR_EQUAL"] = 2; + values[valuesById[3] = "GREATER_THAN"] = 3; + values[valuesById[4] = "GREATER_THAN_OR_EQUAL"] = 4; + values[valuesById[5] = "EQUAL"] = 5; + values[valuesById[6] = "NOT_EQUAL"] = 6; + values[valuesById[7] = "ARRAY_CONTAINS"] = 7; + values[valuesById[8] = "IN"] = 8; + values[valuesById[9] = "ARRAY_CONTAINS_ANY"] = 9; + values[valuesById[10] = "NOT_IN"] = 10; + return values; + })(); + + return FieldFilter; + })(); + + StructuredQuery.UnaryFilter = (function() { + + /** + * Properties of an UnaryFilter. + * @memberof google.firestore.v1beta1.StructuredQuery + * @interface IUnaryFilter + * @property {google.firestore.v1beta1.StructuredQuery.UnaryFilter.Operator|null} [op] UnaryFilter op + * @property {google.firestore.v1beta1.StructuredQuery.IFieldReference|null} [field] UnaryFilter field + */ + + /** + * Constructs a new UnaryFilter. + * @memberof google.firestore.v1beta1.StructuredQuery + * @classdesc Represents an UnaryFilter. + * @implements IUnaryFilter + * @constructor + * @param {google.firestore.v1beta1.StructuredQuery.IUnaryFilter=} [properties] Properties to set + */ + function UnaryFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UnaryFilter op. + * @member {google.firestore.v1beta1.StructuredQuery.UnaryFilter.Operator} op + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @instance + */ + UnaryFilter.prototype.op = 0; + + /** + * UnaryFilter field. + * @member {google.firestore.v1beta1.StructuredQuery.IFieldReference|null|undefined} field + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @instance + */ + UnaryFilter.prototype.field = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UnaryFilter operandType. + * @member {"field"|undefined} operandType + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @instance + */ + Object.defineProperty(UnaryFilter.prototype, "operandType", { + get: $util.oneOfGetter($oneOfFields = ["field"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UnaryFilter instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IUnaryFilter=} [properties] Properties to set + * @returns {google.firestore.v1beta1.StructuredQuery.UnaryFilter} UnaryFilter instance + */ + UnaryFilter.create = function create(properties) { + return new UnaryFilter(properties); + }; + + /** + * Encodes the specified UnaryFilter message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.UnaryFilter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IUnaryFilter} message UnaryFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnaryFilter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.op); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + $root.google.firestore.v1beta1.StructuredQuery.FieldReference.encode(message.field, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified UnaryFilter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.UnaryFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IUnaryFilter} message UnaryFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnaryFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UnaryFilter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.StructuredQuery.UnaryFilter} UnaryFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnaryFilter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.op = reader.int32(); + break; + } + case 2: { + message.field = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UnaryFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.StructuredQuery.UnaryFilter} UnaryFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnaryFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UnaryFilter message. + * @function verify + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UnaryFilter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + switch (message.op) { + default: + return "op: enum value expected"; + case 0: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + properties.operandType = 1; + { + var error = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.verify(message.field, long + 1); + if (error) + return "field." + error; + } + } + return null; + }; + + /** + * Creates an UnaryFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.StructuredQuery.UnaryFilter} UnaryFilter + */ + UnaryFilter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.UnaryFilter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter(); + switch (object.op) { + default: + if (typeof object.op === "number") { + message.op = object.op; + break; + } + break; + case "OPERATOR_UNSPECIFIED": + case 0: + message.op = 0; + break; + case "IS_NAN": + case 2: + message.op = 2; + break; + case "IS_NULL": + case 3: + message.op = 3; + break; + case "IS_NOT_NAN": + case 4: + message.op = 4; + break; + case "IS_NOT_NULL": + case 5: + message.op = 5; + break; + } + if (object.field != null) { + if (!$util.isObject(object.field)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.UnaryFilter.field: object expected"); + message.field = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.fromObject(object.field, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an UnaryFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @static + * @param {google.firestore.v1beta1.StructuredQuery.UnaryFilter} message UnaryFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UnaryFilter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.op = options.enums === String ? "OPERATOR_UNSPECIFIED" : 0; + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + object.op = options.enums === String ? $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter.Operator[message.op] === undefined ? message.op : $root.google.firestore.v1beta1.StructuredQuery.UnaryFilter.Operator[message.op] : message.op; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + object.field = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.toObject(message.field, options, q + 1); + if (options.oneofs) + object.operandType = "field"; + } + return object; + }; + + /** + * Converts this UnaryFilter to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @instance + * @returns {Object.} JSON object + */ + UnaryFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UnaryFilter + * @function getTypeUrl + * @memberof google.firestore.v1beta1.StructuredQuery.UnaryFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UnaryFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.StructuredQuery.UnaryFilter"; + }; + + /** + * Operator enum. + * @name google.firestore.v1beta1.StructuredQuery.UnaryFilter.Operator + * @enum {number} + * @property {number} OPERATOR_UNSPECIFIED=0 OPERATOR_UNSPECIFIED value + * @property {number} IS_NAN=2 IS_NAN value + * @property {number} IS_NULL=3 IS_NULL value + * @property {number} IS_NOT_NAN=4 IS_NOT_NAN value + * @property {number} IS_NOT_NULL=5 IS_NOT_NULL value + */ + UnaryFilter.Operator = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATOR_UNSPECIFIED"] = 0; + values[valuesById[2] = "IS_NAN"] = 2; + values[valuesById[3] = "IS_NULL"] = 3; + values[valuesById[4] = "IS_NOT_NAN"] = 4; + values[valuesById[5] = "IS_NOT_NULL"] = 5; + return values; + })(); + + return UnaryFilter; + })(); + + StructuredQuery.FieldReference = (function() { + + /** + * Properties of a FieldReference. + * @memberof google.firestore.v1beta1.StructuredQuery + * @interface IFieldReference + * @property {string|null} [fieldPath] FieldReference fieldPath + */ + + /** + * Constructs a new FieldReference. + * @memberof google.firestore.v1beta1.StructuredQuery + * @classdesc Represents a FieldReference. + * @implements IFieldReference + * @constructor + * @param {google.firestore.v1beta1.StructuredQuery.IFieldReference=} [properties] Properties to set + */ + function FieldReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldReference fieldPath. + * @member {string} fieldPath + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @instance + */ + FieldReference.prototype.fieldPath = ""; + + /** + * Creates a new FieldReference instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IFieldReference=} [properties] Properties to set + * @returns {google.firestore.v1beta1.StructuredQuery.FieldReference} FieldReference instance + */ + FieldReference.create = function create(properties) { + return new FieldReference(properties); + }; + + /** + * Encodes the specified FieldReference message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.FieldReference.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IFieldReference} message FieldReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldReference.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.fieldPath); + return writer; + }; + + /** + * Encodes the specified FieldReference message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.FieldReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IFieldReference} message FieldReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldReference message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.StructuredQuery.FieldReference} FieldReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldReference.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.StructuredQuery.FieldReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.fieldPath = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.StructuredQuery.FieldReference} FieldReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldReference message. + * @function verify + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldReference.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + if (!$util.isString(message.fieldPath)) + return "fieldPath: string expected"; + return null; + }; + + /** + * Creates a FieldReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.StructuredQuery.FieldReference} FieldReference + */ + FieldReference.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.StructuredQuery.FieldReference) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.FieldReference: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.StructuredQuery.FieldReference(); + if (object.fieldPath != null) + message.fieldPath = String(object.fieldPath); + return message; + }; + + /** + * Creates a plain object from a FieldReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @static + * @param {google.firestore.v1beta1.StructuredQuery.FieldReference} message FieldReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldReference.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.fieldPath = ""; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + object.fieldPath = message.fieldPath; + return object; + }; + + /** + * Converts this FieldReference to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @instance + * @returns {Object.} JSON object + */ + FieldReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldReference + * @function getTypeUrl + * @memberof google.firestore.v1beta1.StructuredQuery.FieldReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.StructuredQuery.FieldReference"; + }; + + return FieldReference; + })(); + + StructuredQuery.Order = (function() { + + /** + * Properties of an Order. + * @memberof google.firestore.v1beta1.StructuredQuery + * @interface IOrder + * @property {google.firestore.v1beta1.StructuredQuery.IFieldReference|null} [field] Order field + * @property {google.firestore.v1beta1.StructuredQuery.Direction|null} [direction] Order direction + */ + + /** + * Constructs a new Order. + * @memberof google.firestore.v1beta1.StructuredQuery + * @classdesc Represents an Order. + * @implements IOrder + * @constructor + * @param {google.firestore.v1beta1.StructuredQuery.IOrder=} [properties] Properties to set + */ + function Order(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Order field. + * @member {google.firestore.v1beta1.StructuredQuery.IFieldReference|null|undefined} field + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @instance + */ + Order.prototype.field = null; + + /** + * Order direction. + * @member {google.firestore.v1beta1.StructuredQuery.Direction} direction + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @instance + */ + Order.prototype.direction = 0; + + /** + * Creates a new Order instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IOrder=} [properties] Properties to set + * @returns {google.firestore.v1beta1.StructuredQuery.Order} Order instance + */ + Order.create = function create(properties) { + return new Order(properties); + }; + + /** + * Encodes the specified Order message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Order.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IOrder} message Order message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Order.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + $root.google.firestore.v1beta1.StructuredQuery.FieldReference.encode(message.field, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.direction != null && Object.hasOwnProperty.call(message, "direction")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.direction); + return writer; + }; + + /** + * Encodes the specified Order message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Order.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IOrder} message Order message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Order.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Order message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.StructuredQuery.Order} Order + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Order.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.StructuredQuery.Order(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.field = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.direction = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Order message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.StructuredQuery.Order} Order + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Order.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Order message. + * @function verify + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Order.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + var error = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.verify(message.field, long + 1); + if (error) + return "field." + error; + } + if (message.direction != null && Object.hasOwnProperty.call(message, "direction")) + switch (message.direction) { + default: + return "direction: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an Order message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.StructuredQuery.Order} Order + */ + Order.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.StructuredQuery.Order) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.Order: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.StructuredQuery.Order(); + if (object.field != null) { + if (!$util.isObject(object.field)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.Order.field: object expected"); + message.field = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.fromObject(object.field, long + 1); + } + switch (object.direction) { + default: + if (typeof object.direction === "number") { + message.direction = object.direction; + break; + } + break; + case "DIRECTION_UNSPECIFIED": + case 0: + message.direction = 0; + break; + case "ASCENDING": + case 1: + message.direction = 1; + break; + case "DESCENDING": + case 2: + message.direction = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an Order message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @static + * @param {google.firestore.v1beta1.StructuredQuery.Order} message Order + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Order.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.field = null; + object.direction = options.enums === String ? "DIRECTION_UNSPECIFIED" : 0; + } + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + object.field = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.toObject(message.field, options, q + 1); + if (message.direction != null && Object.hasOwnProperty.call(message, "direction")) + object.direction = options.enums === String ? $root.google.firestore.v1beta1.StructuredQuery.Direction[message.direction] === undefined ? message.direction : $root.google.firestore.v1beta1.StructuredQuery.Direction[message.direction] : message.direction; + return object; + }; + + /** + * Converts this Order to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @instance + * @returns {Object.} JSON object + */ + Order.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Order + * @function getTypeUrl + * @memberof google.firestore.v1beta1.StructuredQuery.Order + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Order.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.StructuredQuery.Order"; + }; + + return Order; + })(); + + StructuredQuery.Projection = (function() { + + /** + * Properties of a Projection. + * @memberof google.firestore.v1beta1.StructuredQuery + * @interface IProjection + * @property {Array.|null} [fields] Projection fields + */ + + /** + * Constructs a new Projection. + * @memberof google.firestore.v1beta1.StructuredQuery + * @classdesc Represents a Projection. + * @implements IProjection + * @constructor + * @param {google.firestore.v1beta1.StructuredQuery.IProjection=} [properties] Properties to set + */ + function Projection(properties) { + this.fields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Projection fields. + * @member {Array.} fields + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @instance + */ + Projection.prototype.fields = $util.emptyArray; + + /** + * Creates a new Projection instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IProjection=} [properties] Properties to set + * @returns {google.firestore.v1beta1.StructuredQuery.Projection} Projection instance + */ + Projection.create = function create(properties) { + return new Projection(properties); + }; + + /** + * Encodes the specified Projection message. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Projection.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IProjection} message Projection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Projection.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fields != null && message.fields.length) + for (var i = 0; i < message.fields.length; ++i) + $root.google.firestore.v1beta1.StructuredQuery.FieldReference.encode(message.fields[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Projection message, length delimited. Does not implicitly {@link google.firestore.v1beta1.StructuredQuery.Projection.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @static + * @param {google.firestore.v1beta1.StructuredQuery.IProjection} message Projection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Projection.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Projection message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.StructuredQuery.Projection} Projection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Projection.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.StructuredQuery.Projection(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.fields && message.fields.length)) + message.fields = []; + message.fields.push($root.google.firestore.v1beta1.StructuredQuery.FieldReference.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Projection message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.StructuredQuery.Projection} Projection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Projection.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Projection message. + * @function verify + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Projection.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { + if (!Array.isArray(message.fields)) + return "fields: array expected"; + for (var i = 0; i < message.fields.length; ++i) { + var error = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.verify(message.fields[i], long + 1); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a Projection message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.StructuredQuery.Projection} Projection + */ + Projection.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.StructuredQuery.Projection) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.Projection: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.StructuredQuery.Projection(); + if (object.fields) { + if (!Array.isArray(object.fields)) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.Projection.fields: array expected"); + message.fields = []; + for (var i = 0; i < object.fields.length; ++i) { + if (!$util.isObject(object.fields[i])) + throw TypeError(".google.firestore.v1beta1.StructuredQuery.Projection.fields: object expected"); + message.fields[i] = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.fromObject(object.fields[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a Projection message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @static + * @param {google.firestore.v1beta1.StructuredQuery.Projection} message Projection + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Projection.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.fields = []; + if (message.fields && message.fields.length) { + object.fields = []; + for (var j = 0; j < message.fields.length; ++j) + object.fields[j] = $root.google.firestore.v1beta1.StructuredQuery.FieldReference.toObject(message.fields[j], options, q + 1); + } + return object; + }; + + /** + * Converts this Projection to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @instance + * @returns {Object.} JSON object + */ + Projection.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Projection + * @function getTypeUrl + * @memberof google.firestore.v1beta1.StructuredQuery.Projection + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Projection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.StructuredQuery.Projection"; + }; + + return Projection; + })(); + + /** + * Direction enum. + * @name google.firestore.v1beta1.StructuredQuery.Direction + * @enum {number} + * @property {number} DIRECTION_UNSPECIFIED=0 DIRECTION_UNSPECIFIED value + * @property {number} ASCENDING=1 ASCENDING value + * @property {number} DESCENDING=2 DESCENDING value + */ + StructuredQuery.Direction = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DIRECTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "ASCENDING"] = 1; + values[valuesById[2] = "DESCENDING"] = 2; + return values; + })(); + + return StructuredQuery; + })(); + + v1beta1.Cursor = (function() { + + /** + * Properties of a Cursor. + * @memberof google.firestore.v1beta1 + * @interface ICursor + * @property {Array.|null} [values] Cursor values + * @property {boolean|null} [before] Cursor before + */ + + /** + * Constructs a new Cursor. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a Cursor. + * @implements ICursor + * @constructor + * @param {google.firestore.v1beta1.ICursor=} [properties] Properties to set + */ + function Cursor(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Cursor values. + * @member {Array.} values + * @memberof google.firestore.v1beta1.Cursor + * @instance + */ + Cursor.prototype.values = $util.emptyArray; + + /** + * Cursor before. + * @member {boolean} before + * @memberof google.firestore.v1beta1.Cursor + * @instance + */ + Cursor.prototype.before = false; + + /** + * Creates a new Cursor instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.Cursor + * @static + * @param {google.firestore.v1beta1.ICursor=} [properties] Properties to set + * @returns {google.firestore.v1beta1.Cursor} Cursor instance + */ + Cursor.create = function create(properties) { + return new Cursor(properties); + }; + + /** + * Encodes the specified Cursor message. Does not implicitly {@link google.firestore.v1beta1.Cursor.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.Cursor + * @static + * @param {google.firestore.v1beta1.ICursor} message Cursor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Cursor.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.firestore.v1beta1.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.before != null && Object.hasOwnProperty.call(message, "before")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.before); + return writer; + }; + + /** + * Encodes the specified Cursor message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Cursor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.Cursor + * @static + * @param {google.firestore.v1beta1.ICursor} message Cursor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Cursor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Cursor message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.Cursor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.Cursor} Cursor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Cursor.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.Cursor(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.firestore.v1beta1.Value.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.before = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Cursor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.Cursor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.Cursor} Cursor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Cursor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Cursor message. + * @function verify + * @memberof google.firestore.v1beta1.Cursor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Cursor.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.values != null && Object.hasOwnProperty.call(message, "values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.firestore.v1beta1.Value.verify(message.values[i], long + 1); + if (error) + return "values." + error; + } + } + if (message.before != null && Object.hasOwnProperty.call(message, "before")) + if (typeof message.before !== "boolean") + return "before: boolean expected"; + return null; + }; + + /** + * Creates a Cursor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.Cursor + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.Cursor} Cursor + */ + Cursor.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.Cursor) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.Cursor: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.Cursor(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.firestore.v1beta1.Cursor.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (!$util.isObject(object.values[i])) + throw TypeError(".google.firestore.v1beta1.Cursor.values: object expected"); + message.values[i] = $root.google.firestore.v1beta1.Value.fromObject(object.values[i], long + 1); + } + } + if (object.before != null) + message.before = Boolean(object.before); + return message; + }; + + /** + * Creates a plain object from a Cursor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.Cursor + * @static + * @param {google.firestore.v1beta1.Cursor} message Cursor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Cursor.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) + object.before = false; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.firestore.v1beta1.Value.toObject(message.values[j], options, q + 1); + } + if (message.before != null && Object.hasOwnProperty.call(message, "before")) + object.before = message.before; + return object; + }; + + /** + * Converts this Cursor to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.Cursor + * @instance + * @returns {Object.} JSON object + */ + Cursor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Cursor + * @function getTypeUrl + * @memberof google.firestore.v1beta1.Cursor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Cursor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.Cursor"; + }; + + return Cursor; + })(); + + v1beta1.Write = (function() { + + /** + * Properties of a Write. + * @memberof google.firestore.v1beta1 + * @interface IWrite + * @property {google.firestore.v1beta1.IDocument|null} [update] Write update + * @property {string|null} ["delete"] Write delete + * @property {google.firestore.v1beta1.IDocumentTransform|null} [transform] Write transform + * @property {google.firestore.v1beta1.IDocumentMask|null} [updateMask] Write updateMask + * @property {Array.|null} [updateTransforms] Write updateTransforms + * @property {google.firestore.v1beta1.IPrecondition|null} [currentDocument] Write currentDocument + */ + + /** + * Constructs a new Write. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a Write. + * @implements IWrite + * @constructor + * @param {google.firestore.v1beta1.IWrite=} [properties] Properties to set + */ + function Write(properties) { + this.updateTransforms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Write update. + * @member {google.firestore.v1beta1.IDocument|null|undefined} update + * @memberof google.firestore.v1beta1.Write + * @instance + */ + Write.prototype.update = null; + + /** + * Write delete. + * @member {string|null|undefined} delete + * @memberof google.firestore.v1beta1.Write + * @instance + */ + Write.prototype["delete"] = null; + + /** + * Write transform. + * @member {google.firestore.v1beta1.IDocumentTransform|null|undefined} transform + * @memberof google.firestore.v1beta1.Write + * @instance + */ + Write.prototype.transform = null; + + /** + * Write updateMask. + * @member {google.firestore.v1beta1.IDocumentMask|null|undefined} updateMask + * @memberof google.firestore.v1beta1.Write + * @instance + */ + Write.prototype.updateMask = null; + + /** + * Write updateTransforms. + * @member {Array.} updateTransforms + * @memberof google.firestore.v1beta1.Write + * @instance + */ + Write.prototype.updateTransforms = $util.emptyArray; + + /** + * Write currentDocument. + * @member {google.firestore.v1beta1.IPrecondition|null|undefined} currentDocument + * @memberof google.firestore.v1beta1.Write + * @instance + */ + Write.prototype.currentDocument = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Write operation. + * @member {"update"|"delete"|"transform"|undefined} operation + * @memberof google.firestore.v1beta1.Write + * @instance + */ + Object.defineProperty(Write.prototype, "operation", { + get: $util.oneOfGetter($oneOfFields = ["update", "delete", "transform"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Write instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.Write + * @static + * @param {google.firestore.v1beta1.IWrite=} [properties] Properties to set + * @returns {google.firestore.v1beta1.Write} Write instance + */ + Write.create = function create(properties) { + return new Write(properties); + }; + + /** + * Encodes the specified Write message. Does not implicitly {@link google.firestore.v1beta1.Write.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.Write + * @static + * @param {google.firestore.v1beta1.IWrite} message Write message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Write.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.update != null && Object.hasOwnProperty.call(message, "update")) + $root.google.firestore.v1beta1.Document.encode(message.update, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["delete"]); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.firestore.v1beta1.DocumentMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + $root.google.firestore.v1beta1.Precondition.encode(message.currentDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.transform != null && Object.hasOwnProperty.call(message, "transform")) + $root.google.firestore.v1beta1.DocumentTransform.encode(message.transform, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.updateTransforms != null && message.updateTransforms.length) + for (var i = 0; i < message.updateTransforms.length; ++i) + $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.encode(message.updateTransforms[i], writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Write message, length delimited. Does not implicitly {@link google.firestore.v1beta1.Write.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.Write + * @static + * @param {google.firestore.v1beta1.IWrite} message Write message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Write.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Write message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.Write + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.Write} Write + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Write.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.Write(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.update = $root.google.firestore.v1beta1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.transform = $root.google.firestore.v1beta1.DocumentTransform.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.updateMask = $root.google.firestore.v1beta1.DocumentMask.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + if (!(message.updateTransforms && message.updateTransforms.length)) + message.updateTransforms = []; + message.updateTransforms.push($root.google.firestore.v1beta1.DocumentTransform.FieldTransform.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 4: { + message.currentDocument = $root.google.firestore.v1beta1.Precondition.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Write message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.Write + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.Write} Write + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Write.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Write message. + * @function verify + * @memberof google.firestore.v1beta1.Write + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Write.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.update != null && Object.hasOwnProperty.call(message, "update")) { + properties.operation = 1; + { + var error = $root.google.firestore.v1beta1.Document.verify(message.update, long + 1); + if (error) + return "update." + error; + } + } + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) { + if (properties.operation === 1) + return "operation: multiple values"; + properties.operation = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.transform != null && Object.hasOwnProperty.call(message, "transform")) { + if (properties.operation === 1) + return "operation: multiple values"; + properties.operation = 1; + { + var error = $root.google.firestore.v1beta1.DocumentTransform.verify(message.transform, long + 1); + if (error) + return "transform." + error; + } + } + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { + var error = $root.google.firestore.v1beta1.DocumentMask.verify(message.updateMask, long + 1); + if (error) + return "updateMask." + error; + } + if (message.updateTransforms != null && Object.hasOwnProperty.call(message, "updateTransforms")) { + if (!Array.isArray(message.updateTransforms)) + return "updateTransforms: array expected"; + for (var i = 0; i < message.updateTransforms.length; ++i) { + var error = $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.verify(message.updateTransforms[i], long + 1); + if (error) + return "updateTransforms." + error; + } + } + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) { + var error = $root.google.firestore.v1beta1.Precondition.verify(message.currentDocument, long + 1); + if (error) + return "currentDocument." + error; + } + return null; + }; + + /** + * Creates a Write message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.Write + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.Write} Write + */ + Write.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.Write) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.Write: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.Write(); + if (object.update != null) { + if (!$util.isObject(object.update)) + throw TypeError(".google.firestore.v1beta1.Write.update: object expected"); + message.update = $root.google.firestore.v1beta1.Document.fromObject(object.update, long + 1); + } + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.transform != null) { + if (!$util.isObject(object.transform)) + throw TypeError(".google.firestore.v1beta1.Write.transform: object expected"); + message.transform = $root.google.firestore.v1beta1.DocumentTransform.fromObject(object.transform, long + 1); + } + if (object.updateMask != null) { + if (!$util.isObject(object.updateMask)) + throw TypeError(".google.firestore.v1beta1.Write.updateMask: object expected"); + message.updateMask = $root.google.firestore.v1beta1.DocumentMask.fromObject(object.updateMask, long + 1); + } + if (object.updateTransforms) { + if (!Array.isArray(object.updateTransforms)) + throw TypeError(".google.firestore.v1beta1.Write.updateTransforms: array expected"); + message.updateTransforms = []; + for (var i = 0; i < object.updateTransforms.length; ++i) { + if (!$util.isObject(object.updateTransforms[i])) + throw TypeError(".google.firestore.v1beta1.Write.updateTransforms: object expected"); + message.updateTransforms[i] = $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.fromObject(object.updateTransforms[i], long + 1); + } + } + if (object.currentDocument != null) { + if (!$util.isObject(object.currentDocument)) + throw TypeError(".google.firestore.v1beta1.Write.currentDocument: object expected"); + message.currentDocument = $root.google.firestore.v1beta1.Precondition.fromObject(object.currentDocument, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Write message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.Write + * @static + * @param {google.firestore.v1beta1.Write} message Write + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Write.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.updateTransforms = []; + if (options.defaults) { + object.updateMask = null; + object.currentDocument = null; + } + if (message.update != null && Object.hasOwnProperty.call(message, "update")) { + object.update = $root.google.firestore.v1beta1.Document.toObject(message.update, options, q + 1); + if (options.oneofs) + object.operation = "update"; + } + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.operation = "delete"; + } + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.firestore.v1beta1.DocumentMask.toObject(message.updateMask, options, q + 1); + if (message.currentDocument != null && Object.hasOwnProperty.call(message, "currentDocument")) + object.currentDocument = $root.google.firestore.v1beta1.Precondition.toObject(message.currentDocument, options, q + 1); + if (message.transform != null && Object.hasOwnProperty.call(message, "transform")) { + object.transform = $root.google.firestore.v1beta1.DocumentTransform.toObject(message.transform, options, q + 1); + if (options.oneofs) + object.operation = "transform"; + } + if (message.updateTransforms && message.updateTransforms.length) { + object.updateTransforms = []; + for (var j = 0; j < message.updateTransforms.length; ++j) + object.updateTransforms[j] = $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.toObject(message.updateTransforms[j], options, q + 1); + } + return object; + }; + + /** + * Converts this Write to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.Write + * @instance + * @returns {Object.} JSON object + */ + Write.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Write + * @function getTypeUrl + * @memberof google.firestore.v1beta1.Write + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Write.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.Write"; + }; + + return Write; + })(); + + v1beta1.DocumentTransform = (function() { + + /** + * Properties of a DocumentTransform. + * @memberof google.firestore.v1beta1 + * @interface IDocumentTransform + * @property {string|null} [document] DocumentTransform document + * @property {Array.|null} [fieldTransforms] DocumentTransform fieldTransforms + */ + + /** + * Constructs a new DocumentTransform. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a DocumentTransform. + * @implements IDocumentTransform + * @constructor + * @param {google.firestore.v1beta1.IDocumentTransform=} [properties] Properties to set + */ + function DocumentTransform(properties) { + this.fieldTransforms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentTransform document. + * @member {string} document + * @memberof google.firestore.v1beta1.DocumentTransform + * @instance + */ + DocumentTransform.prototype.document = ""; + + /** + * DocumentTransform fieldTransforms. + * @member {Array.} fieldTransforms + * @memberof google.firestore.v1beta1.DocumentTransform + * @instance + */ + DocumentTransform.prototype.fieldTransforms = $util.emptyArray; + + /** + * Creates a new DocumentTransform instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.DocumentTransform + * @static + * @param {google.firestore.v1beta1.IDocumentTransform=} [properties] Properties to set + * @returns {google.firestore.v1beta1.DocumentTransform} DocumentTransform instance + */ + DocumentTransform.create = function create(properties) { + return new DocumentTransform(properties); + }; + + /** + * Encodes the specified DocumentTransform message. Does not implicitly {@link google.firestore.v1beta1.DocumentTransform.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.DocumentTransform + * @static + * @param {google.firestore.v1beta1.IDocumentTransform} message DocumentTransform message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentTransform.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.document); + if (message.fieldTransforms != null && message.fieldTransforms.length) + for (var i = 0; i < message.fieldTransforms.length; ++i) + $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.encode(message.fieldTransforms[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentTransform message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentTransform.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.DocumentTransform + * @static + * @param {google.firestore.v1beta1.IDocumentTransform} message DocumentTransform message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentTransform.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentTransform message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.DocumentTransform + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.DocumentTransform} DocumentTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentTransform.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.DocumentTransform(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = reader.string(); + break; + } + case 2: { + if (!(message.fieldTransforms && message.fieldTransforms.length)) + message.fieldTransforms = []; + message.fieldTransforms.push($root.google.firestore.v1beta1.DocumentTransform.FieldTransform.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentTransform message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.DocumentTransform + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.DocumentTransform} DocumentTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentTransform.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentTransform message. + * @function verify + * @memberof google.firestore.v1beta1.DocumentTransform + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentTransform.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + if (!$util.isString(message.document)) + return "document: string expected"; + if (message.fieldTransforms != null && Object.hasOwnProperty.call(message, "fieldTransforms")) { + if (!Array.isArray(message.fieldTransforms)) + return "fieldTransforms: array expected"; + for (var i = 0; i < message.fieldTransforms.length; ++i) { + var error = $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.verify(message.fieldTransforms[i], long + 1); + if (error) + return "fieldTransforms." + error; + } + } + return null; + }; + + /** + * Creates a DocumentTransform message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.DocumentTransform + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.DocumentTransform} DocumentTransform + */ + DocumentTransform.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.DocumentTransform) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.DocumentTransform: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.DocumentTransform(); + if (object.document != null) + message.document = String(object.document); + if (object.fieldTransforms) { + if (!Array.isArray(object.fieldTransforms)) + throw TypeError(".google.firestore.v1beta1.DocumentTransform.fieldTransforms: array expected"); + message.fieldTransforms = []; + for (var i = 0; i < object.fieldTransforms.length; ++i) { + if (!$util.isObject(object.fieldTransforms[i])) + throw TypeError(".google.firestore.v1beta1.DocumentTransform.fieldTransforms: object expected"); + message.fieldTransforms[i] = $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.fromObject(object.fieldTransforms[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a DocumentTransform message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.DocumentTransform + * @static + * @param {google.firestore.v1beta1.DocumentTransform} message DocumentTransform + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentTransform.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.fieldTransforms = []; + if (options.defaults) + object.document = ""; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = message.document; + if (message.fieldTransforms && message.fieldTransforms.length) { + object.fieldTransforms = []; + for (var j = 0; j < message.fieldTransforms.length; ++j) + object.fieldTransforms[j] = $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.toObject(message.fieldTransforms[j], options, q + 1); + } + return object; + }; + + /** + * Converts this DocumentTransform to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.DocumentTransform + * @instance + * @returns {Object.} JSON object + */ + DocumentTransform.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentTransform + * @function getTypeUrl + * @memberof google.firestore.v1beta1.DocumentTransform + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentTransform.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.DocumentTransform"; + }; + + DocumentTransform.FieldTransform = (function() { + + /** + * Properties of a FieldTransform. + * @memberof google.firestore.v1beta1.DocumentTransform + * @interface IFieldTransform + * @property {string|null} [fieldPath] FieldTransform fieldPath + * @property {google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue|null} [setToServerValue] FieldTransform setToServerValue + * @property {google.firestore.v1beta1.IValue|null} [increment] FieldTransform increment + * @property {google.firestore.v1beta1.IValue|null} [maximum] FieldTransform maximum + * @property {google.firestore.v1beta1.IValue|null} [minimum] FieldTransform minimum + * @property {google.firestore.v1beta1.IArrayValue|null} [appendMissingElements] FieldTransform appendMissingElements + * @property {google.firestore.v1beta1.IArrayValue|null} [removeAllFromArray] FieldTransform removeAllFromArray + */ + + /** + * Constructs a new FieldTransform. + * @memberof google.firestore.v1beta1.DocumentTransform + * @classdesc Represents a FieldTransform. + * @implements IFieldTransform + * @constructor + * @param {google.firestore.v1beta1.DocumentTransform.IFieldTransform=} [properties] Properties to set + */ + function FieldTransform(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldTransform fieldPath. + * @member {string} fieldPath + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.fieldPath = ""; + + /** + * FieldTransform setToServerValue. + * @member {google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue|null|undefined} setToServerValue + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.setToServerValue = null; + + /** + * FieldTransform increment. + * @member {google.firestore.v1beta1.IValue|null|undefined} increment + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.increment = null; + + /** + * FieldTransform maximum. + * @member {google.firestore.v1beta1.IValue|null|undefined} maximum + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.maximum = null; + + /** + * FieldTransform minimum. + * @member {google.firestore.v1beta1.IValue|null|undefined} minimum + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.minimum = null; + + /** + * FieldTransform appendMissingElements. + * @member {google.firestore.v1beta1.IArrayValue|null|undefined} appendMissingElements + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.appendMissingElements = null; + + /** + * FieldTransform removeAllFromArray. + * @member {google.firestore.v1beta1.IArrayValue|null|undefined} removeAllFromArray + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @instance + */ + FieldTransform.prototype.removeAllFromArray = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FieldTransform transformType. + * @member {"setToServerValue"|"increment"|"maximum"|"minimum"|"appendMissingElements"|"removeAllFromArray"|undefined} transformType + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @instance + */ + Object.defineProperty(FieldTransform.prototype, "transformType", { + get: $util.oneOfGetter($oneOfFields = ["setToServerValue", "increment", "maximum", "minimum", "appendMissingElements", "removeAllFromArray"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FieldTransform instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @static + * @param {google.firestore.v1beta1.DocumentTransform.IFieldTransform=} [properties] Properties to set + * @returns {google.firestore.v1beta1.DocumentTransform.FieldTransform} FieldTransform instance + */ + FieldTransform.create = function create(properties) { + return new FieldTransform(properties); + }; + + /** + * Encodes the specified FieldTransform message. Does not implicitly {@link google.firestore.v1beta1.DocumentTransform.FieldTransform.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @static + * @param {google.firestore.v1beta1.DocumentTransform.IFieldTransform} message FieldTransform message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldTransform.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fieldPath); + if (message.setToServerValue != null && Object.hasOwnProperty.call(message, "setToServerValue")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.setToServerValue); + if (message.increment != null && Object.hasOwnProperty.call(message, "increment")) + $root.google.firestore.v1beta1.Value.encode(message.increment, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) + $root.google.firestore.v1beta1.Value.encode(message.maximum, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) + $root.google.firestore.v1beta1.Value.encode(message.minimum, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.appendMissingElements != null && Object.hasOwnProperty.call(message, "appendMissingElements")) + $root.google.firestore.v1beta1.ArrayValue.encode(message.appendMissingElements, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.removeAllFromArray != null && Object.hasOwnProperty.call(message, "removeAllFromArray")) + $root.google.firestore.v1beta1.ArrayValue.encode(message.removeAllFromArray, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldTransform message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentTransform.FieldTransform.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @static + * @param {google.firestore.v1beta1.DocumentTransform.IFieldTransform} message FieldTransform message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldTransform.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldTransform message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.DocumentTransform.FieldTransform} FieldTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldTransform.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.DocumentTransform.FieldTransform(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.fieldPath = reader.string(); + break; + } + case 2: { + message.setToServerValue = reader.int32(); + break; + } + case 3: { + message.increment = $root.google.firestore.v1beta1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.maximum = $root.google.firestore.v1beta1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.minimum = $root.google.firestore.v1beta1.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.appendMissingElements = $root.google.firestore.v1beta1.ArrayValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.removeAllFromArray = $root.google.firestore.v1beta1.ArrayValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldTransform message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.DocumentTransform.FieldTransform} FieldTransform + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldTransform.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldTransform message. + * @function verify + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldTransform.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + if (!$util.isString(message.fieldPath)) + return "fieldPath: string expected"; + if (message.setToServerValue != null && Object.hasOwnProperty.call(message, "setToServerValue")) { + properties.transformType = 1; + switch (message.setToServerValue) { + default: + return "setToServerValue: enum value expected"; + case 0: + case 1: + break; + } + } + if (message.increment != null && Object.hasOwnProperty.call(message, "increment")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1beta1.Value.verify(message.increment, long + 1); + if (error) + return "increment." + error; + } + } + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1beta1.Value.verify(message.maximum, long + 1); + if (error) + return "maximum." + error; + } + } + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1beta1.Value.verify(message.minimum, long + 1); + if (error) + return "minimum." + error; + } + } + if (message.appendMissingElements != null && Object.hasOwnProperty.call(message, "appendMissingElements")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1beta1.ArrayValue.verify(message.appendMissingElements, long + 1); + if (error) + return "appendMissingElements." + error; + } + } + if (message.removeAllFromArray != null && Object.hasOwnProperty.call(message, "removeAllFromArray")) { + if (properties.transformType === 1) + return "transformType: multiple values"; + properties.transformType = 1; + { + var error = $root.google.firestore.v1beta1.ArrayValue.verify(message.removeAllFromArray, long + 1); + if (error) + return "removeAllFromArray." + error; + } + } + return null; + }; + + /** + * Creates a FieldTransform message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.DocumentTransform.FieldTransform} FieldTransform + */ + FieldTransform.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.DocumentTransform.FieldTransform) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.DocumentTransform.FieldTransform: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.DocumentTransform.FieldTransform(); + if (object.fieldPath != null) + message.fieldPath = String(object.fieldPath); + switch (object.setToServerValue) { + default: + if (typeof object.setToServerValue === "number") { + message.setToServerValue = object.setToServerValue; + break; + } + break; + case "SERVER_VALUE_UNSPECIFIED": + case 0: + message.setToServerValue = 0; + break; + case "REQUEST_TIME": + case 1: + message.setToServerValue = 1; + break; + } + if (object.increment != null) { + if (!$util.isObject(object.increment)) + throw TypeError(".google.firestore.v1beta1.DocumentTransform.FieldTransform.increment: object expected"); + message.increment = $root.google.firestore.v1beta1.Value.fromObject(object.increment, long + 1); + } + if (object.maximum != null) { + if (!$util.isObject(object.maximum)) + throw TypeError(".google.firestore.v1beta1.DocumentTransform.FieldTransform.maximum: object expected"); + message.maximum = $root.google.firestore.v1beta1.Value.fromObject(object.maximum, long + 1); + } + if (object.minimum != null) { + if (!$util.isObject(object.minimum)) + throw TypeError(".google.firestore.v1beta1.DocumentTransform.FieldTransform.minimum: object expected"); + message.minimum = $root.google.firestore.v1beta1.Value.fromObject(object.minimum, long + 1); + } + if (object.appendMissingElements != null) { + if (!$util.isObject(object.appendMissingElements)) + throw TypeError(".google.firestore.v1beta1.DocumentTransform.FieldTransform.appendMissingElements: object expected"); + message.appendMissingElements = $root.google.firestore.v1beta1.ArrayValue.fromObject(object.appendMissingElements, long + 1); + } + if (object.removeAllFromArray != null) { + if (!$util.isObject(object.removeAllFromArray)) + throw TypeError(".google.firestore.v1beta1.DocumentTransform.FieldTransform.removeAllFromArray: object expected"); + message.removeAllFromArray = $root.google.firestore.v1beta1.ArrayValue.fromObject(object.removeAllFromArray, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a FieldTransform message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @static + * @param {google.firestore.v1beta1.DocumentTransform.FieldTransform} message FieldTransform + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldTransform.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.fieldPath = ""; + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + object.fieldPath = message.fieldPath; + if (message.setToServerValue != null && Object.hasOwnProperty.call(message, "setToServerValue")) { + object.setToServerValue = options.enums === String ? $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue[message.setToServerValue] === undefined ? message.setToServerValue : $root.google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue[message.setToServerValue] : message.setToServerValue; + if (options.oneofs) + object.transformType = "setToServerValue"; + } + if (message.increment != null && Object.hasOwnProperty.call(message, "increment")) { + object.increment = $root.google.firestore.v1beta1.Value.toObject(message.increment, options, q + 1); + if (options.oneofs) + object.transformType = "increment"; + } + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) { + object.maximum = $root.google.firestore.v1beta1.Value.toObject(message.maximum, options, q + 1); + if (options.oneofs) + object.transformType = "maximum"; + } + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) { + object.minimum = $root.google.firestore.v1beta1.Value.toObject(message.minimum, options, q + 1); + if (options.oneofs) + object.transformType = "minimum"; + } + if (message.appendMissingElements != null && Object.hasOwnProperty.call(message, "appendMissingElements")) { + object.appendMissingElements = $root.google.firestore.v1beta1.ArrayValue.toObject(message.appendMissingElements, options, q + 1); + if (options.oneofs) + object.transformType = "appendMissingElements"; + } + if (message.removeAllFromArray != null && Object.hasOwnProperty.call(message, "removeAllFromArray")) { + object.removeAllFromArray = $root.google.firestore.v1beta1.ArrayValue.toObject(message.removeAllFromArray, options, q + 1); + if (options.oneofs) + object.transformType = "removeAllFromArray"; + } + return object; + }; + + /** + * Converts this FieldTransform to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @instance + * @returns {Object.} JSON object + */ + FieldTransform.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldTransform + * @function getTypeUrl + * @memberof google.firestore.v1beta1.DocumentTransform.FieldTransform + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldTransform.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.DocumentTransform.FieldTransform"; + }; + + /** + * ServerValue enum. + * @name google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue + * @enum {number} + * @property {number} SERVER_VALUE_UNSPECIFIED=0 SERVER_VALUE_UNSPECIFIED value + * @property {number} REQUEST_TIME=1 REQUEST_TIME value + */ + FieldTransform.ServerValue = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SERVER_VALUE_UNSPECIFIED"] = 0; + values[valuesById[1] = "REQUEST_TIME"] = 1; + return values; + })(); + + return FieldTransform; + })(); + + return DocumentTransform; + })(); + + v1beta1.WriteResult = (function() { + + /** + * Properties of a WriteResult. + * @memberof google.firestore.v1beta1 + * @interface IWriteResult + * @property {google.protobuf.ITimestamp|null} [updateTime] WriteResult updateTime + * @property {Array.|null} [transformResults] WriteResult transformResults + */ + + /** + * Constructs a new WriteResult. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a WriteResult. + * @implements IWriteResult + * @constructor + * @param {google.firestore.v1beta1.IWriteResult=} [properties] Properties to set + */ + function WriteResult(properties) { + this.transformResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteResult updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.firestore.v1beta1.WriteResult + * @instance + */ + WriteResult.prototype.updateTime = null; + + /** + * WriteResult transformResults. + * @member {Array.} transformResults + * @memberof google.firestore.v1beta1.WriteResult + * @instance + */ + WriteResult.prototype.transformResults = $util.emptyArray; + + /** + * Creates a new WriteResult instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.WriteResult + * @static + * @param {google.firestore.v1beta1.IWriteResult=} [properties] Properties to set + * @returns {google.firestore.v1beta1.WriteResult} WriteResult instance + */ + WriteResult.create = function create(properties) { + return new WriteResult(properties); + }; + + /** + * Encodes the specified WriteResult message. Does not implicitly {@link google.firestore.v1beta1.WriteResult.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.WriteResult + * @static + * @param {google.firestore.v1beta1.IWriteResult} message WriteResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteResult.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.transformResults != null && message.transformResults.length) + for (var i = 0; i < message.transformResults.length; ++i) + $root.google.firestore.v1beta1.Value.encode(message.transformResults[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteResult message, length delimited. Does not implicitly {@link google.firestore.v1beta1.WriteResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.WriteResult + * @static + * @param {google.firestore.v1beta1.IWriteResult} message WriteResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a WriteResult message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.WriteResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.WriteResult} WriteResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteResult.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.WriteResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + if (!(message.transformResults && message.transformResults.length)) + message.transformResults = []; + message.transformResults.push($root.google.firestore.v1beta1.Value.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a WriteResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.WriteResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.WriteResult} WriteResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteResult message. + * @function verify + * @memberof google.firestore.v1beta1.WriteResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteResult.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime, long + 1); + if (error) + return "updateTime." + error; + } + if (message.transformResults != null && Object.hasOwnProperty.call(message, "transformResults")) { + if (!Array.isArray(message.transformResults)) + return "transformResults: array expected"; + for (var i = 0; i < message.transformResults.length; ++i) { + var error = $root.google.firestore.v1beta1.Value.verify(message.transformResults[i], long + 1); + if (error) + return "transformResults." + error; + } + } + return null; + }; + + /** + * Creates a WriteResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.WriteResult + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.WriteResult} WriteResult + */ + WriteResult.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.WriteResult) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.WriteResult: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.WriteResult(); + if (object.updateTime != null) { + if (!$util.isObject(object.updateTime)) + throw TypeError(".google.firestore.v1beta1.WriteResult.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime, long + 1); + } + if (object.transformResults) { + if (!Array.isArray(object.transformResults)) + throw TypeError(".google.firestore.v1beta1.WriteResult.transformResults: array expected"); + message.transformResults = []; + for (var i = 0; i < object.transformResults.length; ++i) { + if (!$util.isObject(object.transformResults[i])) + throw TypeError(".google.firestore.v1beta1.WriteResult.transformResults: object expected"); + message.transformResults[i] = $root.google.firestore.v1beta1.Value.fromObject(object.transformResults[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a WriteResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.WriteResult + * @static + * @param {google.firestore.v1beta1.WriteResult} message WriteResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteResult.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.transformResults = []; + if (options.defaults) + object.updateTime = null; + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options, q + 1); + if (message.transformResults && message.transformResults.length) { + object.transformResults = []; + for (var j = 0; j < message.transformResults.length; ++j) + object.transformResults[j] = $root.google.firestore.v1beta1.Value.toObject(message.transformResults[j], options, q + 1); + } + return object; + }; + + /** + * Converts this WriteResult to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.WriteResult + * @instance + * @returns {Object.} JSON object + */ + WriteResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteResult + * @function getTypeUrl + * @memberof google.firestore.v1beta1.WriteResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.WriteResult"; + }; + + return WriteResult; + })(); + + v1beta1.DocumentChange = (function() { + + /** + * Properties of a DocumentChange. + * @memberof google.firestore.v1beta1 + * @interface IDocumentChange + * @property {google.firestore.v1beta1.IDocument|null} [document] DocumentChange document + * @property {Array.|null} [targetIds] DocumentChange targetIds + * @property {Array.|null} [removedTargetIds] DocumentChange removedTargetIds + */ + + /** + * Constructs a new DocumentChange. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a DocumentChange. + * @implements IDocumentChange + * @constructor + * @param {google.firestore.v1beta1.IDocumentChange=} [properties] Properties to set + */ + function DocumentChange(properties) { + this.targetIds = []; + this.removedTargetIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentChange document. + * @member {google.firestore.v1beta1.IDocument|null|undefined} document + * @memberof google.firestore.v1beta1.DocumentChange + * @instance + */ + DocumentChange.prototype.document = null; + + /** + * DocumentChange targetIds. + * @member {Array.} targetIds + * @memberof google.firestore.v1beta1.DocumentChange + * @instance + */ + DocumentChange.prototype.targetIds = $util.emptyArray; + + /** + * DocumentChange removedTargetIds. + * @member {Array.} removedTargetIds + * @memberof google.firestore.v1beta1.DocumentChange + * @instance + */ + DocumentChange.prototype.removedTargetIds = $util.emptyArray; + + /** + * Creates a new DocumentChange instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.DocumentChange + * @static + * @param {google.firestore.v1beta1.IDocumentChange=} [properties] Properties to set + * @returns {google.firestore.v1beta1.DocumentChange} DocumentChange instance + */ + DocumentChange.create = function create(properties) { + return new DocumentChange(properties); + }; + + /** + * Encodes the specified DocumentChange message. Does not implicitly {@link google.firestore.v1beta1.DocumentChange.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.DocumentChange + * @static + * @param {google.firestore.v1beta1.IDocumentChange} message DocumentChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentChange.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.firestore.v1beta1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.targetIds != null && message.targetIds.length) { + writer.uint32(/* id 5, wireType 2 =*/42).fork(); + for (var i = 0; i < message.targetIds.length; ++i) + writer.int32(message.targetIds[i]); + writer.ldelim(); + } + if (message.removedTargetIds != null && message.removedTargetIds.length) { + writer.uint32(/* id 6, wireType 2 =*/50).fork(); + for (var i = 0; i < message.removedTargetIds.length; ++i) + writer.int32(message.removedTargetIds[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified DocumentChange message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentChange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.DocumentChange + * @static + * @param {google.firestore.v1beta1.IDocumentChange} message DocumentChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentChange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentChange message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.DocumentChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.DocumentChange} DocumentChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentChange.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.DocumentChange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = $root.google.firestore.v1beta1.Document.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + if (!(message.targetIds && message.targetIds.length)) + message.targetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.targetIds.push(reader.int32()); + } else + message.targetIds.push(reader.int32()); + break; + } + case 6: { + if (!(message.removedTargetIds && message.removedTargetIds.length)) + message.removedTargetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.removedTargetIds.push(reader.int32()); + } else + message.removedTargetIds.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentChange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.DocumentChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.DocumentChange} DocumentChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentChange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentChange message. + * @function verify + * @memberof google.firestore.v1beta1.DocumentChange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentChange.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) { + var error = $root.google.firestore.v1beta1.Document.verify(message.document, long + 1); + if (error) + return "document." + error; + } + if (message.targetIds != null && Object.hasOwnProperty.call(message, "targetIds")) { + if (!Array.isArray(message.targetIds)) + return "targetIds: array expected"; + for (var i = 0; i < message.targetIds.length; ++i) + if (!$util.isInteger(message.targetIds[i])) + return "targetIds: integer[] expected"; + } + if (message.removedTargetIds != null && Object.hasOwnProperty.call(message, "removedTargetIds")) { + if (!Array.isArray(message.removedTargetIds)) + return "removedTargetIds: array expected"; + for (var i = 0; i < message.removedTargetIds.length; ++i) + if (!$util.isInteger(message.removedTargetIds[i])) + return "removedTargetIds: integer[] expected"; + } + return null; + }; + + /** + * Creates a DocumentChange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.DocumentChange + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.DocumentChange} DocumentChange + */ + DocumentChange.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.DocumentChange) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.DocumentChange: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.DocumentChange(); + if (object.document != null) { + if (!$util.isObject(object.document)) + throw TypeError(".google.firestore.v1beta1.DocumentChange.document: object expected"); + message.document = $root.google.firestore.v1beta1.Document.fromObject(object.document, long + 1); + } + if (object.targetIds) { + if (!Array.isArray(object.targetIds)) + throw TypeError(".google.firestore.v1beta1.DocumentChange.targetIds: array expected"); + message.targetIds = []; + for (var i = 0; i < object.targetIds.length; ++i) + message.targetIds[i] = object.targetIds[i] | 0; + } + if (object.removedTargetIds) { + if (!Array.isArray(object.removedTargetIds)) + throw TypeError(".google.firestore.v1beta1.DocumentChange.removedTargetIds: array expected"); + message.removedTargetIds = []; + for (var i = 0; i < object.removedTargetIds.length; ++i) + message.removedTargetIds[i] = object.removedTargetIds[i] | 0; + } + return message; + }; + + /** + * Creates a plain object from a DocumentChange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.DocumentChange + * @static + * @param {google.firestore.v1beta1.DocumentChange} message DocumentChange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentChange.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.targetIds = []; + object.removedTargetIds = []; + } + if (options.defaults) + object.document = null; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = $root.google.firestore.v1beta1.Document.toObject(message.document, options, q + 1); + if (message.targetIds && message.targetIds.length) { + object.targetIds = []; + for (var j = 0; j < message.targetIds.length; ++j) + object.targetIds[j] = message.targetIds[j]; + } + if (message.removedTargetIds && message.removedTargetIds.length) { + object.removedTargetIds = []; + for (var j = 0; j < message.removedTargetIds.length; ++j) + object.removedTargetIds[j] = message.removedTargetIds[j]; + } + return object; + }; + + /** + * Converts this DocumentChange to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.DocumentChange + * @instance + * @returns {Object.} JSON object + */ + DocumentChange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentChange + * @function getTypeUrl + * @memberof google.firestore.v1beta1.DocumentChange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentChange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.DocumentChange"; + }; + + return DocumentChange; + })(); + + v1beta1.DocumentDelete = (function() { + + /** + * Properties of a DocumentDelete. + * @memberof google.firestore.v1beta1 + * @interface IDocumentDelete + * @property {string|null} [document] DocumentDelete document + * @property {Array.|null} [removedTargetIds] DocumentDelete removedTargetIds + * @property {google.protobuf.ITimestamp|null} [readTime] DocumentDelete readTime + */ + + /** + * Constructs a new DocumentDelete. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a DocumentDelete. + * @implements IDocumentDelete + * @constructor + * @param {google.firestore.v1beta1.IDocumentDelete=} [properties] Properties to set + */ + function DocumentDelete(properties) { + this.removedTargetIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentDelete document. + * @member {string} document + * @memberof google.firestore.v1beta1.DocumentDelete + * @instance + */ + DocumentDelete.prototype.document = ""; + + /** + * DocumentDelete removedTargetIds. + * @member {Array.} removedTargetIds + * @memberof google.firestore.v1beta1.DocumentDelete + * @instance + */ + DocumentDelete.prototype.removedTargetIds = $util.emptyArray; + + /** + * DocumentDelete readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.DocumentDelete + * @instance + */ + DocumentDelete.prototype.readTime = null; + + /** + * Creates a new DocumentDelete instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.DocumentDelete + * @static + * @param {google.firestore.v1beta1.IDocumentDelete=} [properties] Properties to set + * @returns {google.firestore.v1beta1.DocumentDelete} DocumentDelete instance + */ + DocumentDelete.create = function create(properties) { + return new DocumentDelete(properties); + }; + + /** + * Encodes the specified DocumentDelete message. Does not implicitly {@link google.firestore.v1beta1.DocumentDelete.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.DocumentDelete + * @static + * @param {google.firestore.v1beta1.IDocumentDelete} message DocumentDelete message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentDelete.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.document); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.removedTargetIds != null && message.removedTargetIds.length) { + writer.uint32(/* id 6, wireType 2 =*/50).fork(); + for (var i = 0; i < message.removedTargetIds.length; ++i) + writer.int32(message.removedTargetIds[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified DocumentDelete message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentDelete.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.DocumentDelete + * @static + * @param {google.firestore.v1beta1.IDocumentDelete} message DocumentDelete message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentDelete.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentDelete message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.DocumentDelete + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.DocumentDelete} DocumentDelete + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentDelete.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.DocumentDelete(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = reader.string(); + break; + } + case 6: { + if (!(message.removedTargetIds && message.removedTargetIds.length)) + message.removedTargetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.removedTargetIds.push(reader.int32()); + } else + message.removedTargetIds.push(reader.int32()); + break; + } + case 4: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentDelete message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.DocumentDelete + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.DocumentDelete} DocumentDelete + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentDelete.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentDelete message. + * @function verify + * @memberof google.firestore.v1beta1.DocumentDelete + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentDelete.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + if (!$util.isString(message.document)) + return "document: string expected"; + if (message.removedTargetIds != null && Object.hasOwnProperty.call(message, "removedTargetIds")) { + if (!Array.isArray(message.removedTargetIds)) + return "removedTargetIds: array expected"; + for (var i = 0; i < message.removedTargetIds.length; ++i) + if (!$util.isInteger(message.removedTargetIds[i])) + return "removedTargetIds: integer[] expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a DocumentDelete message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.DocumentDelete + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.DocumentDelete} DocumentDelete + */ + DocumentDelete.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.DocumentDelete) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.DocumentDelete: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.DocumentDelete(); + if (object.document != null) + message.document = String(object.document); + if (object.removedTargetIds) { + if (!Array.isArray(object.removedTargetIds)) + throw TypeError(".google.firestore.v1beta1.DocumentDelete.removedTargetIds: array expected"); + message.removedTargetIds = []; + for (var i = 0; i < object.removedTargetIds.length; ++i) + message.removedTargetIds[i] = object.removedTargetIds[i] | 0; + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.DocumentDelete.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a DocumentDelete message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.DocumentDelete + * @static + * @param {google.firestore.v1beta1.DocumentDelete} message DocumentDelete + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentDelete.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.removedTargetIds = []; + if (options.defaults) { + object.document = ""; + object.readTime = null; + } + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = message.document; + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + if (message.removedTargetIds && message.removedTargetIds.length) { + object.removedTargetIds = []; + for (var j = 0; j < message.removedTargetIds.length; ++j) + object.removedTargetIds[j] = message.removedTargetIds[j]; + } + return object; + }; + + /** + * Converts this DocumentDelete to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.DocumentDelete + * @instance + * @returns {Object.} JSON object + */ + DocumentDelete.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentDelete + * @function getTypeUrl + * @memberof google.firestore.v1beta1.DocumentDelete + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentDelete.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.DocumentDelete"; + }; + + return DocumentDelete; + })(); + + v1beta1.DocumentRemove = (function() { + + /** + * Properties of a DocumentRemove. + * @memberof google.firestore.v1beta1 + * @interface IDocumentRemove + * @property {string|null} [document] DocumentRemove document + * @property {Array.|null} [removedTargetIds] DocumentRemove removedTargetIds + * @property {google.protobuf.ITimestamp|null} [readTime] DocumentRemove readTime + */ + + /** + * Constructs a new DocumentRemove. + * @memberof google.firestore.v1beta1 + * @classdesc Represents a DocumentRemove. + * @implements IDocumentRemove + * @constructor + * @param {google.firestore.v1beta1.IDocumentRemove=} [properties] Properties to set + */ + function DocumentRemove(properties) { + this.removedTargetIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentRemove document. + * @member {string} document + * @memberof google.firestore.v1beta1.DocumentRemove + * @instance + */ + DocumentRemove.prototype.document = ""; + + /** + * DocumentRemove removedTargetIds. + * @member {Array.} removedTargetIds + * @memberof google.firestore.v1beta1.DocumentRemove + * @instance + */ + DocumentRemove.prototype.removedTargetIds = $util.emptyArray; + + /** + * DocumentRemove readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.firestore.v1beta1.DocumentRemove + * @instance + */ + DocumentRemove.prototype.readTime = null; + + /** + * Creates a new DocumentRemove instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.DocumentRemove + * @static + * @param {google.firestore.v1beta1.IDocumentRemove=} [properties] Properties to set + * @returns {google.firestore.v1beta1.DocumentRemove} DocumentRemove instance + */ + DocumentRemove.create = function create(properties) { + return new DocumentRemove(properties); + }; + + /** + * Encodes the specified DocumentRemove message. Does not implicitly {@link google.firestore.v1beta1.DocumentRemove.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.DocumentRemove + * @static + * @param {google.firestore.v1beta1.IDocumentRemove} message DocumentRemove message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentRemove.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.document); + if (message.removedTargetIds != null && message.removedTargetIds.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.removedTargetIds.length; ++i) + writer.int32(message.removedTargetIds[i]); + writer.ldelim(); + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentRemove message, length delimited. Does not implicitly {@link google.firestore.v1beta1.DocumentRemove.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.DocumentRemove + * @static + * @param {google.firestore.v1beta1.IDocumentRemove} message DocumentRemove message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentRemove.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DocumentRemove message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.DocumentRemove + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.DocumentRemove} DocumentRemove + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentRemove.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.DocumentRemove(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.document = reader.string(); + break; + } + case 2: { + if (!(message.removedTargetIds && message.removedTargetIds.length)) + message.removedTargetIds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.removedTargetIds.push(reader.int32()); + } else + message.removedTargetIds.push(reader.int32()); + break; + } + case 4: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentRemove message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.DocumentRemove + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.DocumentRemove} DocumentRemove + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentRemove.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentRemove message. + * @function verify + * @memberof google.firestore.v1beta1.DocumentRemove + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentRemove.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + if (!$util.isString(message.document)) + return "document: string expected"; + if (message.removedTargetIds != null && Object.hasOwnProperty.call(message, "removedTargetIds")) { + if (!Array.isArray(message.removedTargetIds)) + return "removedTargetIds: array expected"; + for (var i = 0; i < message.removedTargetIds.length; ++i) + if (!$util.isInteger(message.removedTargetIds[i])) + return "removedTargetIds: integer[] expected"; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime, long + 1); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a DocumentRemove message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.DocumentRemove + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.DocumentRemove} DocumentRemove + */ + DocumentRemove.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.DocumentRemove) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.DocumentRemove: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.DocumentRemove(); + if (object.document != null) + message.document = String(object.document); + if (object.removedTargetIds) { + if (!Array.isArray(object.removedTargetIds)) + throw TypeError(".google.firestore.v1beta1.DocumentRemove.removedTargetIds: array expected"); + message.removedTargetIds = []; + for (var i = 0; i < object.removedTargetIds.length; ++i) + message.removedTargetIds[i] = object.removedTargetIds[i] | 0; + } + if (object.readTime != null) { + if (!$util.isObject(object.readTime)) + throw TypeError(".google.firestore.v1beta1.DocumentRemove.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a DocumentRemove message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.DocumentRemove + * @static + * @param {google.firestore.v1beta1.DocumentRemove} message DocumentRemove + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentRemove.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.removedTargetIds = []; + if (options.defaults) { + object.document = ""; + object.readTime = null; + } + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + object.document = message.document; + if (message.removedTargetIds && message.removedTargetIds.length) { + object.removedTargetIds = []; + for (var j = 0; j < message.removedTargetIds.length; ++j) + object.removedTargetIds[j] = message.removedTargetIds[j]; + } + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options, q + 1); + return object; + }; + + /** + * Converts this DocumentRemove to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.DocumentRemove + * @instance + * @returns {Object.} JSON object + */ + DocumentRemove.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentRemove + * @function getTypeUrl + * @memberof google.firestore.v1beta1.DocumentRemove + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentRemove.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.DocumentRemove"; + }; + + return DocumentRemove; + })(); + + v1beta1.ExistenceFilter = (function() { + + /** + * Properties of an ExistenceFilter. + * @memberof google.firestore.v1beta1 + * @interface IExistenceFilter + * @property {number|null} [targetId] ExistenceFilter targetId + * @property {number|null} [count] ExistenceFilter count + */ + + /** + * Constructs a new ExistenceFilter. + * @memberof google.firestore.v1beta1 + * @classdesc Represents an ExistenceFilter. + * @implements IExistenceFilter + * @constructor + * @param {google.firestore.v1beta1.IExistenceFilter=} [properties] Properties to set + */ + function ExistenceFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExistenceFilter targetId. + * @member {number} targetId + * @memberof google.firestore.v1beta1.ExistenceFilter + * @instance + */ + ExistenceFilter.prototype.targetId = 0; + + /** + * ExistenceFilter count. + * @member {number} count + * @memberof google.firestore.v1beta1.ExistenceFilter + * @instance + */ + ExistenceFilter.prototype.count = 0; + + /** + * Creates a new ExistenceFilter instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.ExistenceFilter + * @static + * @param {google.firestore.v1beta1.IExistenceFilter=} [properties] Properties to set + * @returns {google.firestore.v1beta1.ExistenceFilter} ExistenceFilter instance + */ + ExistenceFilter.create = function create(properties) { + return new ExistenceFilter(properties); + }; + + /** + * Encodes the specified ExistenceFilter message. Does not implicitly {@link google.firestore.v1beta1.ExistenceFilter.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.ExistenceFilter + * @static + * @param {google.firestore.v1beta1.IExistenceFilter} message ExistenceFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExistenceFilter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.targetId); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.count); + return writer; + }; + + /** + * Encodes the specified ExistenceFilter message, length delimited. Does not implicitly {@link google.firestore.v1beta1.ExistenceFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.ExistenceFilter + * @static + * @param {google.firestore.v1beta1.IExistenceFilter} message ExistenceFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExistenceFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExistenceFilter message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.ExistenceFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.ExistenceFilter} ExistenceFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExistenceFilter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.ExistenceFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.targetId = reader.int32(); + break; + } + case 2: { + message.count = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExistenceFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.ExistenceFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.ExistenceFilter} ExistenceFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExistenceFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExistenceFilter message. + * @function verify + * @memberof google.firestore.v1beta1.ExistenceFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExistenceFilter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + if (!$util.isInteger(message.targetId)) + return "targetId: integer expected"; + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; + return null; + }; + + /** + * Creates an ExistenceFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.ExistenceFilter + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.ExistenceFilter} ExistenceFilter + */ + ExistenceFilter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.ExistenceFilter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.ExistenceFilter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.ExistenceFilter(); + if (object.targetId != null) + message.targetId = object.targetId | 0; + if (object.count != null) + message.count = object.count | 0; + return message; + }; + + /** + * Creates a plain object from an ExistenceFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.ExistenceFilter + * @static + * @param {google.firestore.v1beta1.ExistenceFilter} message ExistenceFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExistenceFilter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.targetId = 0; + object.count = 0; + } + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + object.targetId = message.targetId; + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + object.count = message.count; + return object; + }; + + /** + * Converts this ExistenceFilter to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.ExistenceFilter + * @instance + * @returns {Object.} JSON object + */ + ExistenceFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExistenceFilter + * @function getTypeUrl + * @memberof google.firestore.v1beta1.ExistenceFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExistenceFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.ExistenceFilter"; + }; + + return ExistenceFilter; + })(); + + v1beta1.UndeliverableFirstGenEvent = (function() { + + /** + * Properties of an UndeliverableFirstGenEvent. + * @memberof google.firestore.v1beta1 + * @interface IUndeliverableFirstGenEvent + * @property {string|null} [message] UndeliverableFirstGenEvent message + * @property {google.firestore.v1beta1.UndeliverableFirstGenEvent.Reason|null} [reason] UndeliverableFirstGenEvent reason + * @property {string|null} [documentName] UndeliverableFirstGenEvent documentName + * @property {google.firestore.v1beta1.UndeliverableFirstGenEvent.DocumentChangeType|null} [documentChangeType] UndeliverableFirstGenEvent documentChangeType + * @property {Array.|null} [functionName] UndeliverableFirstGenEvent functionName + * @property {google.protobuf.ITimestamp|null} [triggeredTime] UndeliverableFirstGenEvent triggeredTime + */ + + /** + * Constructs a new UndeliverableFirstGenEvent. + * @memberof google.firestore.v1beta1 + * @classdesc Represents an UndeliverableFirstGenEvent. + * @implements IUndeliverableFirstGenEvent + * @constructor + * @param {google.firestore.v1beta1.IUndeliverableFirstGenEvent=} [properties] Properties to set + */ + function UndeliverableFirstGenEvent(properties) { + this.functionName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UndeliverableFirstGenEvent message. + * @member {string} message + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @instance + */ + UndeliverableFirstGenEvent.prototype.message = ""; + + /** + * UndeliverableFirstGenEvent reason. + * @member {google.firestore.v1beta1.UndeliverableFirstGenEvent.Reason} reason + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @instance + */ + UndeliverableFirstGenEvent.prototype.reason = 0; + + /** + * UndeliverableFirstGenEvent documentName. + * @member {string} documentName + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @instance + */ + UndeliverableFirstGenEvent.prototype.documentName = ""; + + /** + * UndeliverableFirstGenEvent documentChangeType. + * @member {google.firestore.v1beta1.UndeliverableFirstGenEvent.DocumentChangeType} documentChangeType + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @instance + */ + UndeliverableFirstGenEvent.prototype.documentChangeType = 0; + + /** + * UndeliverableFirstGenEvent functionName. + * @member {Array.} functionName + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @instance + */ + UndeliverableFirstGenEvent.prototype.functionName = $util.emptyArray; + + /** + * UndeliverableFirstGenEvent triggeredTime. + * @member {google.protobuf.ITimestamp|null|undefined} triggeredTime + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @instance + */ + UndeliverableFirstGenEvent.prototype.triggeredTime = null; + + /** + * Creates a new UndeliverableFirstGenEvent instance using the specified properties. + * @function create + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @static + * @param {google.firestore.v1beta1.IUndeliverableFirstGenEvent=} [properties] Properties to set + * @returns {google.firestore.v1beta1.UndeliverableFirstGenEvent} UndeliverableFirstGenEvent instance + */ + UndeliverableFirstGenEvent.create = function create(properties) { + return new UndeliverableFirstGenEvent(properties); + }; + + /** + * Encodes the specified UndeliverableFirstGenEvent message. Does not implicitly {@link google.firestore.v1beta1.UndeliverableFirstGenEvent.verify|verify} messages. + * @function encode + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @static + * @param {google.firestore.v1beta1.IUndeliverableFirstGenEvent} message UndeliverableFirstGenEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeliverableFirstGenEvent.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.reason); + if (message.documentName != null && Object.hasOwnProperty.call(message, "documentName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentName); + if (message.documentChangeType != null && Object.hasOwnProperty.call(message, "documentChangeType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.documentChangeType); + if (message.functionName != null && message.functionName.length) + for (var i = 0; i < message.functionName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.functionName[i]); + if (message.triggeredTime != null && Object.hasOwnProperty.call(message, "triggeredTime")) + $root.google.protobuf.Timestamp.encode(message.triggeredTime, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified UndeliverableFirstGenEvent message, length delimited. Does not implicitly {@link google.firestore.v1beta1.UndeliverableFirstGenEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @static + * @param {google.firestore.v1beta1.IUndeliverableFirstGenEvent} message UndeliverableFirstGenEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeliverableFirstGenEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UndeliverableFirstGenEvent message from the specified reader or buffer. + * @function decode + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.firestore.v1beta1.UndeliverableFirstGenEvent} UndeliverableFirstGenEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeliverableFirstGenEvent.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.firestore.v1beta1.UndeliverableFirstGenEvent(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.message = reader.string(); + break; + } + case 2: { + message.reason = reader.int32(); + break; + } + case 3: { + message.documentName = reader.string(); + break; + } + case 4: { + message.documentChangeType = reader.int32(); + break; + } + case 5: { + if (!(message.functionName && message.functionName.length)) + message.functionName = []; + message.functionName.push(reader.string()); + break; + } + case 6: { + message.triggeredTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UndeliverableFirstGenEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.firestore.v1beta1.UndeliverableFirstGenEvent} UndeliverableFirstGenEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeliverableFirstGenEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeliverableFirstGenEvent message. + * @function verify + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeliverableFirstGenEvent.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + switch (message.reason) { + default: + return "reason: enum value expected"; + case 0: + case 1: + break; + } + if (message.documentName != null && Object.hasOwnProperty.call(message, "documentName")) + if (!$util.isString(message.documentName)) + return "documentName: string expected"; + if (message.documentChangeType != null && Object.hasOwnProperty.call(message, "documentChangeType")) + switch (message.documentChangeType) { + default: + return "documentChangeType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.functionName != null && Object.hasOwnProperty.call(message, "functionName")) { + if (!Array.isArray(message.functionName)) + return "functionName: array expected"; + for (var i = 0; i < message.functionName.length; ++i) + if (!$util.isString(message.functionName[i])) + return "functionName: string[] expected"; + } + if (message.triggeredTime != null && Object.hasOwnProperty.call(message, "triggeredTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.triggeredTime, long + 1); + if (error) + return "triggeredTime." + error; + } + return null; + }; + + /** + * Creates an UndeliverableFirstGenEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @static + * @param {Object.} object Plain object + * @returns {google.firestore.v1beta1.UndeliverableFirstGenEvent} UndeliverableFirstGenEvent + */ + UndeliverableFirstGenEvent.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.firestore.v1beta1.UndeliverableFirstGenEvent) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.firestore.v1beta1.UndeliverableFirstGenEvent: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.firestore.v1beta1.UndeliverableFirstGenEvent(); + if (object.message != null) + message.message = String(object.message); + switch (object.reason) { + default: + if (typeof object.reason === "number") { + message.reason = object.reason; + break; + } + break; + case "REASON_UNSPECIFIED": + case 0: + message.reason = 0; + break; + case "EXCEEDING_SIZE_LIMIT": + case 1: + message.reason = 1; + break; + } + if (object.documentName != null) + message.documentName = String(object.documentName); + switch (object.documentChangeType) { + default: + if (typeof object.documentChangeType === "number") { + message.documentChangeType = object.documentChangeType; + break; + } + break; + case "DOCUMENT_CHANGE_TYPE_UNSPECIFIED": + case 0: + message.documentChangeType = 0; + break; + case "CREATE": + case 1: + message.documentChangeType = 1; + break; + case "DELETE": + case 2: + message.documentChangeType = 2; + break; + case "UPDATE": + case 3: + message.documentChangeType = 3; + break; + } + if (object.functionName) { + if (!Array.isArray(object.functionName)) + throw TypeError(".google.firestore.v1beta1.UndeliverableFirstGenEvent.functionName: array expected"); + message.functionName = []; + for (var i = 0; i < object.functionName.length; ++i) + message.functionName[i] = String(object.functionName[i]); + } + if (object.triggeredTime != null) { + if (!$util.isObject(object.triggeredTime)) + throw TypeError(".google.firestore.v1beta1.UndeliverableFirstGenEvent.triggeredTime: object expected"); + message.triggeredTime = $root.google.protobuf.Timestamp.fromObject(object.triggeredTime, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an UndeliverableFirstGenEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @static + * @param {google.firestore.v1beta1.UndeliverableFirstGenEvent} message UndeliverableFirstGenEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeliverableFirstGenEvent.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.functionName = []; + if (options.defaults) { + object.message = ""; + object.reason = options.enums === String ? "REASON_UNSPECIFIED" : 0; + object.documentName = ""; + object.documentChangeType = options.enums === String ? "DOCUMENT_CHANGE_TYPE_UNSPECIFIED" : 0; + object.triggeredTime = null; + } + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + object.message = message.message; + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + object.reason = options.enums === String ? $root.google.firestore.v1beta1.UndeliverableFirstGenEvent.Reason[message.reason] === undefined ? message.reason : $root.google.firestore.v1beta1.UndeliverableFirstGenEvent.Reason[message.reason] : message.reason; + if (message.documentName != null && Object.hasOwnProperty.call(message, "documentName")) + object.documentName = message.documentName; + if (message.documentChangeType != null && Object.hasOwnProperty.call(message, "documentChangeType")) + object.documentChangeType = options.enums === String ? $root.google.firestore.v1beta1.UndeliverableFirstGenEvent.DocumentChangeType[message.documentChangeType] === undefined ? message.documentChangeType : $root.google.firestore.v1beta1.UndeliverableFirstGenEvent.DocumentChangeType[message.documentChangeType] : message.documentChangeType; + if (message.functionName && message.functionName.length) { + object.functionName = []; + for (var j = 0; j < message.functionName.length; ++j) + object.functionName[j] = message.functionName[j]; + } + if (message.triggeredTime != null && Object.hasOwnProperty.call(message, "triggeredTime")) + object.triggeredTime = $root.google.protobuf.Timestamp.toObject(message.triggeredTime, options, q + 1); + return object; + }; + + /** + * Converts this UndeliverableFirstGenEvent to JSON. + * @function toJSON + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @instance + * @returns {Object.} JSON object + */ + UndeliverableFirstGenEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UndeliverableFirstGenEvent + * @function getTypeUrl + * @memberof google.firestore.v1beta1.UndeliverableFirstGenEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeliverableFirstGenEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.firestore.v1beta1.UndeliverableFirstGenEvent"; + }; + + /** + * Reason enum. + * @name google.firestore.v1beta1.UndeliverableFirstGenEvent.Reason + * @enum {number} + * @property {number} REASON_UNSPECIFIED=0 REASON_UNSPECIFIED value + * @property {number} EXCEEDING_SIZE_LIMIT=1 EXCEEDING_SIZE_LIMIT value + */ + UndeliverableFirstGenEvent.Reason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "EXCEEDING_SIZE_LIMIT"] = 1; + return values; + })(); + + /** + * DocumentChangeType enum. + * @name google.firestore.v1beta1.UndeliverableFirstGenEvent.DocumentChangeType + * @enum {number} + * @property {number} DOCUMENT_CHANGE_TYPE_UNSPECIFIED=0 DOCUMENT_CHANGE_TYPE_UNSPECIFIED value + * @property {number} CREATE=1 CREATE value + * @property {number} DELETE=2 DELETE value + * @property {number} UPDATE=3 UPDATE value + */ + UndeliverableFirstGenEvent.DocumentChangeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DOCUMENT_CHANGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATE"] = 1; + values[valuesById[2] = "DELETE"] = 2; + values[valuesById[3] = "UPDATE"] = 3; + return values; + })(); + + return UndeliverableFirstGenEvent; + })(); + + return v1beta1; + })(); + + return firestore; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + * @property {number} IDENTIFIER=8 IDENTIFIER value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + values[valuesById[8] = "IDENTIFIER"] = 8; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && Object.hasOwnProperty.call(message, "pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && Object.hasOwnProperty.call(message, "style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.ResourceDescriptor: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + object.nameField = message.nameField; + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + object.plural = message.plural; + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceDescriptor + * @function getTypeUrl + * @memberof google.api.ResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceDescriptor"; + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.ResourceReference) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.ResourceReference: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + object.type = message.type; + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceReference + * @function getTypeUrl + * @memberof google.api.ResourceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceReference"; + }; + + return ResourceReference; + })(); + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http + * @instance + */ + Http.prototype.fullyDecodeReservedExpansion = false; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.fullyDecodeReservedExpansion = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.rules != null && Object.hasOwnProperty.call(message, "rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i], long + 1); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.Http) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.Http: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (!$util.isObject(object.rules[i])) + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i], long + 1); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options, q + 1); + } + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Http + * @function getTypeUrl + * @memberof google.api.Http + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Http"; + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule get. + * @member {string|null|undefined} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = null; + + /** + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = null; + + /** + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = null; + + /** + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = null; + + /** + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = null; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork(), q + 1).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && Object.hasOwnProperty.call(message, "get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && Object.hasOwnProperty.call(message, "put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && Object.hasOwnProperty.call(message, "post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom, long + 1); + if (error) + return "custom." + error; + } + } + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && Object.hasOwnProperty.call(message, "additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i], long + 1); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.HttpRule) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.HttpRule: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (!$util.isObject(object.custom)) + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom, long + 1); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (!$util.isObject(object.additionalBindings[i])) + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + object.selector = message.selector; + if (message.get != null && Object.hasOwnProperty.call(message, "get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && Object.hasOwnProperty.call(message, "put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && Object.hasOwnProperty.call(message, "post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + object.body = message.body; + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options, q + 1); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options, q + 1); + } + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + object.responseBody = message.responseBody; + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HttpRule + * @function getTypeUrl + * @memberof google.api.HttpRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.HttpRule"; + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.CustomHttpPattern: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + object.kind = message.kind; + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomHttpPattern + * @function getTypeUrl + * @memberof google.api.CustomHttpPattern + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CustomHttpPattern"; + }; + + return CustomHttpPattern; + })(); + + api.CommonLanguageSettings = (function() { + + /** + * Properties of a CommonLanguageSettings. + * @memberof google.api + * @interface ICommonLanguageSettings + * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri + * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration + */ + + /** + * Constructs a new CommonLanguageSettings. + * @memberof google.api + * @classdesc Represents a CommonLanguageSettings. + * @implements ICommonLanguageSettings + * @constructor + * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set + */ + function CommonLanguageSettings(properties) { + this.destinations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommonLanguageSettings referenceDocsUri. + * @member {string} referenceDocsUri + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.referenceDocsUri = ""; + + /** + * CommonLanguageSettings destinations. + * @member {Array.} destinations + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.destinations = $util.emptyArray; + + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + + /** + * Creates a new CommonLanguageSettings instance using the specified properties. + * @function create + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings instance + */ + CommonLanguageSettings.create = function create(properties) { + return new CommonLanguageSettings(properties); + }; + + /** + * Encodes the specified CommonLanguageSettings message. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @function encode + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonLanguageSettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.referenceDocsUri); + if (message.destinations != null && message.destinations.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.destinations.length; ++i) + writer.int32(message.destinations[i]); + writer.ldelim(); + } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommonLanguageSettings message, length delimited. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonLanguageSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.CommonLanguageSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonLanguageSettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CommonLanguageSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.referenceDocsUri = reader.string(); + break; + } + case 2: { + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.destinations.push(reader.int32()); + } else + message.destinations.push(reader.int32()); + break; + } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CommonLanguageSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonLanguageSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommonLanguageSettings message. + * @function verify + * @memberof google.api.CommonLanguageSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommonLanguageSettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) + if (!$util.isString(message.referenceDocsUri)) + return "referenceDocsUri: string expected"; + if (message.destinations != null && Object.hasOwnProperty.call(message, "destinations")) { + if (!Array.isArray(message.destinations)) + return "destinations: array expected"; + for (var i = 0; i < message.destinations.length; ++i) + switch (message.destinations[i]) { + default: + return "destinations: enum value[] expected"; + case 0: + case 10: + case 20: + break; + } + } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration, long + 1); + if (error) + return "selectiveGapicGeneration." + error; + } + return null; + }; + + /** + * Creates a CommonLanguageSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CommonLanguageSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings + */ + CommonLanguageSettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.CommonLanguageSettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.CommonLanguageSettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.CommonLanguageSettings(); + if (object.referenceDocsUri != null) + message.referenceDocsUri = String(object.referenceDocsUri); + if (object.destinations) { + if (!Array.isArray(object.destinations)) + throw TypeError(".google.api.CommonLanguageSettings.destinations: array expected"); + message.destinations = []; + for (var i = 0; i < object.destinations.length; ++i) + switch (object.destinations[i]) { + default: + if (typeof object.destinations[i] === "number") { + message.destinations[i] = object.destinations[i]; + break; + } + case "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": + case 0: + message.destinations[i] = 0; + break; + case "GITHUB": + case 10: + message.destinations[i] = 10; + break; + case "PACKAGE_MANAGER": + case 20: + message.destinations[i] = 20; + break; + } + } + if (object.selectiveGapicGeneration != null) { + if (!$util.isObject(object.selectiveGapicGeneration)) + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a CommonLanguageSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.CommonLanguageSettings} message CommonLanguageSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommonLanguageSettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.destinations = []; + if (options.defaults) { + object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } + if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) + object.referenceDocsUri = message.referenceDocsUri; + if (message.destinations && message.destinations.length) { + object.destinations = []; + for (var j = 0; j < message.destinations.length; ++j) + object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; + } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options, q + 1); + return object; + }; + + /** + * Converts this CommonLanguageSettings to JSON. + * @function toJSON + * @memberof google.api.CommonLanguageSettings + * @instance + * @returns {Object.} JSON object + */ + CommonLanguageSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CommonLanguageSettings + * @function getTypeUrl + * @memberof google.api.CommonLanguageSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CommonLanguageSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CommonLanguageSettings"; + }; + + return CommonLanguageSettings; + })(); + + api.ClientLibrarySettings = (function() { + + /** + * Properties of a ClientLibrarySettings. + * @memberof google.api + * @interface IClientLibrarySettings + * @property {string|null} [version] ClientLibrarySettings version + * @property {google.api.LaunchStage|null} [launchStage] ClientLibrarySettings launchStage + * @property {boolean|null} [restNumericEnums] ClientLibrarySettings restNumericEnums + * @property {google.api.IJavaSettings|null} [javaSettings] ClientLibrarySettings javaSettings + * @property {google.api.ICppSettings|null} [cppSettings] ClientLibrarySettings cppSettings + * @property {google.api.IPhpSettings|null} [phpSettings] ClientLibrarySettings phpSettings + * @property {google.api.IPythonSettings|null} [pythonSettings] ClientLibrarySettings pythonSettings + * @property {google.api.INodeSettings|null} [nodeSettings] ClientLibrarySettings nodeSettings + * @property {google.api.IDotnetSettings|null} [dotnetSettings] ClientLibrarySettings dotnetSettings + * @property {google.api.IRubySettings|null} [rubySettings] ClientLibrarySettings rubySettings + * @property {google.api.IGoSettings|null} [goSettings] ClientLibrarySettings goSettings + */ + + /** + * Constructs a new ClientLibrarySettings. + * @memberof google.api + * @classdesc Represents a ClientLibrarySettings. + * @implements IClientLibrarySettings + * @constructor + * @param {google.api.IClientLibrarySettings=} [properties] Properties to set + */ + function ClientLibrarySettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientLibrarySettings version. + * @member {string} version + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.version = ""; + + /** + * ClientLibrarySettings launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.launchStage = 0; + + /** + * ClientLibrarySettings restNumericEnums. + * @member {boolean} restNumericEnums + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.restNumericEnums = false; + + /** + * ClientLibrarySettings javaSettings. + * @member {google.api.IJavaSettings|null|undefined} javaSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.javaSettings = null; + + /** + * ClientLibrarySettings cppSettings. + * @member {google.api.ICppSettings|null|undefined} cppSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.cppSettings = null; + + /** + * ClientLibrarySettings phpSettings. + * @member {google.api.IPhpSettings|null|undefined} phpSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.phpSettings = null; + + /** + * ClientLibrarySettings pythonSettings. + * @member {google.api.IPythonSettings|null|undefined} pythonSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.pythonSettings = null; + + /** + * ClientLibrarySettings nodeSettings. + * @member {google.api.INodeSettings|null|undefined} nodeSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.nodeSettings = null; + + /** + * ClientLibrarySettings dotnetSettings. + * @member {google.api.IDotnetSettings|null|undefined} dotnetSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.dotnetSettings = null; + + /** + * ClientLibrarySettings rubySettings. + * @member {google.api.IRubySettings|null|undefined} rubySettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.rubySettings = null; + + /** + * ClientLibrarySettings goSettings. + * @member {google.api.IGoSettings|null|undefined} goSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.goSettings = null; + + /** + * Creates a new ClientLibrarySettings instance using the specified properties. + * @function create + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings=} [properties] Properties to set + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings instance + */ + ClientLibrarySettings.create = function create(properties) { + return new ClientLibrarySettings(properties); + }; + + /** + * Encodes the specified ClientLibrarySettings message. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @function encode + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientLibrarySettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.launchStage); + if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.restNumericEnums); + if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) + $root.google.api.JavaSettings.encode(message.javaSettings, writer.uint32(/* id 21, wireType 2 =*/170).fork(), q + 1).ldelim(); + if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) + $root.google.api.CppSettings.encode(message.cppSettings, writer.uint32(/* id 22, wireType 2 =*/178).fork(), q + 1).ldelim(); + if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) + $root.google.api.PhpSettings.encode(message.phpSettings, writer.uint32(/* id 23, wireType 2 =*/186).fork(), q + 1).ldelim(); + if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) + $root.google.api.PythonSettings.encode(message.pythonSettings, writer.uint32(/* id 24, wireType 2 =*/194).fork(), q + 1).ldelim(); + if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) + $root.google.api.NodeSettings.encode(message.nodeSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork(), q + 1).ldelim(); + if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) + $root.google.api.DotnetSettings.encode(message.dotnetSettings, writer.uint32(/* id 26, wireType 2 =*/210).fork(), q + 1).ldelim(); + if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) + $root.google.api.RubySettings.encode(message.rubySettings, writer.uint32(/* id 27, wireType 2 =*/218).fork(), q + 1).ldelim(); + if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) + $root.google.api.GoSettings.encode(message.goSettings, writer.uint32(/* id 28, wireType 2 =*/226).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClientLibrarySettings message, length delimited. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientLibrarySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.ClientLibrarySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientLibrarySettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ClientLibrarySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.version = reader.string(); + break; + } + case 2: { + message.launchStage = reader.int32(); + break; + } + case 3: { + message.restNumericEnums = reader.bool(); + break; + } + case 21: { + message.javaSettings = $root.google.api.JavaSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 22: { + message.cppSettings = $root.google.api.CppSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 23: { + message.phpSettings = $root.google.api.PhpSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 24: { + message.pythonSettings = $root.google.api.PythonSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 25: { + message.nodeSettings = $root.google.api.NodeSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 26: { + message.dotnetSettings = $root.google.api.DotnetSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 27: { + message.rubySettings = $root.google.api.RubySettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 28: { + message.goSettings = $root.google.api.GoSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ClientLibrarySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientLibrarySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientLibrarySettings message. + * @function verify + * @memberof google.api.ClientLibrarySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientLibrarySettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) + if (typeof message.restNumericEnums !== "boolean") + return "restNumericEnums: boolean expected"; + if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) { + var error = $root.google.api.JavaSettings.verify(message.javaSettings, long + 1); + if (error) + return "javaSettings." + error; + } + if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) { + var error = $root.google.api.CppSettings.verify(message.cppSettings, long + 1); + if (error) + return "cppSettings." + error; + } + if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) { + var error = $root.google.api.PhpSettings.verify(message.phpSettings, long + 1); + if (error) + return "phpSettings." + error; + } + if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) { + var error = $root.google.api.PythonSettings.verify(message.pythonSettings, long + 1); + if (error) + return "pythonSettings." + error; + } + if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) { + var error = $root.google.api.NodeSettings.verify(message.nodeSettings, long + 1); + if (error) + return "nodeSettings." + error; + } + if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) { + var error = $root.google.api.DotnetSettings.verify(message.dotnetSettings, long + 1); + if (error) + return "dotnetSettings." + error; + } + if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) { + var error = $root.google.api.RubySettings.verify(message.rubySettings, long + 1); + if (error) + return "rubySettings." + error; + } + if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) { + var error = $root.google.api.GoSettings.verify(message.goSettings, long + 1); + if (error) + return "goSettings." + error; + } + return null; + }; + + /** + * Creates a ClientLibrarySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ClientLibrarySettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + */ + ClientLibrarySettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.ClientLibrarySettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.ClientLibrarySettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.ClientLibrarySettings(); + if (object.version != null) + message.version = String(object.version); + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + if (object.restNumericEnums != null) + message.restNumericEnums = Boolean(object.restNumericEnums); + if (object.javaSettings != null) { + if (!$util.isObject(object.javaSettings)) + throw TypeError(".google.api.ClientLibrarySettings.javaSettings: object expected"); + message.javaSettings = $root.google.api.JavaSettings.fromObject(object.javaSettings, long + 1); + } + if (object.cppSettings != null) { + if (!$util.isObject(object.cppSettings)) + throw TypeError(".google.api.ClientLibrarySettings.cppSettings: object expected"); + message.cppSettings = $root.google.api.CppSettings.fromObject(object.cppSettings, long + 1); + } + if (object.phpSettings != null) { + if (!$util.isObject(object.phpSettings)) + throw TypeError(".google.api.ClientLibrarySettings.phpSettings: object expected"); + message.phpSettings = $root.google.api.PhpSettings.fromObject(object.phpSettings, long + 1); + } + if (object.pythonSettings != null) { + if (!$util.isObject(object.pythonSettings)) + throw TypeError(".google.api.ClientLibrarySettings.pythonSettings: object expected"); + message.pythonSettings = $root.google.api.PythonSettings.fromObject(object.pythonSettings, long + 1); + } + if (object.nodeSettings != null) { + if (!$util.isObject(object.nodeSettings)) + throw TypeError(".google.api.ClientLibrarySettings.nodeSettings: object expected"); + message.nodeSettings = $root.google.api.NodeSettings.fromObject(object.nodeSettings, long + 1); + } + if (object.dotnetSettings != null) { + if (!$util.isObject(object.dotnetSettings)) + throw TypeError(".google.api.ClientLibrarySettings.dotnetSettings: object expected"); + message.dotnetSettings = $root.google.api.DotnetSettings.fromObject(object.dotnetSettings, long + 1); + } + if (object.rubySettings != null) { + if (!$util.isObject(object.rubySettings)) + throw TypeError(".google.api.ClientLibrarySettings.rubySettings: object expected"); + message.rubySettings = $root.google.api.RubySettings.fromObject(object.rubySettings, long + 1); + } + if (object.goSettings != null) { + if (!$util.isObject(object.goSettings)) + throw TypeError(".google.api.ClientLibrarySettings.goSettings: object expected"); + message.goSettings = $root.google.api.GoSettings.fromObject(object.goSettings, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a ClientLibrarySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.ClientLibrarySettings} message ClientLibrarySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientLibrarySettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.version = ""; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + object.restNumericEnums = false; + object.javaSettings = null; + object.cppSettings = null; + object.phpSettings = null; + object.pythonSettings = null; + object.nodeSettings = null; + object.dotnetSettings = null; + object.rubySettings = null; + object.goSettings = null; + } + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + object.version = message.version; + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) + object.restNumericEnums = message.restNumericEnums; + if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) + object.javaSettings = $root.google.api.JavaSettings.toObject(message.javaSettings, options, q + 1); + if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) + object.cppSettings = $root.google.api.CppSettings.toObject(message.cppSettings, options, q + 1); + if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) + object.phpSettings = $root.google.api.PhpSettings.toObject(message.phpSettings, options, q + 1); + if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) + object.pythonSettings = $root.google.api.PythonSettings.toObject(message.pythonSettings, options, q + 1); + if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) + object.nodeSettings = $root.google.api.NodeSettings.toObject(message.nodeSettings, options, q + 1); + if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) + object.dotnetSettings = $root.google.api.DotnetSettings.toObject(message.dotnetSettings, options, q + 1); + if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) + object.rubySettings = $root.google.api.RubySettings.toObject(message.rubySettings, options, q + 1); + if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) + object.goSettings = $root.google.api.GoSettings.toObject(message.goSettings, options, q + 1); + return object; + }; + + /** + * Converts this ClientLibrarySettings to JSON. + * @function toJSON + * @memberof google.api.ClientLibrarySettings + * @instance + * @returns {Object.} JSON object + */ + ClientLibrarySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ClientLibrarySettings + * @function getTypeUrl + * @memberof google.api.ClientLibrarySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClientLibrarySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ClientLibrarySettings"; + }; + + return ClientLibrarySettings; + })(); + + api.Publishing = (function() { + + /** + * Properties of a Publishing. + * @memberof google.api + * @interface IPublishing + * @property {Array.|null} [methodSettings] Publishing methodSettings + * @property {string|null} [newIssueUri] Publishing newIssueUri + * @property {string|null} [documentationUri] Publishing documentationUri + * @property {string|null} [apiShortName] Publishing apiShortName + * @property {string|null} [githubLabel] Publishing githubLabel + * @property {Array.|null} [codeownerGithubTeams] Publishing codeownerGithubTeams + * @property {string|null} [docTagPrefix] Publishing docTagPrefix + * @property {google.api.ClientLibraryOrganization|null} [organization] Publishing organization + * @property {Array.|null} [librarySettings] Publishing librarySettings + * @property {string|null} [protoReferenceDocumentationUri] Publishing protoReferenceDocumentationUri + * @property {string|null} [restReferenceDocumentationUri] Publishing restReferenceDocumentationUri + */ + + /** + * Constructs a new Publishing. + * @memberof google.api + * @classdesc Represents a Publishing. + * @implements IPublishing + * @constructor + * @param {google.api.IPublishing=} [properties] Properties to set + */ + function Publishing(properties) { + this.methodSettings = []; + this.codeownerGithubTeams = []; + this.librarySettings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Publishing methodSettings. + * @member {Array.} methodSettings + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.methodSettings = $util.emptyArray; + + /** + * Publishing newIssueUri. + * @member {string} newIssueUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.newIssueUri = ""; + + /** + * Publishing documentationUri. + * @member {string} documentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.documentationUri = ""; + + /** + * Publishing apiShortName. + * @member {string} apiShortName + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.apiShortName = ""; + + /** + * Publishing githubLabel. + * @member {string} githubLabel + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.githubLabel = ""; + + /** + * Publishing codeownerGithubTeams. + * @member {Array.} codeownerGithubTeams + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.codeownerGithubTeams = $util.emptyArray; + + /** + * Publishing docTagPrefix. + * @member {string} docTagPrefix + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.docTagPrefix = ""; + + /** + * Publishing organization. + * @member {google.api.ClientLibraryOrganization} organization + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.organization = 0; + + /** + * Publishing librarySettings. + * @member {Array.} librarySettings + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.librarySettings = $util.emptyArray; + + /** + * Publishing protoReferenceDocumentationUri. + * @member {string} protoReferenceDocumentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.protoReferenceDocumentationUri = ""; + + /** + * Publishing restReferenceDocumentationUri. + * @member {string} restReferenceDocumentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.restReferenceDocumentationUri = ""; + + /** + * Creates a new Publishing instance using the specified properties. + * @function create + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing=} [properties] Properties to set + * @returns {google.api.Publishing} Publishing instance + */ + Publishing.create = function create(properties) { + return new Publishing(properties); + }; + + /** + * Encodes the specified Publishing message. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @function encode + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing} message Publishing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Publishing.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.methodSettings != null && message.methodSettings.length) + for (var i = 0; i < message.methodSettings.length; ++i) + $root.google.api.MethodSettings.encode(message.methodSettings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) + writer.uint32(/* id 101, wireType 2 =*/810).string(message.newIssueUri); + if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) + writer.uint32(/* id 102, wireType 2 =*/818).string(message.documentationUri); + if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) + writer.uint32(/* id 103, wireType 2 =*/826).string(message.apiShortName); + if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) + writer.uint32(/* id 104, wireType 2 =*/834).string(message.githubLabel); + if (message.codeownerGithubTeams != null && message.codeownerGithubTeams.length) + for (var i = 0; i < message.codeownerGithubTeams.length; ++i) + writer.uint32(/* id 105, wireType 2 =*/842).string(message.codeownerGithubTeams[i]); + if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) + writer.uint32(/* id 106, wireType 2 =*/850).string(message.docTagPrefix); + if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) + writer.uint32(/* id 107, wireType 0 =*/856).int32(message.organization); + if (message.librarySettings != null && message.librarySettings.length) + for (var i = 0; i < message.librarySettings.length; ++i) + $root.google.api.ClientLibrarySettings.encode(message.librarySettings[i], writer.uint32(/* id 109, wireType 2 =*/874).fork(), q + 1).ldelim(); + if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) + writer.uint32(/* id 110, wireType 2 =*/882).string(message.protoReferenceDocumentationUri); + if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) + writer.uint32(/* id 111, wireType 2 =*/890).string(message.restReferenceDocumentationUri); + return writer; + }; + + /** + * Encodes the specified Publishing message, length delimited. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing} message Publishing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Publishing.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Publishing message from the specified reader or buffer. + * @function decode + * @memberof google.api.Publishing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Publishing} Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Publishing.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Publishing(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.methodSettings && message.methodSettings.length)) + message.methodSettings = []; + message.methodSettings.push($root.google.api.MethodSettings.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 101: { + message.newIssueUri = reader.string(); + break; + } + case 102: { + message.documentationUri = reader.string(); + break; + } + case 103: { + message.apiShortName = reader.string(); + break; + } + case 104: { + message.githubLabel = reader.string(); + break; + } + case 105: { + if (!(message.codeownerGithubTeams && message.codeownerGithubTeams.length)) + message.codeownerGithubTeams = []; + message.codeownerGithubTeams.push(reader.string()); + break; + } + case 106: { + message.docTagPrefix = reader.string(); + break; + } + case 107: { + message.organization = reader.int32(); + break; + } + case 109: { + if (!(message.librarySettings && message.librarySettings.length)) + message.librarySettings = []; + message.librarySettings.push($root.google.api.ClientLibrarySettings.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 110: { + message.protoReferenceDocumentationUri = reader.string(); + break; + } + case 111: { + message.restReferenceDocumentationUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Publishing message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Publishing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Publishing} Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Publishing.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Publishing message. + * @function verify + * @memberof google.api.Publishing + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Publishing.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.methodSettings != null && Object.hasOwnProperty.call(message, "methodSettings")) { + if (!Array.isArray(message.methodSettings)) + return "methodSettings: array expected"; + for (var i = 0; i < message.methodSettings.length; ++i) { + var error = $root.google.api.MethodSettings.verify(message.methodSettings[i], long + 1); + if (error) + return "methodSettings." + error; + } + } + if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) + if (!$util.isString(message.newIssueUri)) + return "newIssueUri: string expected"; + if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) + if (!$util.isString(message.documentationUri)) + return "documentationUri: string expected"; + if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) + if (!$util.isString(message.apiShortName)) + return "apiShortName: string expected"; + if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) + if (!$util.isString(message.githubLabel)) + return "githubLabel: string expected"; + if (message.codeownerGithubTeams != null && Object.hasOwnProperty.call(message, "codeownerGithubTeams")) { + if (!Array.isArray(message.codeownerGithubTeams)) + return "codeownerGithubTeams: array expected"; + for (var i = 0; i < message.codeownerGithubTeams.length; ++i) + if (!$util.isString(message.codeownerGithubTeams[i])) + return "codeownerGithubTeams: string[] expected"; + } + if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) + if (!$util.isString(message.docTagPrefix)) + return "docTagPrefix: string expected"; + if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) + switch (message.organization) { + default: + return "organization: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.librarySettings != null && Object.hasOwnProperty.call(message, "librarySettings")) { + if (!Array.isArray(message.librarySettings)) + return "librarySettings: array expected"; + for (var i = 0; i < message.librarySettings.length; ++i) { + var error = $root.google.api.ClientLibrarySettings.verify(message.librarySettings[i], long + 1); + if (error) + return "librarySettings." + error; + } + } + if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) + if (!$util.isString(message.protoReferenceDocumentationUri)) + return "protoReferenceDocumentationUri: string expected"; + if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) + if (!$util.isString(message.restReferenceDocumentationUri)) + return "restReferenceDocumentationUri: string expected"; + return null; + }; + + /** + * Creates a Publishing message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Publishing + * @static + * @param {Object.} object Plain object + * @returns {google.api.Publishing} Publishing + */ + Publishing.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.Publishing) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.Publishing: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.Publishing(); + if (object.methodSettings) { + if (!Array.isArray(object.methodSettings)) + throw TypeError(".google.api.Publishing.methodSettings: array expected"); + message.methodSettings = []; + for (var i = 0; i < object.methodSettings.length; ++i) { + if (!$util.isObject(object.methodSettings[i])) + throw TypeError(".google.api.Publishing.methodSettings: object expected"); + message.methodSettings[i] = $root.google.api.MethodSettings.fromObject(object.methodSettings[i], long + 1); + } + } + if (object.newIssueUri != null) + message.newIssueUri = String(object.newIssueUri); + if (object.documentationUri != null) + message.documentationUri = String(object.documentationUri); + if (object.apiShortName != null) + message.apiShortName = String(object.apiShortName); + if (object.githubLabel != null) + message.githubLabel = String(object.githubLabel); + if (object.codeownerGithubTeams) { + if (!Array.isArray(object.codeownerGithubTeams)) + throw TypeError(".google.api.Publishing.codeownerGithubTeams: array expected"); + message.codeownerGithubTeams = []; + for (var i = 0; i < object.codeownerGithubTeams.length; ++i) + message.codeownerGithubTeams[i] = String(object.codeownerGithubTeams[i]); + } + if (object.docTagPrefix != null) + message.docTagPrefix = String(object.docTagPrefix); + switch (object.organization) { + default: + if (typeof object.organization === "number") { + message.organization = object.organization; + break; + } + break; + case "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": + case 0: + message.organization = 0; + break; + case "CLOUD": + case 1: + message.organization = 1; + break; + case "ADS": + case 2: + message.organization = 2; + break; + case "PHOTOS": + case 3: + message.organization = 3; + break; + case "STREET_VIEW": + case 4: + message.organization = 4; + break; + case "SHOPPING": + case 5: + message.organization = 5; + break; + case "GEO": + case 6: + message.organization = 6; + break; + case "GENERATIVE_AI": + case 7: + message.organization = 7; + break; + } + if (object.librarySettings) { + if (!Array.isArray(object.librarySettings)) + throw TypeError(".google.api.Publishing.librarySettings: array expected"); + message.librarySettings = []; + for (var i = 0; i < object.librarySettings.length; ++i) { + if (!$util.isObject(object.librarySettings[i])) + throw TypeError(".google.api.Publishing.librarySettings: object expected"); + message.librarySettings[i] = $root.google.api.ClientLibrarySettings.fromObject(object.librarySettings[i], long + 1); + } + } + if (object.protoReferenceDocumentationUri != null) + message.protoReferenceDocumentationUri = String(object.protoReferenceDocumentationUri); + if (object.restReferenceDocumentationUri != null) + message.restReferenceDocumentationUri = String(object.restReferenceDocumentationUri); + return message; + }; + + /** + * Creates a plain object from a Publishing message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Publishing + * @static + * @param {google.api.Publishing} message Publishing + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Publishing.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.methodSettings = []; + object.codeownerGithubTeams = []; + object.librarySettings = []; + } + if (options.defaults) { + object.newIssueUri = ""; + object.documentationUri = ""; + object.apiShortName = ""; + object.githubLabel = ""; + object.docTagPrefix = ""; + object.organization = options.enums === String ? "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" : 0; + object.protoReferenceDocumentationUri = ""; + object.restReferenceDocumentationUri = ""; + } + if (message.methodSettings && message.methodSettings.length) { + object.methodSettings = []; + for (var j = 0; j < message.methodSettings.length; ++j) + object.methodSettings[j] = $root.google.api.MethodSettings.toObject(message.methodSettings[j], options, q + 1); + } + if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) + object.newIssueUri = message.newIssueUri; + if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) + object.documentationUri = message.documentationUri; + if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) + object.apiShortName = message.apiShortName; + if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) + object.githubLabel = message.githubLabel; + if (message.codeownerGithubTeams && message.codeownerGithubTeams.length) { + object.codeownerGithubTeams = []; + for (var j = 0; j < message.codeownerGithubTeams.length; ++j) + object.codeownerGithubTeams[j] = message.codeownerGithubTeams[j]; + } + if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) + object.docTagPrefix = message.docTagPrefix; + if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) + object.organization = options.enums === String ? $root.google.api.ClientLibraryOrganization[message.organization] === undefined ? message.organization : $root.google.api.ClientLibraryOrganization[message.organization] : message.organization; + if (message.librarySettings && message.librarySettings.length) { + object.librarySettings = []; + for (var j = 0; j < message.librarySettings.length; ++j) + object.librarySettings[j] = $root.google.api.ClientLibrarySettings.toObject(message.librarySettings[j], options, q + 1); + } + if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) + object.protoReferenceDocumentationUri = message.protoReferenceDocumentationUri; + if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) + object.restReferenceDocumentationUri = message.restReferenceDocumentationUri; + return object; + }; + + /** + * Converts this Publishing to JSON. + * @function toJSON + * @memberof google.api.Publishing + * @instance + * @returns {Object.} JSON object + */ + Publishing.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Publishing + * @function getTypeUrl + * @memberof google.api.Publishing + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Publishing.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Publishing"; + }; + + return Publishing; + })(); + + api.JavaSettings = (function() { + + /** + * Properties of a JavaSettings. + * @memberof google.api + * @interface IJavaSettings + * @property {string|null} [libraryPackage] JavaSettings libraryPackage + * @property {Object.|null} [serviceClassNames] JavaSettings serviceClassNames + * @property {google.api.ICommonLanguageSettings|null} [common] JavaSettings common + */ + + /** + * Constructs a new JavaSettings. + * @memberof google.api + * @classdesc Represents a JavaSettings. + * @implements IJavaSettings + * @constructor + * @param {google.api.IJavaSettings=} [properties] Properties to set + */ + function JavaSettings(properties) { + this.serviceClassNames = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * JavaSettings libraryPackage. + * @member {string} libraryPackage + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.libraryPackage = ""; + + /** + * JavaSettings serviceClassNames. + * @member {Object.} serviceClassNames + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.serviceClassNames = $util.emptyObject; + + /** + * JavaSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.common = null; + + /** + * Creates a new JavaSettings instance using the specified properties. + * @function create + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings=} [properties] Properties to set + * @returns {google.api.JavaSettings} JavaSettings instance + */ + JavaSettings.create = function create(properties) { + return new JavaSettings(properties); + }; + + /** + * Encodes the specified JavaSettings message. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @function encode + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + JavaSettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.libraryPackage); + if (message.serviceClassNames != null && Object.hasOwnProperty.call(message, "serviceClassNames")) + for (var keys = Object.keys(message.serviceClassNames), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.serviceClassNames[keys[i]]).ldelim(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified JavaSettings message, length delimited. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + JavaSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a JavaSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.JavaSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.JavaSettings} JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + JavaSettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.JavaSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.libraryPackage = reader.string(); + break; + } + case 2: { + if (message.serviceClassNames === $util.emptyObject) + message.serviceClassNames = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.serviceClassNames, key); + message.serviceClassNames[key] = value; + break; + } + case 3: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a JavaSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.JavaSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.JavaSettings} JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + JavaSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a JavaSettings message. + * @function verify + * @memberof google.api.JavaSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + JavaSettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) + if (!$util.isString(message.libraryPackage)) + return "libraryPackage: string expected"; + if (message.serviceClassNames != null && Object.hasOwnProperty.call(message, "serviceClassNames")) { + if (!$util.isObject(message.serviceClassNames)) + return "serviceClassNames: object expected"; + var key = Object.keys(message.serviceClassNames); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.serviceClassNames[key[i]])) + return "serviceClassNames: string{k:string} expected"; + } + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a JavaSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.JavaSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.JavaSettings} JavaSettings + */ + JavaSettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.JavaSettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.JavaSettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.JavaSettings(); + if (object.libraryPackage != null) + message.libraryPackage = String(object.libraryPackage); + if (object.serviceClassNames) { + if (!$util.isObject(object.serviceClassNames)) + throw TypeError(".google.api.JavaSettings.serviceClassNames: object expected"); + message.serviceClassNames = {}; + for (var keys = Object.keys(object.serviceClassNames), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.serviceClassNames, keys[i]); + message.serviceClassNames[keys[i]] = String(object.serviceClassNames[keys[i]]); + } + } + if (object.common != null) { + if (!$util.isObject(object.common)) + throw TypeError(".google.api.JavaSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a JavaSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.JavaSettings + * @static + * @param {google.api.JavaSettings} message JavaSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + JavaSettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.serviceClassNames = {}; + if (options.defaults) { + object.libraryPackage = ""; + object.common = null; + } + if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) + object.libraryPackage = message.libraryPackage; + var keys2; + if (message.serviceClassNames && (keys2 = Object.keys(message.serviceClassNames)).length) { + object.serviceClassNames = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.serviceClassNames, keys2[j]); + object.serviceClassNames[keys2[j]] = message.serviceClassNames[keys2[j]]; + } + } + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); + return object; + }; + + /** + * Converts this JavaSettings to JSON. + * @function toJSON + * @memberof google.api.JavaSettings + * @instance + * @returns {Object.} JSON object + */ + JavaSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for JavaSettings + * @function getTypeUrl + * @memberof google.api.JavaSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + JavaSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.JavaSettings"; + }; + + return JavaSettings; + })(); + + api.CppSettings = (function() { + + /** + * Properties of a CppSettings. + * @memberof google.api + * @interface ICppSettings + * @property {google.api.ICommonLanguageSettings|null} [common] CppSettings common + */ + + /** + * Constructs a new CppSettings. + * @memberof google.api + * @classdesc Represents a CppSettings. + * @implements ICppSettings + * @constructor + * @param {google.api.ICppSettings=} [properties] Properties to set + */ + function CppSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CppSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.CppSettings + * @instance + */ + CppSettings.prototype.common = null; + + /** + * Creates a new CppSettings instance using the specified properties. + * @function create + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings=} [properties] Properties to set + * @returns {google.api.CppSettings} CppSettings instance + */ + CppSettings.create = function create(properties) { + return new CppSettings(properties); + }; + + /** + * Encodes the specified CppSettings message. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @function encode + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings} message CppSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CppSettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified CppSettings message, length delimited. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings} message CppSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CppSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CppSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.CppSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CppSettings} CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CppSettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CppSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CppSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CppSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CppSettings} CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CppSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CppSettings message. + * @function verify + * @memberof google.api.CppSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CppSettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a CppSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CppSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.CppSettings} CppSettings + */ + CppSettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.CppSettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.CppSettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.CppSettings(); + if (object.common != null) { + if (!$util.isObject(object.common)) + throw TypeError(".google.api.CppSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a CppSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CppSettings + * @static + * @param {google.api.CppSettings} message CppSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CppSettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); + return object; + }; + + /** + * Converts this CppSettings to JSON. + * @function toJSON + * @memberof google.api.CppSettings + * @instance + * @returns {Object.} JSON object + */ + CppSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CppSettings + * @function getTypeUrl + * @memberof google.api.CppSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CppSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CppSettings"; + }; + + return CppSettings; + })(); + + api.PhpSettings = (function() { + + /** + * Properties of a PhpSettings. + * @memberof google.api + * @interface IPhpSettings + * @property {google.api.ICommonLanguageSettings|null} [common] PhpSettings common + */ + + /** + * Constructs a new PhpSettings. + * @memberof google.api + * @classdesc Represents a PhpSettings. + * @implements IPhpSettings + * @constructor + * @param {google.api.IPhpSettings=} [properties] Properties to set + */ + function PhpSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * PhpSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.PhpSettings + * @instance + */ + PhpSettings.prototype.common = null; + + /** + * Creates a new PhpSettings instance using the specified properties. + * @function create + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings=} [properties] Properties to set + * @returns {google.api.PhpSettings} PhpSettings instance + */ + PhpSettings.create = function create(properties) { + return new PhpSettings(properties); + }; + + /** + * Encodes the specified PhpSettings message. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @function encode + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhpSettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified PhpSettings message, length delimited. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhpSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a PhpSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.PhpSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PhpSettings} PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhpSettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PhpSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a PhpSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PhpSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PhpSettings} PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhpSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PhpSettings message. + * @function verify + * @memberof google.api.PhpSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PhpSettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a PhpSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PhpSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.PhpSettings} PhpSettings + */ + PhpSettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.PhpSettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.PhpSettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.PhpSettings(); + if (object.common != null) { + if (!$util.isObject(object.common)) + throw TypeError(".google.api.PhpSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a PhpSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PhpSettings + * @static + * @param {google.api.PhpSettings} message PhpSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PhpSettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); + return object; + }; + + /** + * Converts this PhpSettings to JSON. + * @function toJSON + * @memberof google.api.PhpSettings + * @instance + * @returns {Object.} JSON object + */ + PhpSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PhpSettings + * @function getTypeUrl + * @memberof google.api.PhpSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PhpSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PhpSettings"; + }; + + return PhpSettings; + })(); + + api.PythonSettings = (function() { + + /** + * Properties of a PythonSettings. + * @memberof google.api + * @interface IPythonSettings + * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures + */ + + /** + * Constructs a new PythonSettings. + * @memberof google.api + * @classdesc Represents a PythonSettings. + * @implements IPythonSettings + * @constructor + * @param {google.api.IPythonSettings=} [properties] Properties to set + */ + function PythonSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * PythonSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.common = null; + + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + + /** + * Creates a new PythonSettings instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings=} [properties] Properties to set + * @returns {google.api.PythonSettings} PythonSettings instance + */ + PythonSettings.create = function create(properties) { + return new PythonSettings(properties); + }; + + /** + * Encodes the specified PythonSettings message. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PythonSettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified PythonSettings message, length delimited. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PythonSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a PythonSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings} PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PythonSettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a PythonSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings} PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PythonSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PythonSettings message. + * @function verify + * @memberof google.api.PythonSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PythonSettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); + if (error) + return "common." + error; + } + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures, long + 1); + if (error) + return "experimentalFeatures." + error; + } + return null; + }; + + /** + * Creates a PythonSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings} PythonSettings + */ + PythonSettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.PythonSettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.PythonSettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.PythonSettings(); + if (object.common != null) { + if (!$util.isObject(object.common)) + throw TypeError(".google.api.PythonSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); + } + if (object.experimentalFeatures != null) { + if (!$util.isObject(object.experimentalFeatures)) + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings + * @static + * @param {google.api.PythonSettings} message PythonSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PythonSettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.common = null; + object.experimentalFeatures = null; + } + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options, q + 1); + return object; + }; + + /** + * Converts this PythonSettings to JSON. + * @function toJSON + * @memberof google.api.PythonSettings + * @instance + * @returns {Object.} JSON object + */ + PythonSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PythonSettings + * @function getTypeUrl + * @memberof google.api.PythonSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PythonSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings"; + }; + + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.PythonSettings.ExperimentalFeatures: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + + return PythonSettings; + })(); + + api.NodeSettings = (function() { + + /** + * Properties of a NodeSettings. + * @memberof google.api + * @interface INodeSettings + * @property {google.api.ICommonLanguageSettings|null} [common] NodeSettings common + */ + + /** + * Constructs a new NodeSettings. + * @memberof google.api + * @classdesc Represents a NodeSettings. + * @implements INodeSettings + * @constructor + * @param {google.api.INodeSettings=} [properties] Properties to set + */ + function NodeSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * NodeSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.NodeSettings + * @instance + */ + NodeSettings.prototype.common = null; + + /** + * Creates a new NodeSettings instance using the specified properties. + * @function create + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings=} [properties] Properties to set + * @returns {google.api.NodeSettings} NodeSettings instance + */ + NodeSettings.create = function create(properties) { + return new NodeSettings(properties); + }; + + /** + * Encodes the specified NodeSettings message. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @function encode + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified NodeSettings message, length delimited. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a NodeSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.NodeSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.NodeSettings} NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.NodeSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a NodeSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.NodeSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.NodeSettings} NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NodeSettings message. + * @function verify + * @memberof google.api.NodeSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NodeSettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a NodeSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.NodeSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.NodeSettings} NodeSettings + */ + NodeSettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.NodeSettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.NodeSettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.NodeSettings(); + if (object.common != null) { + if (!$util.isObject(object.common)) + throw TypeError(".google.api.NodeSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a NodeSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.NodeSettings + * @static + * @param {google.api.NodeSettings} message NodeSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NodeSettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); + return object; + }; + + /** + * Converts this NodeSettings to JSON. + * @function toJSON + * @memberof google.api.NodeSettings + * @instance + * @returns {Object.} JSON object + */ + NodeSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NodeSettings + * @function getTypeUrl + * @memberof google.api.NodeSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NodeSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.NodeSettings"; + }; + + return NodeSettings; + })(); + + api.DotnetSettings = (function() { + + /** + * Properties of a DotnetSettings. + * @memberof google.api + * @interface IDotnetSettings + * @property {google.api.ICommonLanguageSettings|null} [common] DotnetSettings common + * @property {Object.|null} [renamedServices] DotnetSettings renamedServices + * @property {Object.|null} [renamedResources] DotnetSettings renamedResources + * @property {Array.|null} [ignoredResources] DotnetSettings ignoredResources + * @property {Array.|null} [forcedNamespaceAliases] DotnetSettings forcedNamespaceAliases + * @property {Array.|null} [handwrittenSignatures] DotnetSettings handwrittenSignatures + */ + + /** + * Constructs a new DotnetSettings. + * @memberof google.api + * @classdesc Represents a DotnetSettings. + * @implements IDotnetSettings + * @constructor + * @param {google.api.IDotnetSettings=} [properties] Properties to set + */ + function DotnetSettings(properties) { + this.renamedServices = {}; + this.renamedResources = {}; + this.ignoredResources = []; + this.forcedNamespaceAliases = []; + this.handwrittenSignatures = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DotnetSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.common = null; + + /** + * DotnetSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.renamedServices = $util.emptyObject; + + /** + * DotnetSettings renamedResources. + * @member {Object.} renamedResources + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.renamedResources = $util.emptyObject; + + /** + * DotnetSettings ignoredResources. + * @member {Array.} ignoredResources + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.ignoredResources = $util.emptyArray; + + /** + * DotnetSettings forcedNamespaceAliases. + * @member {Array.} forcedNamespaceAliases + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.forcedNamespaceAliases = $util.emptyArray; + + /** + * DotnetSettings handwrittenSignatures. + * @member {Array.} handwrittenSignatures + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.handwrittenSignatures = $util.emptyArray; + + /** + * Creates a new DotnetSettings instance using the specified properties. + * @function create + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings=} [properties] Properties to set + * @returns {google.api.DotnetSettings} DotnetSettings instance + */ + DotnetSettings.create = function create(properties) { + return new DotnetSettings(properties); + }; + + /** + * Encodes the specified DotnetSettings message. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @function encode + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DotnetSettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); + if (message.renamedResources != null && Object.hasOwnProperty.call(message, "renamedResources")) + for (var keys = Object.keys(message.renamedResources), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedResources[keys[i]]).ldelim(); + if (message.ignoredResources != null && message.ignoredResources.length) + for (var i = 0; i < message.ignoredResources.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.ignoredResources[i]); + if (message.forcedNamespaceAliases != null && message.forcedNamespaceAliases.length) + for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.forcedNamespaceAliases[i]); + if (message.handwrittenSignatures != null && message.handwrittenSignatures.length) + for (var i = 0; i < message.handwrittenSignatures.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.handwrittenSignatures[i]); + return writer; + }; + + /** + * Encodes the specified DotnetSettings message, length delimited. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DotnetSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.DotnetSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.DotnetSettings} DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DotnetSettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.DotnetSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.renamedServices, key); + message.renamedServices[key] = value; + break; + } + case 3: { + if (message.renamedResources === $util.emptyObject) + message.renamedResources = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.renamedResources, key); + message.renamedResources[key] = value; + break; + } + case 4: { + if (!(message.ignoredResources && message.ignoredResources.length)) + message.ignoredResources = []; + message.ignoredResources.push(reader.string()); + break; + } + case 5: { + if (!(message.forcedNamespaceAliases && message.forcedNamespaceAliases.length)) + message.forcedNamespaceAliases = []; + message.forcedNamespaceAliases.push(reader.string()); + break; + } + case 6: { + if (!(message.handwrittenSignatures && message.handwrittenSignatures.length)) + message.handwrittenSignatures = []; + message.handwrittenSignatures.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.DotnetSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.DotnetSettings} DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DotnetSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DotnetSettings message. + * @function verify + * @memberof google.api.DotnetSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DotnetSettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); + if (error) + return "common." + error; + } + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } + if (message.renamedResources != null && Object.hasOwnProperty.call(message, "renamedResources")) { + if (!$util.isObject(message.renamedResources)) + return "renamedResources: object expected"; + var key = Object.keys(message.renamedResources); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedResources[key[i]])) + return "renamedResources: string{k:string} expected"; + } + if (message.ignoredResources != null && Object.hasOwnProperty.call(message, "ignoredResources")) { + if (!Array.isArray(message.ignoredResources)) + return "ignoredResources: array expected"; + for (var i = 0; i < message.ignoredResources.length; ++i) + if (!$util.isString(message.ignoredResources[i])) + return "ignoredResources: string[] expected"; + } + if (message.forcedNamespaceAliases != null && Object.hasOwnProperty.call(message, "forcedNamespaceAliases")) { + if (!Array.isArray(message.forcedNamespaceAliases)) + return "forcedNamespaceAliases: array expected"; + for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) + if (!$util.isString(message.forcedNamespaceAliases[i])) + return "forcedNamespaceAliases: string[] expected"; + } + if (message.handwrittenSignatures != null && Object.hasOwnProperty.call(message, "handwrittenSignatures")) { + if (!Array.isArray(message.handwrittenSignatures)) + return "handwrittenSignatures: array expected"; + for (var i = 0; i < message.handwrittenSignatures.length; ++i) + if (!$util.isString(message.handwrittenSignatures[i])) + return "handwrittenSignatures: string[] expected"; + } + return null; + }; + + /** + * Creates a DotnetSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.DotnetSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.DotnetSettings} DotnetSettings + */ + DotnetSettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.DotnetSettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.DotnetSettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.DotnetSettings(); + if (object.common != null) { + if (!$util.isObject(object.common)) + throw TypeError(".google.api.DotnetSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); + } + if (object.renamedServices) { + if (!$util.isObject(object.renamedServices)) + throw TypeError(".google.api.DotnetSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.renamedServices, keys[i]); + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } + } + if (object.renamedResources) { + if (!$util.isObject(object.renamedResources)) + throw TypeError(".google.api.DotnetSettings.renamedResources: object expected"); + message.renamedResources = {}; + for (var keys = Object.keys(object.renamedResources), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.renamedResources, keys[i]); + message.renamedResources[keys[i]] = String(object.renamedResources[keys[i]]); + } + } + if (object.ignoredResources) { + if (!Array.isArray(object.ignoredResources)) + throw TypeError(".google.api.DotnetSettings.ignoredResources: array expected"); + message.ignoredResources = []; + for (var i = 0; i < object.ignoredResources.length; ++i) + message.ignoredResources[i] = String(object.ignoredResources[i]); + } + if (object.forcedNamespaceAliases) { + if (!Array.isArray(object.forcedNamespaceAliases)) + throw TypeError(".google.api.DotnetSettings.forcedNamespaceAliases: array expected"); + message.forcedNamespaceAliases = []; + for (var i = 0; i < object.forcedNamespaceAliases.length; ++i) + message.forcedNamespaceAliases[i] = String(object.forcedNamespaceAliases[i]); + } + if (object.handwrittenSignatures) { + if (!Array.isArray(object.handwrittenSignatures)) + throw TypeError(".google.api.DotnetSettings.handwrittenSignatures: array expected"); + message.handwrittenSignatures = []; + for (var i = 0; i < object.handwrittenSignatures.length; ++i) + message.handwrittenSignatures[i] = String(object.handwrittenSignatures[i]); + } + return message; + }; + + /** + * Creates a plain object from a DotnetSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.DotnetSettings} message DotnetSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DotnetSettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.ignoredResources = []; + object.forcedNamespaceAliases = []; + object.handwrittenSignatures = []; + } + if (options.objects || options.defaults) { + object.renamedServices = {}; + object.renamedResources = {}; + } + if (options.defaults) + object.common = null; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.renamedServices, keys2[j]); + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } + } + if (message.renamedResources && (keys2 = Object.keys(message.renamedResources)).length) { + object.renamedResources = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.renamedResources, keys2[j]); + object.renamedResources[keys2[j]] = message.renamedResources[keys2[j]]; + } + } + if (message.ignoredResources && message.ignoredResources.length) { + object.ignoredResources = []; + for (var j = 0; j < message.ignoredResources.length; ++j) + object.ignoredResources[j] = message.ignoredResources[j]; + } + if (message.forcedNamespaceAliases && message.forcedNamespaceAliases.length) { + object.forcedNamespaceAliases = []; + for (var j = 0; j < message.forcedNamespaceAliases.length; ++j) + object.forcedNamespaceAliases[j] = message.forcedNamespaceAliases[j]; + } + if (message.handwrittenSignatures && message.handwrittenSignatures.length) { + object.handwrittenSignatures = []; + for (var j = 0; j < message.handwrittenSignatures.length; ++j) + object.handwrittenSignatures[j] = message.handwrittenSignatures[j]; + } + return object; + }; + + /** + * Converts this DotnetSettings to JSON. + * @function toJSON + * @memberof google.api.DotnetSettings + * @instance + * @returns {Object.} JSON object + */ + DotnetSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DotnetSettings + * @function getTypeUrl + * @memberof google.api.DotnetSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DotnetSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.DotnetSettings"; + }; + + return DotnetSettings; + })(); + + api.RubySettings = (function() { + + /** + * Properties of a RubySettings. + * @memberof google.api + * @interface IRubySettings + * @property {google.api.ICommonLanguageSettings|null} [common] RubySettings common + */ + + /** + * Constructs a new RubySettings. + * @memberof google.api + * @classdesc Represents a RubySettings. + * @implements IRubySettings + * @constructor + * @param {google.api.IRubySettings=} [properties] Properties to set + */ + function RubySettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RubySettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.RubySettings + * @instance + */ + RubySettings.prototype.common = null; + + /** + * Creates a new RubySettings instance using the specified properties. + * @function create + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings=} [properties] Properties to set + * @returns {google.api.RubySettings} RubySettings instance + */ + RubySettings.create = function create(properties) { + return new RubySettings(properties); + }; + + /** + * Encodes the specified RubySettings message. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @function encode + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings} message RubySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RubySettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified RubySettings message, length delimited. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings} message RubySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RubySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RubySettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.RubySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.RubySettings} RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RubySettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.RubySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RubySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.RubySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.RubySettings} RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RubySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RubySettings message. + * @function verify + * @memberof google.api.RubySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RubySettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a RubySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.RubySettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.RubySettings} RubySettings + */ + RubySettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.RubySettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.RubySettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.RubySettings(); + if (object.common != null) { + if (!$util.isObject(object.common)) + throw TypeError(".google.api.RubySettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a RubySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.RubySettings + * @static + * @param {google.api.RubySettings} message RubySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RubySettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); + return object; + }; + + /** + * Converts this RubySettings to JSON. + * @function toJSON + * @memberof google.api.RubySettings + * @instance + * @returns {Object.} JSON object + */ + RubySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RubySettings + * @function getTypeUrl + * @memberof google.api.RubySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RubySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.RubySettings"; + }; + + return RubySettings; + })(); + + api.GoSettings = (function() { + + /** + * Properties of a GoSettings. + * @memberof google.api + * @interface IGoSettings + * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices + */ + + /** + * Constructs a new GoSettings. + * @memberof google.api + * @classdesc Represents a GoSettings. + * @implements IGoSettings + * @constructor + * @param {google.api.IGoSettings=} [properties] Properties to set + */ + function GoSettings(properties) { + this.renamedServices = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GoSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.common = null; + + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + + /** + * Creates a new GoSettings instance using the specified properties. + * @function create + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings=} [properties] Properties to set + * @returns {google.api.GoSettings} GoSettings instance + */ + GoSettings.create = function create(properties) { + return new GoSettings(properties); + }; + + /** + * Encodes the specified GoSettings message. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @function encode + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings} message GoSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoSettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified GoSettings message, length delimited. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings} message GoSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GoSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.GoSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.GoSettings} GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoSettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.renamedServices, key); + message.renamedServices[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GoSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.GoSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.GoSettings} GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GoSettings message. + * @function verify + * @memberof google.api.GoSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GoSettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); + if (error) + return "common." + error; + } + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a GoSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.GoSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.GoSettings} GoSettings + */ + GoSettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.GoSettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.GoSettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.GoSettings(); + if (object.common != null) { + if (!$util.isObject(object.common)) + throw TypeError(".google.api.GoSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); + } + if (object.renamedServices) { + if (!$util.isObject(object.renamedServices)) + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.renamedServices, keys[i]); + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a GoSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.GoSettings + * @static + * @param {google.api.GoSettings} message GoSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GoSettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; + if (options.defaults) + object.common = null; + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.renamedServices, keys2[j]); + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } + } + return object; + }; + + /** + * Converts this GoSettings to JSON. + * @function toJSON + * @memberof google.api.GoSettings + * @instance + * @returns {Object.} JSON object + */ + GoSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GoSettings + * @function getTypeUrl + * @memberof google.api.GoSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GoSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.GoSettings"; + }; + + return GoSettings; + })(); + + api.MethodSettings = (function() { + + /** + * Properties of a MethodSettings. + * @memberof google.api + * @interface IMethodSettings + * @property {string|null} [selector] MethodSettings selector + * @property {google.api.MethodSettings.ILongRunning|null} [longRunning] MethodSettings longRunning + * @property {Array.|null} [autoPopulatedFields] MethodSettings autoPopulatedFields + */ + + /** + * Constructs a new MethodSettings. + * @memberof google.api + * @classdesc Represents a MethodSettings. + * @implements IMethodSettings + * @constructor + * @param {google.api.IMethodSettings=} [properties] Properties to set + */ + function MethodSettings(properties) { + this.autoPopulatedFields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodSettings selector. + * @member {string} selector + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.selector = ""; + + /** + * MethodSettings longRunning. + * @member {google.api.MethodSettings.ILongRunning|null|undefined} longRunning + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.longRunning = null; + + /** + * MethodSettings autoPopulatedFields. + * @member {Array.} autoPopulatedFields + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.autoPopulatedFields = $util.emptyArray; + + /** + * Creates a new MethodSettings instance using the specified properties. + * @function create + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings=} [properties] Properties to set + * @returns {google.api.MethodSettings} MethodSettings instance + */ + MethodSettings.create = function create(properties) { + return new MethodSettings(properties); + }; + + /** + * Encodes the specified MethodSettings message. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @function encode + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodSettings.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) + $root.google.api.MethodSettings.LongRunning.encode(message.longRunning, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.autoPopulatedFields != null && message.autoPopulatedFields.length) + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.autoPopulatedFields[i]); + return writer; + }; + + /** + * Encodes the specified MethodSettings message, length delimited. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a MethodSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.MethodSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MethodSettings} MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodSettings.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.longRunning = $root.google.api.MethodSettings.LongRunning.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + if (!(message.autoPopulatedFields && message.autoPopulatedFields.length)) + message.autoPopulatedFields = []; + message.autoPopulatedFields.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a MethodSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MethodSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MethodSettings} MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodSettings message. + * @function verify + * @memberof google.api.MethodSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodSettings.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) { + var error = $root.google.api.MethodSettings.LongRunning.verify(message.longRunning, long + 1); + if (error) + return "longRunning." + error; + } + if (message.autoPopulatedFields != null && Object.hasOwnProperty.call(message, "autoPopulatedFields")) { + if (!Array.isArray(message.autoPopulatedFields)) + return "autoPopulatedFields: array expected"; + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + if (!$util.isString(message.autoPopulatedFields[i])) + return "autoPopulatedFields: string[] expected"; + } + return null; + }; + + /** + * Creates a MethodSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MethodSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.MethodSettings} MethodSettings + */ + MethodSettings.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.MethodSettings) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.MethodSettings: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.MethodSettings(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.longRunning != null) { + if (!$util.isObject(object.longRunning)) + throw TypeError(".google.api.MethodSettings.longRunning: object expected"); + message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning, long + 1); + } + if (object.autoPopulatedFields) { + if (!Array.isArray(object.autoPopulatedFields)) + throw TypeError(".google.api.MethodSettings.autoPopulatedFields: array expected"); + message.autoPopulatedFields = []; + for (var i = 0; i < object.autoPopulatedFields.length; ++i) + message.autoPopulatedFields[i] = String(object.autoPopulatedFields[i]); + } + return message; + }; + + /** + * Creates a plain object from a MethodSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MethodSettings + * @static + * @param {google.api.MethodSettings} message MethodSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodSettings.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.autoPopulatedFields = []; + if (options.defaults) { + object.selector = ""; + object.longRunning = null; + } + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + object.selector = message.selector; + if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) + object.longRunning = $root.google.api.MethodSettings.LongRunning.toObject(message.longRunning, options, q + 1); + if (message.autoPopulatedFields && message.autoPopulatedFields.length) { + object.autoPopulatedFields = []; + for (var j = 0; j < message.autoPopulatedFields.length; ++j) + object.autoPopulatedFields[j] = message.autoPopulatedFields[j]; + } + return object; + }; + + /** + * Converts this MethodSettings to JSON. + * @function toJSON + * @memberof google.api.MethodSettings + * @instance + * @returns {Object.} JSON object + */ + MethodSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodSettings + * @function getTypeUrl + * @memberof google.api.MethodSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MethodSettings"; + }; + + MethodSettings.LongRunning = (function() { + + /** + * Properties of a LongRunning. + * @memberof google.api.MethodSettings + * @interface ILongRunning + * @property {google.protobuf.IDuration|null} [initialPollDelay] LongRunning initialPollDelay + * @property {number|null} [pollDelayMultiplier] LongRunning pollDelayMultiplier + * @property {google.protobuf.IDuration|null} [maxPollDelay] LongRunning maxPollDelay + * @property {google.protobuf.IDuration|null} [totalPollTimeout] LongRunning totalPollTimeout + */ + + /** + * Constructs a new LongRunning. + * @memberof google.api.MethodSettings + * @classdesc Represents a LongRunning. + * @implements ILongRunning + * @constructor + * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set + */ + function LongRunning(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * LongRunning initialPollDelay. + * @member {google.protobuf.IDuration|null|undefined} initialPollDelay + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.initialPollDelay = null; + + /** + * LongRunning pollDelayMultiplier. + * @member {number} pollDelayMultiplier + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.pollDelayMultiplier = 0; + + /** + * LongRunning maxPollDelay. + * @member {google.protobuf.IDuration|null|undefined} maxPollDelay + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.maxPollDelay = null; + + /** + * LongRunning totalPollTimeout. + * @member {google.protobuf.IDuration|null|undefined} totalPollTimeout + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.totalPollTimeout = null; + + /** + * Creates a new LongRunning instance using the specified properties. + * @function create + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set + * @returns {google.api.MethodSettings.LongRunning} LongRunning instance + */ + LongRunning.create = function create(properties) { + return new LongRunning(properties); + }; + + /** + * Encodes the specified LongRunning message. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @function encode + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LongRunning.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) + $root.google.protobuf.Duration.encode(message.initialPollDelay, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.pollDelayMultiplier); + if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) + $root.google.protobuf.Duration.encode(message.maxPollDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) + $root.google.protobuf.Duration.encode(message.totalPollTimeout, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified LongRunning message, length delimited. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LongRunning.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a LongRunning message from the specified reader or buffer. + * @function decode + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MethodSettings.LongRunning} LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LongRunning.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings.LongRunning(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.initialPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 2: { + message.pollDelayMultiplier = reader.float(); + break; + } + case 3: { + message.maxPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + message.totalPollTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a LongRunning message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MethodSettings.LongRunning} LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LongRunning.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LongRunning message. + * @function verify + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LongRunning.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) { + var error = $root.google.protobuf.Duration.verify(message.initialPollDelay, long + 1); + if (error) + return "initialPollDelay." + error; + } + if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) + if (typeof message.pollDelayMultiplier !== "number") + return "pollDelayMultiplier: number expected"; + if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) { + var error = $root.google.protobuf.Duration.verify(message.maxPollDelay, long + 1); + if (error) + return "maxPollDelay." + error; + } + if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) { + var error = $root.google.protobuf.Duration.verify(message.totalPollTimeout, long + 1); + if (error) + return "totalPollTimeout." + error; + } + return null; + }; + + /** + * Creates a LongRunning message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {Object.} object Plain object + * @returns {google.api.MethodSettings.LongRunning} LongRunning + */ + LongRunning.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.MethodSettings.LongRunning) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.MethodSettings.LongRunning: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.MethodSettings.LongRunning(); + if (object.initialPollDelay != null) { + if (!$util.isObject(object.initialPollDelay)) + throw TypeError(".google.api.MethodSettings.LongRunning.initialPollDelay: object expected"); + message.initialPollDelay = $root.google.protobuf.Duration.fromObject(object.initialPollDelay, long + 1); + } + if (object.pollDelayMultiplier != null) + message.pollDelayMultiplier = Number(object.pollDelayMultiplier); + if (object.maxPollDelay != null) { + if (!$util.isObject(object.maxPollDelay)) + throw TypeError(".google.api.MethodSettings.LongRunning.maxPollDelay: object expected"); + message.maxPollDelay = $root.google.protobuf.Duration.fromObject(object.maxPollDelay, long + 1); + } + if (object.totalPollTimeout != null) { + if (!$util.isObject(object.totalPollTimeout)) + throw TypeError(".google.api.MethodSettings.LongRunning.totalPollTimeout: object expected"); + message.totalPollTimeout = $root.google.protobuf.Duration.fromObject(object.totalPollTimeout, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a LongRunning message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.LongRunning} message LongRunning + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LongRunning.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.initialPollDelay = null; + object.pollDelayMultiplier = 0; + object.maxPollDelay = null; + object.totalPollTimeout = null; + } + if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) + object.initialPollDelay = $root.google.protobuf.Duration.toObject(message.initialPollDelay, options, q + 1); + if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) + object.pollDelayMultiplier = options.json && !isFinite(message.pollDelayMultiplier) ? String(message.pollDelayMultiplier) : message.pollDelayMultiplier; + if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) + object.maxPollDelay = $root.google.protobuf.Duration.toObject(message.maxPollDelay, options, q + 1); + if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) + object.totalPollTimeout = $root.google.protobuf.Duration.toObject(message.totalPollTimeout, options, q + 1); + return object; + }; + + /** + * Converts this LongRunning to JSON. + * @function toJSON + * @memberof google.api.MethodSettings.LongRunning + * @instance + * @returns {Object.} JSON object + */ + LongRunning.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LongRunning + * @function getTypeUrl + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LongRunning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MethodSettings.LongRunning"; + }; + + return LongRunning; + })(); + + return MethodSettings; + })(); + + /** + * ClientLibraryOrganization enum. + * @name google.api.ClientLibraryOrganization + * @enum {number} + * @property {number} CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED=0 CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED value + * @property {number} CLOUD=1 CLOUD value + * @property {number} ADS=2 ADS value + * @property {number} PHOTOS=3 PHOTOS value + * @property {number} STREET_VIEW=4 STREET_VIEW value + * @property {number} SHOPPING=5 SHOPPING value + * @property {number} GEO=6 GEO value + * @property {number} GENERATIVE_AI=7 GENERATIVE_AI value + */ + api.ClientLibraryOrganization = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLOUD"] = 1; + values[valuesById[2] = "ADS"] = 2; + values[valuesById[3] = "PHOTOS"] = 3; + values[valuesById[4] = "STREET_VIEW"] = 4; + values[valuesById[5] = "SHOPPING"] = 5; + values[valuesById[6] = "GEO"] = 6; + values[valuesById[7] = "GENERATIVE_AI"] = 7; + return values; + })(); + + /** + * ClientLibraryDestination enum. + * @name google.api.ClientLibraryDestination + * @enum {number} + * @property {number} CLIENT_LIBRARY_DESTINATION_UNSPECIFIED=0 CLIENT_LIBRARY_DESTINATION_UNSPECIFIED value + * @property {number} GITHUB=10 GITHUB value + * @property {number} PACKAGE_MANAGER=20 PACKAGE_MANAGER value + */ + api.ClientLibraryDestination = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED"] = 0; + values[valuesById[10] = "GITHUB"] = 10; + values[valuesById[20] = "PACKAGE_MANAGER"] = 20; + return values; + })(); + + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.methods != null && Object.hasOwnProperty.call(message, "methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.SelectiveGapicGeneration: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; + })(); + + api.RoutingRule = (function() { + + /** + * Properties of a RoutingRule. + * @memberof google.api + * @interface IRoutingRule + * @property {Array.|null} [routingParameters] RoutingRule routingParameters + */ + + /** + * Constructs a new RoutingRule. + * @memberof google.api + * @classdesc Represents a RoutingRule. + * @implements IRoutingRule + * @constructor + * @param {google.api.IRoutingRule=} [properties] Properties to set + */ + function RoutingRule(properties) { + this.routingParameters = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RoutingRule routingParameters. + * @member {Array.} routingParameters + * @memberof google.api.RoutingRule + * @instance + */ + RoutingRule.prototype.routingParameters = $util.emptyArray; + + /** + * Creates a new RoutingRule instance using the specified properties. + * @function create + * @memberof google.api.RoutingRule + * @static + * @param {google.api.IRoutingRule=} [properties] Properties to set + * @returns {google.api.RoutingRule} RoutingRule instance + */ + RoutingRule.create = function create(properties) { + return new RoutingRule(properties); + }; + + /** + * Encodes the specified RoutingRule message. Does not implicitly {@link google.api.RoutingRule.verify|verify} messages. + * @function encode + * @memberof google.api.RoutingRule + * @static + * @param {google.api.IRoutingRule} message RoutingRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RoutingRule.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.routingParameters != null && message.routingParameters.length) + for (var i = 0; i < message.routingParameters.length; ++i) + $root.google.api.RoutingParameter.encode(message.routingParameters[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified RoutingRule message, length delimited. Does not implicitly {@link google.api.RoutingRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.RoutingRule + * @static + * @param {google.api.IRoutingRule} message RoutingRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RoutingRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RoutingRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.RoutingRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.RoutingRule} RoutingRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RoutingRule.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.RoutingRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.routingParameters && message.routingParameters.length)) + message.routingParameters = []; + message.routingParameters.push($root.google.api.RoutingParameter.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RoutingRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.RoutingRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.RoutingRule} RoutingRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RoutingRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RoutingRule message. + * @function verify + * @memberof google.api.RoutingRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RoutingRule.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.routingParameters != null && Object.hasOwnProperty.call(message, "routingParameters")) { + if (!Array.isArray(message.routingParameters)) + return "routingParameters: array expected"; + for (var i = 0; i < message.routingParameters.length; ++i) { + var error = $root.google.api.RoutingParameter.verify(message.routingParameters[i], long + 1); + if (error) + return "routingParameters." + error; + } + } + return null; + }; + + /** + * Creates a RoutingRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.RoutingRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.RoutingRule} RoutingRule + */ + RoutingRule.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.RoutingRule) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.RoutingRule: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.RoutingRule(); + if (object.routingParameters) { + if (!Array.isArray(object.routingParameters)) + throw TypeError(".google.api.RoutingRule.routingParameters: array expected"); + message.routingParameters = []; + for (var i = 0; i < object.routingParameters.length; ++i) { + if (!$util.isObject(object.routingParameters[i])) + throw TypeError(".google.api.RoutingRule.routingParameters: object expected"); + message.routingParameters[i] = $root.google.api.RoutingParameter.fromObject(object.routingParameters[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a RoutingRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.RoutingRule + * @static + * @param {google.api.RoutingRule} message RoutingRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RoutingRule.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.routingParameters = []; + if (message.routingParameters && message.routingParameters.length) { + object.routingParameters = []; + for (var j = 0; j < message.routingParameters.length; ++j) + object.routingParameters[j] = $root.google.api.RoutingParameter.toObject(message.routingParameters[j], options, q + 1); + } + return object; + }; + + /** + * Converts this RoutingRule to JSON. + * @function toJSON + * @memberof google.api.RoutingRule + * @instance + * @returns {Object.} JSON object + */ + RoutingRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RoutingRule + * @function getTypeUrl + * @memberof google.api.RoutingRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RoutingRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.RoutingRule"; + }; + + return RoutingRule; + })(); + + api.RoutingParameter = (function() { + + /** + * Properties of a RoutingParameter. + * @memberof google.api + * @interface IRoutingParameter + * @property {string|null} [field] RoutingParameter field + * @property {string|null} [pathTemplate] RoutingParameter pathTemplate + */ + + /** + * Constructs a new RoutingParameter. + * @memberof google.api + * @classdesc Represents a RoutingParameter. + * @implements IRoutingParameter + * @constructor + * @param {google.api.IRoutingParameter=} [properties] Properties to set + */ + function RoutingParameter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * RoutingParameter field. + * @member {string} field + * @memberof google.api.RoutingParameter + * @instance + */ + RoutingParameter.prototype.field = ""; + + /** + * RoutingParameter pathTemplate. + * @member {string} pathTemplate + * @memberof google.api.RoutingParameter + * @instance + */ + RoutingParameter.prototype.pathTemplate = ""; + + /** + * Creates a new RoutingParameter instance using the specified properties. + * @function create + * @memberof google.api.RoutingParameter + * @static + * @param {google.api.IRoutingParameter=} [properties] Properties to set + * @returns {google.api.RoutingParameter} RoutingParameter instance + */ + RoutingParameter.create = function create(properties) { + return new RoutingParameter(properties); + }; + + /** + * Encodes the specified RoutingParameter message. Does not implicitly {@link google.api.RoutingParameter.verify|verify} messages. + * @function encode + * @memberof google.api.RoutingParameter + * @static + * @param {google.api.IRoutingParameter} message RoutingParameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RoutingParameter.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.field); + if (message.pathTemplate != null && Object.hasOwnProperty.call(message, "pathTemplate")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pathTemplate); + return writer; + }; + + /** + * Encodes the specified RoutingParameter message, length delimited. Does not implicitly {@link google.api.RoutingParameter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.RoutingParameter + * @static + * @param {google.api.IRoutingParameter} message RoutingParameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RoutingParameter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a RoutingParameter message from the specified reader or buffer. + * @function decode + * @memberof google.api.RoutingParameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.RoutingParameter} RoutingParameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RoutingParameter.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.RoutingParameter(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.field = reader.string(); + break; + } + case 2: { + message.pathTemplate = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a RoutingParameter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.RoutingParameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.RoutingParameter} RoutingParameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RoutingParameter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RoutingParameter message. + * @function verify + * @memberof google.api.RoutingParameter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RoutingParameter.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + if (!$util.isString(message.field)) + return "field: string expected"; + if (message.pathTemplate != null && Object.hasOwnProperty.call(message, "pathTemplate")) + if (!$util.isString(message.pathTemplate)) + return "pathTemplate: string expected"; + return null; + }; + + /** + * Creates a RoutingParameter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.RoutingParameter + * @static + * @param {Object.} object Plain object + * @returns {google.api.RoutingParameter} RoutingParameter + */ + RoutingParameter.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.api.RoutingParameter) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.RoutingParameter: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.api.RoutingParameter(); + if (object.field != null) + message.field = String(object.field); + if (object.pathTemplate != null) + message.pathTemplate = String(object.pathTemplate); + return message; + }; + + /** + * Creates a plain object from a RoutingParameter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.RoutingParameter + * @static + * @param {google.api.RoutingParameter} message RoutingParameter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RoutingParameter.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.field = ""; + object.pathTemplate = ""; + } + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + object.field = message.field; + if (message.pathTemplate != null && Object.hasOwnProperty.call(message, "pathTemplate")) + object.pathTemplate = message.pathTemplate; + return object; + }; + + /** + * Converts this RoutingParameter to JSON. + * @function toJSON + * @memberof google.api.RoutingParameter + * @instance + * @returns {Object.} JSON object + */ + RoutingParameter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RoutingParameter + * @function getTypeUrl + * @memberof google.api.RoutingParameter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RoutingParameter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.RoutingParameter"; + }; + + return RoutingParameter; + })(); + + return api; + })(); + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.file != null && Object.hasOwnProperty.call(message, "file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i], long + 1); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FileDescriptorSet: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (!$util.isObject(object.file[i])) + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options, q + 1); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorSet + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + }; + + return FileDescriptorSet; + })(); + + /** + * Edition enum. + * @name google.protobuf.Edition + * @enum {number} + * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value + * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value + * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value + * @property {number} EDITION_2023=1000 EDITION_2023 value + * @property {number} EDITION_2024=1001 EDITION_2024 value + * @property {number} EDITION_1_TEST_ONLY=1 EDITION_1_TEST_ONLY value + * @property {number} EDITION_2_TEST_ONLY=2 EDITION_2_TEST_ONLY value + * @property {number} EDITION_99997_TEST_ONLY=99997 EDITION_99997_TEST_ONLY value + * @property {number} EDITION_99998_TEST_ONLY=99998 EDITION_99998_TEST_ONLY value + * @property {number} EDITION_99999_TEST_ONLY=99999 EDITION_99999_TEST_ONLY value + * @property {number} EDITION_MAX=2147483647 EDITION_MAX value + */ + protobuf.Edition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; + values[valuesById[998] = "EDITION_PROTO2"] = 998; + values[valuesById[999] = "EDITION_PROTO3"] = 999; + values[valuesById[1000] = "EDITION_2023"] = 1000; + values[valuesById[1001] = "EDITION_2024"] = 1001; + values[valuesById[1] = "EDITION_1_TEST_ONLY"] = 1; + values[valuesById[2] = "EDITION_2_TEST_ONLY"] = 2; + values[valuesById[99997] = "EDITION_99997_TEST_ONLY"] = 99997; + values[valuesById[99998] = "EDITION_99998_TEST_ONLY"] = 99998; + values[valuesById[99999] = "EDITION_99999_TEST_ONLY"] = 99999; + values[valuesById[2147483647] = "EDITION_MAX"] = 2147483647; + return values; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency + * @property {Array.|null} [messageType] FileDescriptorProto messageType + * @property {Array.|null} [enumType] FileDescriptorProto enumType + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string|null} [syntax] FileDescriptorProto syntax + * @property {google.protobuf.Edition|null} [edition] FileDescriptorProto edition + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.optionDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.} publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.} weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.} messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * FileDescriptorProto edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = 0; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (var i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.messageType != null && message.messageType.length) + for (var i = 0; i < message.messageType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.service != null && message.service.length) + for (var i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); + if (message.publicDependency != null && message.publicDependency.length) + for (var i = 0; i < message.publicDependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); + if (message.weakDependency != null && message.weakDependency.length) + for (var i = 0; i < message.weakDependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message["package"] = reader.string(); + break; + } + case 3: { + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + } + case 10: { + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + } + case 11: { + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } + case 4: { + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 5: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 6: { + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 7: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 8: { + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 9: { + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 12: { + message.syntax = reader.string(); + break; + } + case 14: { + message.edition = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && Object.hasOwnProperty.call(message, "dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && Object.hasOwnProperty.call(message, "publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && Object.hasOwnProperty.call(message, "weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.optionDependency != null && Object.hasOwnProperty.call(message, "optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } + if (message.messageType != null && Object.hasOwnProperty.call(message, "messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i], long + 1); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i], long + 1); + if (error) + return "enumType." + error; + } + } + if (message.service != null && Object.hasOwnProperty.call(message, "service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i], long + 1); + if (error) + return "service." + error; + } + } + if (message.extension != null && Object.hasOwnProperty.call(message, "extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i], long + 1); + if (error) + return "extension." + error; + } + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.protobuf.FileOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) { + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo, long + 1); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FileDescriptorProto: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (!$util.isObject(object.messageType[i])) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i], long + 1); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (!$util.isObject(object.enumType[i])) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i], long + 1); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (!$util.isObject(object.service[i])) + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i], long + 1); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (!$util.isObject(object.extension[i])) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i], long + 1); + } + } + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options, long + 1); + } + if (object.sourceCodeInfo != null) { + if (!$util.isObject(object.sourceCodeInfo)) + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo, long + 1); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + object.optionDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options, q + 1); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options, q + 1); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options, q + 1); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options, q + 1); + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options, q + 1); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options, q + 1); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + object.syntax = message.syntax; + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + case 11: { + message.visibility = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i], long + 1); + if (error) + return "field." + error; + } + } + if (message.extension != null && Object.hasOwnProperty.call(message, "extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i], long + 1); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && Object.hasOwnProperty.call(message, "nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i], long + 1); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i], long + 1); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && Object.hasOwnProperty.call(message, "extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i], long + 1); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && Object.hasOwnProperty.call(message, "oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i], long + 1); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + if (message.reservedRange != null && Object.hasOwnProperty.call(message, "reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i], long + 1); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && Object.hasOwnProperty.call(message, "reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.DescriptorProto: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (!$util.isObject(object.field[i])) + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i], long + 1); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (!$util.isObject(object.extension[i])) + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i], long + 1); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (!$util.isObject(object.nestedType[i])) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i], long + 1); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (!$util.isObject(object.enumType[i])) + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i], long + 1); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (!$util.isObject(object.extensionRange[i])) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i], long + 1); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (!$util.isObject(object.oneofDecl[i])) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i], long + 1); + } + } + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options, long + 1); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (!$util.isObject(object.reservedRange[i])) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i], long + 1); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options, q + 1); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options, q + 1); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options, q + 1); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options, q + 1); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options, q + 1); + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options, q + 1); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options, q + 1); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options, q + 1); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + object.start = message.start; + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + object.end = message.end; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options, q + 1); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.DescriptorProto.ReservedRange: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + object.start = message.start; + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReservedRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.ExtensionRangeOptions = (function() { + + /** + * Properties of an ExtensionRangeOptions. + * @memberof google.protobuf + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption + * @property {Array.|null} [declaration] ExtensionRangeOptions declaration + * @property {google.protobuf.IFeatureSet|null} [features] ExtensionRangeOptions features + * @property {google.protobuf.ExtensionRangeOptions.VerificationState|null} [verification] ExtensionRangeOptions verification + */ + + /** + * Constructs a new ExtensionRangeOptions. + * @memberof google.protobuf + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions + * @constructor + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + */ + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; + this.declaration = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ExtensionRangeOptions declaration. + * @member {Array.} declaration + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.declaration = $util.emptyArray; + + /** + * ExtensionRangeOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.features = null; + + /** + * ExtensionRangeOptions verification. + * @member {google.protobuf.ExtensionRangeOptions.VerificationState} verification + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.verification = 1; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + */ + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); + }; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.declaration != null && message.declaration.length) + for (var i = 0; i < message.declaration.length; ++i) + $root.google.protobuf.ExtensionRangeOptions.Declaration.encode(message.declaration[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.verification); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork(), q + 1).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + if (!(message.declaration && message.declaration.length)) + message.declaration = []; + message.declaration.push($root.google.protobuf.ExtensionRangeOptions.Declaration.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 50: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.verification = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRangeOptions message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRangeOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); + if (error) + return "uninterpretedOption." + error; + } + } + if (message.declaration != null && Object.hasOwnProperty.call(message, "declaration")) { + if (!Array.isArray(message.declaration)) + return "declaration: array expected"; + for (var i = 0; i < message.declaration.length; ++i) { + var error = $root.google.protobuf.ExtensionRangeOptions.Declaration.verify(message.declaration[i], long + 1); + if (error) + return "declaration." + error; + } + } + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); + if (error) + return "features." + error; + } + if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) + switch (message.verification) { + default: + return "verification: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + */ + ExtensionRangeOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ExtensionRangeOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.ExtensionRangeOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (!$util.isObject(object.uninterpretedOption[i])) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); + } + } + if (object.declaration) { + if (!Array.isArray(object.declaration)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: array expected"); + message.declaration = []; + for (var i = 0; i < object.declaration.length; ++i) { + if (!$util.isObject(object.declaration[i])) + throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: object expected"); + message.declaration[i] = $root.google.protobuf.ExtensionRangeOptions.Declaration.fromObject(object.declaration[i], long + 1); + } + } + if (object.features != null) { + if (!$util.isObject(object.features)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); + } + switch (object.verification) { + case "DECLARATION": + case 0: + message.verification = 0; + break; + default: + if (typeof object.verification === "number") { + message.verification = object.verification; + break; + } + break; + case "UNVERIFIED": + case 1: + message.verification = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRangeOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.declaration = []; + object.uninterpretedOption = []; + } + if (options.defaults) { + object.verification = options.enums === String ? "UNVERIFIED" : 1; + object.features = null; + } + if (message.declaration && message.declaration.length) { + object.declaration = []; + for (var j = 0; j < message.declaration.length; ++j) + object.declaration[j] = $root.google.protobuf.ExtensionRangeOptions.Declaration.toObject(message.declaration[j], options, q + 1); + } + if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) + object.verification = options.enums === String ? $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] === undefined ? message.verification : $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] : message.verification; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); + } + return object; + }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + * @returns {Object.} JSON object + */ + ExtensionRangeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + }; + + ExtensionRangeOptions.Declaration = (function() { + + /** + * Properties of a Declaration. + * @memberof google.protobuf.ExtensionRangeOptions + * @interface IDeclaration + * @property {number|null} [number] Declaration number + * @property {string|null} [fullName] Declaration fullName + * @property {string|null} [type] Declaration type + * @property {boolean|null} [reserved] Declaration reserved + * @property {boolean|null} [repeated] Declaration repeated + */ + + /** + * Constructs a new Declaration. + * @memberof google.protobuf.ExtensionRangeOptions + * @classdesc Represents a Declaration. + * @implements IDeclaration + * @constructor + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set + */ + function Declaration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Declaration number. + * @member {number} number + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.number = 0; + + /** + * Declaration fullName. + * @member {string} fullName + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.fullName = ""; + + /** + * Declaration type. + * @member {string} type + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.type = ""; + + /** + * Declaration reserved. + * @member {boolean} reserved + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.reserved = false; + + /** + * Declaration repeated. + * @member {boolean} repeated + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.repeated = false; + + /** + * Creates a new Declaration instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration instance + */ + Declaration.create = function create(properties) { + return new Declaration(properties); + }; + + /** + * Encodes the specified Declaration message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Declaration.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.number); + if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.fullName); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.type); + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.reserved); + if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.repeated); + return writer; + }; + + /** + * Encodes the specified Declaration message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Declaration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Declaration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Declaration.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.number = reader.int32(); + break; + } + case 2: { + message.fullName = reader.string(); + break; + } + case 3: { + message.type = reader.string(); + break; + } + case 5: { + message.reserved = reader.bool(); + break; + } + case 6: { + message.repeated = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Declaration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Declaration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Declaration message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Declaration.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) + if (!$util.isString(message.fullName)) + return "fullName: string expected"; + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) + if (typeof message.reserved !== "boolean") + return "reserved: boolean expected"; + if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) + if (typeof message.repeated !== "boolean") + return "repeated: boolean expected"; + return null; + }; + + /** + * Creates a Declaration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + */ + Declaration.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions.Declaration) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.Declaration: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); + if (object.number != null) + message.number = object.number | 0; + if (object.fullName != null) + message.fullName = String(object.fullName); + if (object.type != null) + message.type = String(object.type); + if (object.reserved != null) + message.reserved = Boolean(object.reserved); + if (object.repeated != null) + message.repeated = Boolean(object.repeated); + return message; + }; + + /** + * Creates a plain object from a Declaration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.Declaration} message Declaration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Declaration.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.number = 0; + object.fullName = ""; + object.type = ""; + object.reserved = false; + object.repeated = false; + } + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + object.number = message.number; + if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) + object.fullName = message.fullName; + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + object.type = message.type; + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) + object.reserved = message.reserved; + if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) + object.repeated = message.repeated; + return object; + }; + + /** + * Converts this Declaration to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + * @returns {Object.} JSON object + */ + Declaration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Declaration + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Declaration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions.Declaration"; + }; + + return Declaration; + })(); + + /** + * VerificationState enum. + * @name google.protobuf.ExtensionRangeOptions.VerificationState + * @enum {number} + * @property {number} DECLARATION=0 DECLARATION value + * @property {number} UNVERIFIED=1 UNVERIFIED value + */ + ExtensionRangeOptions.VerificationState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DECLARATION"] = 0; + values[valuesById[1] = "UNVERIFIED"] = 1; + return values; + })(); + + return ExtensionRangeOptions; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.proto3Optional = false; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 3: + case 2: + break; + } + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldDescriptorProto: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + } + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options, long + 1); + } + if (object.proto3Optional != null) + message.proto3Optional = Boolean(object.proto3Optional); + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + object.proto3Optional = false; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + object.extendee = message.extendee; + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + object.number = message.number; + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options, q + 1); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + object.jsonName = message.jsonName; + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + object.proto3Optional = message.proto3Optional; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.OneofDescriptorProto: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options, q + 1); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + case 6: { + message.visibility = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i], long + 1); + if (error) + return "value." + error; + } + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + if (message.reservedRange != null && Object.hasOwnProperty.call(message, "reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i], long + 1); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && Object.hasOwnProperty.call(message, "reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumDescriptorProto: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (!$util.isObject(object.value[i])) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i], long + 1); + } + } + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options, long + 1); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (!$util.isObject(object.reservedRange[i])) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i], long + 1); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options, q + 1); + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options, q + 1); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options, q + 1); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; + }; + + EnumDescriptorProto.EnumReservedRange = (function() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumDescriptorProto.EnumReservedRange: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + object.start = message.start; + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumReservedRange + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + }; + + return EnumReservedRange; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumValueDescriptorProto: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + object.number = message.number; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options, q + 1); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && Object.hasOwnProperty.call(message, "method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i], long + 1); + if (error) + return "method." + error; + } + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ServiceDescriptorProto: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (!$util.isObject(object.method[i])) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i], long + 1); + } + } + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options, q + 1); + } + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options, q + 1); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options, long + 1); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.MethodDescriptorProto: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (!$util.isObject(object.options)) + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options, long + 1); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + object.inputType = message.inputType; + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + object.outputType = message.outputType; + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options, q + 1); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {google.protobuf.IFeatureSet|null} [features] FileOptions features + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; + + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; + + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; + + /** + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpNamespace = ""; + + /** + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpMetadataNamespace = ""; + + /** + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.rubyPackage = ""; + + /** + * FileOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.features = null; + + /** + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork(), q + 1).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 50: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i], long + 1); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FileOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.swiftPrefix != null) + message.swiftPrefix = String(object.swiftPrefix); + if (object.phpClassPrefix != null) + message.phpClassPrefix = String(object.phpClassPrefix); + if (object.phpNamespace != null) + message.phpNamespace = String(object.phpNamespace); + if (object.phpMetadataNamespace != null) + message.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (object.rubyPackage != null) + message.rubyPackage = String(object.rubyPackage); + if (object.features != null) { + if (!$util.isObject(object.features)) + throw TypeError(".google.protobuf.FileOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (!$util.isObject(object.uninterpretedOption[i])) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); + } + } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (!$util.isObject(object[".google.api.resourceDefinition"][i])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = true; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + object.swiftPrefix = ""; + object.phpClassPrefix = ""; + object.phpNamespace = ""; + object.phpMetadataNamespace = ""; + object.rubyPackage = ""; + object.features = null; + } + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options, q + 1); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileOptions + * @function getTypeUrl + * @memberof google.protobuf.FileOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileOptions"; + }; + + /** + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode + * @enum {number} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [mapEntry] MessageOptions mapEntry + * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] MessageOptions deprecatedLegacyJsonFieldConflicts + * @property {google.protobuf.IFeatureSet|null} [features] MessageOptions features + * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.messageSetWireFormat = false; + + /** + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.noStandardDescriptorAccessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions mapEntry. + * @member {boolean} mapEntry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.mapEntry = false; + + /** + * MessageOptions deprecatedLegacyJsonFieldConflicts. + * @member {boolean} deprecatedLegacyJsonFieldConflicts + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; + + /** + * MessageOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.features = null; + + /** + * MessageOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance + */ + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.deprecatedLegacyJsonFieldConflicts); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 12, wireType 2 =*/98).fork(), q + 1).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.messageSetWireFormat = reader.bool(); + break; + } + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 7: { + message.mapEntry = reader.bool(); + break; + } + case 11: { + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; + } + case 12: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") + return "deprecatedLegacyJsonFieldConflicts: boolean expected"; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"], long + 1); + if (error) + return ".google.api.resource." + error; + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.MessageOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.deprecatedLegacyJsonFieldConflicts != null) + message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); + if (object.features != null) { + if (!$util.isObject(object.features)) + throw TypeError(".google.protobuf.MessageOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (!$util.isObject(object.uninterpretedOption[i])) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); + } + } + if (object[".google.api.resource"] != null) { + if (!$util.isObject(object[".google.api.resource"])) + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"], long + 1); + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object.deprecatedLegacyJsonFieldConflicts = false; + object.features = null; + object[".google.api.resource"] = null; + } + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + object.mapEntry = message.mapEntry; + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); + } + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options, q + 1); + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageOptions + * @function getTypeUrl + * @memberof google.protobuf.MessageOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MessageOptions"; + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {boolean|null} [debugRedact] FieldOptions debugRedact + * @property {google.protobuf.FieldOptions.OptionRetention|null} [retention] FieldOptions retention + * @property {Array.|null} [targets] FieldOptions targets + * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults + * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.targets = []; + this.editionDefaults = []; + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions debugRedact. + * @member {boolean} debugRedact + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.debugRedact = false; + + /** + * FieldOptions retention. + * @member {google.protobuf.FieldOptions.OptionRetention} retention + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.retention = 0; + + /** + * FieldOptions targets. + * @member {Array.} targets + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.targets = $util.emptyArray; + + /** + * FieldOptions editionDefaults. + * @member {Array.} editionDefaults + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.editionDefaults = $util.emptyArray; + + /** + * FieldOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.features = null; + + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.debugRedact); + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) + writer.uint32(/* id 17, wireType 0 =*/136).int32(message.retention); + if (message.targets != null && message.targets.length) + for (var i = 0; i < message.targets.length; ++i) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.targets[i]); + if (message.editionDefaults != null && message.editionDefaults.length) + for (var i = 0; i < message.editionDefaults.length; ++i) + $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork(), q + 1).ldelim(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork(), q + 1).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork(), q + 1).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.uint32(/* id 1052, wireType 0 =*/8416).int32(message[".google.api.fieldBehavior"][i]); + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.ctype = reader.int32(); + break; + } + case 2: { + message.packed = reader.bool(); + break; + } + case 6: { + message.jstype = reader.int32(); + break; + } + case 5: { + message.lazy = reader.bool(); + break; + } + case 15: { + message.unverifiedLazy = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 10: { + message.weak = reader.bool(); + break; + } + case 16: { + message.debugRedact = reader.bool(); + break; + } + case 17: { + message.retention = reader.int32(); + break; + } + case 19: { + if (!(message.targets && message.targets.length)) + message.targets = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.targets.push(reader.int32()); + } else + message.targets.push(reader.int32()); + break; + } + case 20: { + if (!(message.editionDefaults && message.editionDefaults.length)) + message.editionDefaults = []; + message.editionDefaults.push($root.google.protobuf.FieldOptions.EditionDefault.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 21: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 1052: { + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else + message[".google.api.fieldBehavior"].push(reader.int32()); + break; + } + case 1055: { + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + if (typeof message.debugRedact !== "boolean") + return "debugRedact: boolean expected"; + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) + switch (message.retention) { + default: + return "retention: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.targets != null && Object.hasOwnProperty.call(message, "targets")) { + if (!Array.isArray(message.targets)) + return "targets: array expected"; + for (var i = 0; i < message.targets.length; ++i) + switch (message.targets[i]) { + default: + return "targets: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; + } + } + if (message.editionDefaults != null && Object.hasOwnProperty.call(message, "editionDefaults")) { + if (!Array.isArray(message.editionDefaults)) + return "editionDefaults: array expected"; + for (var i = 0; i < message.editionDefaults.length; ++i) { + var error = $root.google.protobuf.FieldOptions.EditionDefault.verify(message.editionDefaults[i], long + 1); + if (error) + return "editionDefaults." + error; + } + } + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); + if (error) + return "features." + error; + } + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport, long + 1); + if (error) + return "featureSupport." + error; + } + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.fieldBehavior"] != null && Object.hasOwnProperty.call(message, ".google.api.fieldBehavior")) { + if (!Array.isArray(message[".google.api.fieldBehavior"])) + return ".google.api.fieldBehavior: array expected"; + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + switch (message[".google.api.fieldBehavior"][i]) { + default: + return ".google.api.fieldBehavior: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + } + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"], long + 1); + if (error) + return ".google.api.resourceReference." + error; + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.debugRedact != null) + message.debugRedact = Boolean(object.debugRedact); + switch (object.retention) { + default: + if (typeof object.retention === "number") { + message.retention = object.retention; + break; + } + break; + case "RETENTION_UNKNOWN": + case 0: + message.retention = 0; + break; + case "RETENTION_RUNTIME": + case 1: + message.retention = 1; + break; + case "RETENTION_SOURCE": + case 2: + message.retention = 2; + break; + } + if (object.targets) { + if (!Array.isArray(object.targets)) + throw TypeError(".google.protobuf.FieldOptions.targets: array expected"); + message.targets = []; + for (var i = 0; i < object.targets.length; ++i) + switch (object.targets[i]) { + default: + if (typeof object.targets[i] === "number") { + message.targets[i] = object.targets[i]; + break; + } + case "TARGET_TYPE_UNKNOWN": + case 0: + message.targets[i] = 0; + break; + case "TARGET_TYPE_FILE": + case 1: + message.targets[i] = 1; + break; + case "TARGET_TYPE_EXTENSION_RANGE": + case 2: + message.targets[i] = 2; + break; + case "TARGET_TYPE_MESSAGE": + case 3: + message.targets[i] = 3; + break; + case "TARGET_TYPE_FIELD": + case 4: + message.targets[i] = 4; + break; + case "TARGET_TYPE_ONEOF": + case 5: + message.targets[i] = 5; + break; + case "TARGET_TYPE_ENUM": + case 6: + message.targets[i] = 6; + break; + case "TARGET_TYPE_ENUM_ENTRY": + case 7: + message.targets[i] = 7; + break; + case "TARGET_TYPE_SERVICE": + case 8: + message.targets[i] = 8; + break; + case "TARGET_TYPE_METHOD": + case 9: + message.targets[i] = 9; + break; + } + } + if (object.editionDefaults) { + if (!Array.isArray(object.editionDefaults)) + throw TypeError(".google.protobuf.FieldOptions.editionDefaults: array expected"); + message.editionDefaults = []; + for (var i = 0; i < object.editionDefaults.length; ++i) { + if (!$util.isObject(object.editionDefaults[i])) + throw TypeError(".google.protobuf.FieldOptions.editionDefaults: object expected"); + message.editionDefaults[i] = $root.google.protobuf.FieldOptions.EditionDefault.fromObject(object.editionDefaults[i], long + 1); + } + } + if (object.features != null) { + if (!$util.isObject(object.features)) + throw TypeError(".google.protobuf.FieldOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); + } + if (object.featureSupport != null) { + if (!$util.isObject(object.featureSupport)) + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport, long + 1); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (!$util.isObject(object.uninterpretedOption[i])) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); + } + } + if (object[".google.api.fieldBehavior"]) { + if (!Array.isArray(object[".google.api.fieldBehavior"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); + message[".google.api.fieldBehavior"] = []; + for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) + switch (object[".google.api.fieldBehavior"][i]) { + default: + if (typeof object[".google.api.fieldBehavior"][i] === "number") { + message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; + break; + } + case "FIELD_BEHAVIOR_UNSPECIFIED": + case 0: + message[".google.api.fieldBehavior"][i] = 0; + break; + case "OPTIONAL": + case 1: + message[".google.api.fieldBehavior"][i] = 1; + break; + case "REQUIRED": + case 2: + message[".google.api.fieldBehavior"][i] = 2; + break; + case "OUTPUT_ONLY": + case 3: + message[".google.api.fieldBehavior"][i] = 3; + break; + case "INPUT_ONLY": + case 4: + message[".google.api.fieldBehavior"][i] = 4; + break; + case "IMMUTABLE": + case 5: + message[".google.api.fieldBehavior"][i] = 5; + break; + case "UNORDERED_LIST": + case 6: + message[".google.api.fieldBehavior"][i] = 6; + break; + case "NON_EMPTY_DEFAULT": + case 7: + message[".google.api.fieldBehavior"][i] = 7; + break; + case "IDENTIFIER": + case 8: + message[".google.api.fieldBehavior"][i] = 8; + break; + } + } + if (object[".google.api.resourceReference"] != null) { + if (!$util.isObject(object[".google.api.resourceReference"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"], long + 1); + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.targets = []; + object.editionDefaults = []; + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object.unverifiedLazy = false; + object.debugRedact = false; + object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; + object.features = null; + object.featureSupport = null; + object[".google.api.resourceReference"] = null; + } + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + object.packed = message.packed; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + object.lazy = message.lazy; + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + object.weak = message.weak; + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + object.debugRedact = message.debugRedact; + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) + object.retention = options.enums === String ? $root.google.protobuf.FieldOptions.OptionRetention[message.retention] === undefined ? message.retention : $root.google.protobuf.FieldOptions.OptionRetention[message.retention] : message.retention; + if (message.targets && message.targets.length) { + object.targets = []; + for (var j = 0; j < message.targets.length; ++j) + object.targets[j] = options.enums === String ? $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] === undefined ? message.targets[j] : $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] : message.targets[j]; + } + if (message.editionDefaults && message.editionDefaults.length) { + object.editionDefaults = []; + for (var j = 0; j < message.editionDefaults.length; ++j) + object.editionDefaults[j] = $root.google.protobuf.FieldOptions.EditionDefault.toObject(message.editionDefaults[j], options, q + 1); + } + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options, q + 1); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); + } + if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { + object[".google.api.fieldBehavior"] = []; + for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + } + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options, q + 1); + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldOptions + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions"; + }; + + /** + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + /** + * OptionRetention enum. + * @name google.protobuf.FieldOptions.OptionRetention + * @enum {number} + * @property {number} RETENTION_UNKNOWN=0 RETENTION_UNKNOWN value + * @property {number} RETENTION_RUNTIME=1 RETENTION_RUNTIME value + * @property {number} RETENTION_SOURCE=2 RETENTION_SOURCE value + */ + FieldOptions.OptionRetention = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETENTION_UNKNOWN"] = 0; + values[valuesById[1] = "RETENTION_RUNTIME"] = 1; + values[valuesById[2] = "RETENTION_SOURCE"] = 2; + return values; + })(); + + /** + * OptionTargetType enum. + * @name google.protobuf.FieldOptions.OptionTargetType + * @enum {number} + * @property {number} TARGET_TYPE_UNKNOWN=0 TARGET_TYPE_UNKNOWN value + * @property {number} TARGET_TYPE_FILE=1 TARGET_TYPE_FILE value + * @property {number} TARGET_TYPE_EXTENSION_RANGE=2 TARGET_TYPE_EXTENSION_RANGE value + * @property {number} TARGET_TYPE_MESSAGE=3 TARGET_TYPE_MESSAGE value + * @property {number} TARGET_TYPE_FIELD=4 TARGET_TYPE_FIELD value + * @property {number} TARGET_TYPE_ONEOF=5 TARGET_TYPE_ONEOF value + * @property {number} TARGET_TYPE_ENUM=6 TARGET_TYPE_ENUM value + * @property {number} TARGET_TYPE_ENUM_ENTRY=7 TARGET_TYPE_ENUM_ENTRY value + * @property {number} TARGET_TYPE_SERVICE=8 TARGET_TYPE_SERVICE value + * @property {number} TARGET_TYPE_METHOD=9 TARGET_TYPE_METHOD value + */ + FieldOptions.OptionTargetType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TARGET_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "TARGET_TYPE_FILE"] = 1; + values[valuesById[2] = "TARGET_TYPE_EXTENSION_RANGE"] = 2; + values[valuesById[3] = "TARGET_TYPE_MESSAGE"] = 3; + values[valuesById[4] = "TARGET_TYPE_FIELD"] = 4; + values[valuesById[5] = "TARGET_TYPE_ONEOF"] = 5; + values[valuesById[6] = "TARGET_TYPE_ENUM"] = 6; + values[valuesById[7] = "TARGET_TYPE_ENUM_ENTRY"] = 7; + values[valuesById[8] = "TARGET_TYPE_SERVICE"] = 8; + values[valuesById[9] = "TARGET_TYPE_METHOD"] = 9; + return values; + })(); + + FieldOptions.EditionDefault = (function() { + + /** + * Properties of an EditionDefault. + * @memberof google.protobuf.FieldOptions + * @interface IEditionDefault + * @property {google.protobuf.Edition|null} [edition] EditionDefault edition + * @property {string|null} [value] EditionDefault value + */ + + /** + * Constructs a new EditionDefault. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents an EditionDefault. + * @implements IEditionDefault + * @constructor + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + */ + function EditionDefault(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * EditionDefault edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.edition = 0; + + /** + * EditionDefault value. + * @member {string} value + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.value = ""; + + /** + * Creates a new EditionDefault instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault instance + */ + EditionDefault.create = function create(properties) { + return new EditionDefault(properties); + }; + + /** + * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + return writer; + }; + + /** + * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EditionDefault message. + * @function verify + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EditionDefault.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + */ + EditionDefault.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldOptions.EditionDefault: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FieldOptions.EditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = message.value; + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; + + return EditionDefault; + })(); + + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldOptions.FeatureSupport: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; + break; + case "EDITION_2023": + case 1000: + message.editionRemoved = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionRemoved = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionRemoved = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionRemoved = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionRemoved = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionRemoved = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionRemoved = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionRemoved = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSupport.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; + return object; + }; + + /** + * Converts this FeatureSupport to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + * @returns {Object.} JSON object + */ + FeatureSupport.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSupport + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; + }; + + return FeatureSupport; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {google.protobuf.IFeatureSet|null} [features] OneofOptions features + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.features = null; + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.OneofOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.OneofOptions(); + if (object.features != null) { + if (!$util.isObject(object.features)) + throw TypeError(".google.protobuf.OneofOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (!$util.isObject(object.uninterpretedOption[i])) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.features = null; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofOptions + * @function getTypeUrl + * @memberof google.protobuf.OneofOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofOptions"; + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] EnumOptions deprecatedLegacyJsonFieldConflicts + * @property {google.protobuf.IFeatureSet|null} [features] EnumOptions features + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions deprecatedLegacyJsonFieldConflicts. + * @member {boolean} deprecatedLegacyJsonFieldConflicts + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; + + /** + * EnumOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.features = null; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.deprecatedLegacyJsonFieldConflicts); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.allowAlias = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 6: { + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; + } + case 7: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") + return "deprecatedLegacyJsonFieldConflicts: boolean expected"; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.deprecatedLegacyJsonFieldConflicts != null) + message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); + if (object.features != null) { + if (!$util.isObject(object.features)) + throw TypeError(".google.protobuf.EnumOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (!$util.isObject(object.uninterpretedOption[i])) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + object.deprecatedLegacyJsonFieldConflicts = false; + object.features = null; + } + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + object.deprecated = message.deprecated; + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumOptions"; + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features + * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.features = null; + + /** + * EnumValueOptions debugRedact. + * @member {boolean} debugRedact + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.debugRedact = false; + + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.deprecated = reader.bool(); + break; + } + case 2: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.debugRedact = reader.bool(); + break; + } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); + if (error) + return "features." + error; + } + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + if (typeof message.debugRedact !== "boolean") + return "debugRedact: boolean expected"; + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport, long + 1); + if (error) + return "featureSupport." + error; + } + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumValueOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.features != null) { + if (!$util.isObject(object.features)) + throw TypeError(".google.protobuf.EnumValueOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); + } + if (object.debugRedact != null) + message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (!$util.isObject(object.featureSupport)) + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport, long + 1); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (!$util.isObject(object.uninterpretedOption[i])) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object.features = null; + object.debugRedact = false; + object.featureSupport = null; + } + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + object.deprecated = message.deprecated; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + object.debugRedact = message.debugRedact; + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options, q + 1); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {google.protobuf.IFeatureSet|null} [features] ServiceOptions features + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + * @property {string|null} [".google.api.apiVersion"] ServiceOptions .google.api.apiVersion + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.features = null; + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.defaultHost"] = ""; + + /** + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + + /** + * ServiceOptions .google.api.apiVersion. + * @member {string} .google.api.apiVersion + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.apiVersion"] = ""; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 34, wireType 2 =*/274).fork(), q + 1).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) + writer.uint32(/* id 525000001, wireType 2 =*/4200000010).string(message[".google.api.apiVersion"]); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 34: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 33: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 1049: { + message[".google.api.defaultHost"] = reader.string(); + break; + } + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); + break; + } + case 525000001: { + message[".google.api.apiVersion"] = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); + if (error) + return "features." + error; + } + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) + if (!$util.isString(message[".google.api.apiVersion"])) + return ".google.api.apiVersion: string expected"; + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ServiceOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.ServiceOptions(); + if (object.features != null) { + if (!$util.isObject(object.features)) + throw TypeError(".google.protobuf.ServiceOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); + } + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (!$util.isObject(object.uninterpretedOption[i])) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + if (object[".google.api.apiVersion"] != null) + message[".google.api.apiVersion"] = String(object[".google.api.apiVersion"]); + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object.features = null; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + object[".google.api.apiVersion"] = ""; + } + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + object.deprecated = message.deprecated; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); + } + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) + object[".google.api.apiVersion"] = message[".google.api.apiVersion"]; + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceOptions + * @function getTypeUrl + * @memberof google.protobuf.ServiceOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceOptions"; + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {google.protobuf.IFeatureSet|null} [features] MethodOptions features + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + * @property {google.api.IRoutingRule|null} [".google.api.routing"] MethodOptions .google.api.routing + * @property {google.longrunning.IOperationInfo|null} [".google.longrunning.operationInfo"] MethodOptions .google.longrunning.operationInfo + */ + + /** + * Constructs a new MethodOptions. + * @memberof google.protobuf + * @classdesc Represents a MethodOptions. + * @implements IMethodOptions + * @constructor + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + */ + function MethodOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.methodSignature"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.deprecated = false; + + /** + * MethodOptions idempotencyLevel. + * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.idempotencyLevel = 0; + + /** + * MethodOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.features = null; + + /** + * MethodOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MethodOptions .google.api.http. + * @member {google.api.IHttpRule|null|undefined} .google.api.http + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.http"] = null; + + /** + * MethodOptions .google.api.methodSignature. + * @member {Array.} .google.api.methodSignature + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + + /** + * MethodOptions .google.api.routing. + * @member {google.api.IRoutingRule|null|undefined} .google.api.routing + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.routing"] = null; + + /** + * MethodOptions .google.longrunning.operationInfo. + * @member {google.longrunning.IOperationInfo|null|undefined} .google.longrunning.operationInfo + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.longrunning.operationInfo"] = null; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @returns {google.protobuf.MethodOptions} MethodOptions instance + */ + MethodOptions.create = function create(properties) { + return new MethodOptions(properties); + }; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 35, wireType 2 =*/282).fork(), q + 1).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); + if (message[".google.longrunning.operationInfo"] != null && Object.hasOwnProperty.call(message, ".google.longrunning.operationInfo")) + $root.google.longrunning.OperationInfo.encode(message[".google.longrunning.operationInfo"], writer.uint32(/* id 1049, wireType 2 =*/8394).fork(), q + 1).ldelim(); + if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork(), q + 1).ldelim(); + if (message[".google.api.routing"] != null && Object.hasOwnProperty.call(message, ".google.api.routing")) + $root.google.api.RoutingRule.encode(message[".google.api.routing"], writer.uint32(/* id 72295729, wireType 2 =*/578365834).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 33: { + message.deprecated = reader.bool(); + break; + } + case 34: { + message.idempotencyLevel = reader.int32(); + break; + } + case 35: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 72295728: { + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 1051: { + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + } + case 72295729: { + message[".google.api.routing"] = $root.google.api.RoutingRule.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 1049: { + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodOptions message. + * @function verify + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodOptions.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + switch (message.idempotencyLevel) { + default: + return "idempotencyLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) { + var error = $root.google.api.HttpRule.verify(message[".google.api.http"], long + 1); + if (error) + return ".google.api.http." + error; + } + if (message[".google.api.methodSignature"] != null && Object.hasOwnProperty.call(message, ".google.api.methodSignature")) { + if (!Array.isArray(message[".google.api.methodSignature"])) + return ".google.api.methodSignature: array expected"; + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + if (!$util.isString(message[".google.api.methodSignature"][i])) + return ".google.api.methodSignature: string[] expected"; + } + if (message[".google.api.routing"] != null && Object.hasOwnProperty.call(message, ".google.api.routing")) { + var error = $root.google.api.RoutingRule.verify(message[".google.api.routing"], long + 1); + if (error) + return ".google.api.routing." + error; + } + if (message[".google.longrunning.operationInfo"] != null && Object.hasOwnProperty.call(message, ".google.longrunning.operationInfo")) { + var error = $root.google.longrunning.OperationInfo.verify(message[".google.longrunning.operationInfo"], long + 1); + if (error) + return ".google.longrunning.operationInfo." + error; + } + return null; + }; + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions + */ + MethodOptions.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.MethodOptions: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + switch (object.idempotencyLevel) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; + case "IDEMPOTENCY_UNKNOWN": + case 0: + message.idempotencyLevel = 0; + break; + case "NO_SIDE_EFFECTS": + case 1: + message.idempotencyLevel = 1; + break; + case "IDEMPOTENT": + case 2: + message.idempotencyLevel = 2; + break; + } + if (object.features != null) { + if (!$util.isObject(object.features)) + throw TypeError(".google.protobuf.MethodOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (!$util.isObject(object.uninterpretedOption[i])) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); + } + } + if (object[".google.api.http"] != null) { + if (!$util.isObject(object[".google.api.http"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"], long + 1); + } + if (object[".google.api.methodSignature"]) { + if (!Array.isArray(object[".google.api.methodSignature"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); + message[".google.api.methodSignature"] = []; + for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) + message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); + } + if (object[".google.api.routing"] != null) { + if (!$util.isObject(object[".google.api.routing"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.routing: object expected"); + message[".google.api.routing"] = $root.google.api.RoutingRule.fromObject(object[".google.api.routing"], long + 1); + } + if (object[".google.longrunning.operationInfo"] != null) { + if (!$util.isObject(object[".google.longrunning.operationInfo"])) + throw TypeError(".google.protobuf.MethodOptions..google.longrunning.operationInfo: object expected"); + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.fromObject(object[".google.longrunning.operationInfo"], long + 1); + } + return message; + }; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodOptions.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.methodSignature"] = []; + } + if (options.defaults) { + object.deprecated = false; + object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; + object.features = null; + object[".google.longrunning.operationInfo"] = null; + object[".google.api.http"] = null; + object[".google.api.routing"] = null; + } + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + object.deprecated = message.deprecated; + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); + } + if (message[".google.longrunning.operationInfo"] != null && Object.hasOwnProperty.call(message, ".google.longrunning.operationInfo")) + object[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.toObject(message[".google.longrunning.operationInfo"], options, q + 1); + if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { + object[".google.api.methodSignature"] = []; + for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) + object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; + } + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options, q + 1); + if (message[".google.api.routing"] != null && Object.hasOwnProperty.call(message, ".google.api.routing")) + object[".google.api.routing"] = $root.google.api.RoutingRule.toObject(message[".google.api.routing"], options, q + 1); + return object; + }; + + /** + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions + * @instance + * @returns {Object.} JSON object + */ + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodOptions + * @function getTypeUrl + * @memberof google.protobuf.MethodOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodOptions"; + }; + + /** + * IdempotencyLevel enum. + * @name google.protobuf.MethodOptions.IdempotencyLevel + * @enum {number} + * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value + * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value + * @property {number} IDEMPOTENT=2 IDEMPOTENT value + */ + MethodOptions.IdempotencyLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; + values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; + values[valuesById[2] = "IDEMPOTENT"] = 2; + return values; + })(); + + return MethodOptions; + })(); + + protobuf.UninterpretedOption = (function() { + + /** + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.|null} [name] UninterpretedOption name + * @property {string|null} [identifierValue] UninterpretedOption identifierValue + * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue + * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue + * @property {number|null} [doubleValue] UninterpretedOption doubleValue + * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue + * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue + */ + + /** + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + */ + function UninterpretedOption(properties) { + this.name = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.name = $util.emptyArray; + + /** + * UninterpretedOption identifierValue. + * @member {string} identifierValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.identifierValue = ""; + + /** + * UninterpretedOption positiveIntValue. + * @member {number|Long} positiveIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * UninterpretedOption negativeIntValue. + * @member {number|Long} negativeIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UninterpretedOption doubleValue. + * @member {number} doubleValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.doubleValue = 0; + + /** + * UninterpretedOption stringValue. + * @member {Uint8Array} stringValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + + /** + * UninterpretedOption aggregateValue. + * @member {string} aggregateValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregateValue = ""; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + */ + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); + }; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && message.name.length) + for (var i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 3: { + message.identifierValue = reader.string(); + break; + } + case 4: { + message.positiveIntValue = reader.uint64(); + break; + } + case 5: { + message.negativeIntValue = reader.int64(); + break; + } + case 6: { + message.doubleValue = reader.double(); + break; + } + case 7: { + message.stringValue = reader.bytes(); + break; + } + case 8: { + message.aggregateValue = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i], long + 1); + if (error) + return "name." + error; + } + } + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.UninterpretedOption: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (!$util.isObject(object.name[i])) + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i], long + 1); + } + } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue, true); + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue, false); + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length >= 0) + message.stringValue = object.stringValue; + if (object.aggregateValue != null) + message.aggregateValue = String(object.aggregateValue); + return message; + }; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UninterpretedOption.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.name = []; + if (options.defaults) { + object.identifierValue = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.positiveIntValue = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.negativeIntValue = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + object.doubleValue = 0; + if (options.bytes === String) + object.stringValue = ""; + else { + object.stringValue = []; + if (options.bytes !== Array) + object.stringValue = $util.newBuffer(object.stringValue); + } + object.aggregateValue = ""; + } + if (message.name && message.name.length) { + object.name = []; + for (var j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options, q + 1); + } + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + object.identifierValue = message.identifierValue; + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.positiveIntValue = typeof message.positiveIntValue === "number" ? BigInt(message.positiveIntValue) : $util.Long.fromBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0, true).toBigInt(); + else if (typeof message.positiveIntValue === "number") + object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; + else + object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.negativeIntValue = typeof message.negativeIntValue === "number" ? BigInt(message.negativeIntValue) : $util.Long.fromBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0, false).toBigInt(); + else if (typeof message.negativeIntValue === "number") + object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; + else + object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + object.aggregateValue = message.aggregateValue; + return object; + }; + + /** + * Converts this UninterpretedOption to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption + * @instance + * @returns {Object.} JSON object + */ + UninterpretedOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UninterpretedOption + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @implements INamePart + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * NamePart namePart. + * @member {string} namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; + + /** + * NamePart isExtension. + * @member {boolean} isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; + + /** + * Creates a new NamePart instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance + */ + NamePart.create = function create(properties) { + return new NamePart(properties); + }; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.namePart = reader.string(); + break; + } + case 2: { + message.isExtension = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + if (!Object.hasOwnProperty.call(message, "namePart")) + throw $util.ProtocolError("missing required 'namePart'", { instance: message }); + if (!Object.hasOwnProperty.call(message, "isExtension")) + throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (!$util.isString(message.namePart)) + return "namePart: string expected"; + if (typeof message.isExtension !== "boolean") + return "isExtension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.UninterpretedOption.NamePart: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.namePart != null) + message.namePart = String(object.namePart); + if (object.isExtension != null) + message.isExtension = Boolean(object.isExtension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.namePart = ""; + object.isExtension = false; + } + if (message.namePart != null && Object.hasOwnProperty.call(message, "namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && Object.hasOwnProperty.call(message, "isExtension")) + object.isExtension = message.isExtension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NamePart + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; + }; + + return NamePart; + })(); + + return UninterpretedOption; + })(); + + protobuf.FeatureSet = (function() { + + /** + * Properties of a FeatureSet. + * @memberof google.protobuf + * @interface IFeatureSet + * @property {google.protobuf.FeatureSet.FieldPresence|null} [fieldPresence] FeatureSet fieldPresence + * @property {google.protobuf.FeatureSet.EnumType|null} [enumType] FeatureSet enumType + * @property {google.protobuf.FeatureSet.RepeatedFieldEncoding|null} [repeatedFieldEncoding] FeatureSet repeatedFieldEncoding + * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation + * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding + * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility + */ + + /** + * Constructs a new FeatureSet. + * @memberof google.protobuf + * @classdesc Represents a FeatureSet. + * @implements IFeatureSet + * @constructor + * @param {google.protobuf.IFeatureSet=} [properties] Properties to set + */ + function FeatureSet(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSet fieldPresence. + * @member {google.protobuf.FeatureSet.FieldPresence} fieldPresence + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.fieldPresence = 0; + + /** + * FeatureSet enumType. + * @member {google.protobuf.FeatureSet.EnumType} enumType + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enumType = 0; + + /** + * FeatureSet repeatedFieldEncoding. + * @member {google.protobuf.FeatureSet.RepeatedFieldEncoding} repeatedFieldEncoding + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.repeatedFieldEncoding = 0; + + /** + * FeatureSet utf8Validation. + * @member {google.protobuf.FeatureSet.Utf8Validation} utf8Validation + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.utf8Validation = 0; + + /** + * FeatureSet messageEncoding. + * @member {google.protobuf.FeatureSet.MessageEncoding} messageEncoding + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.messageEncoding = 0; + + /** + * FeatureSet jsonFormat. + * @member {google.protobuf.FeatureSet.JsonFormat} jsonFormat + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.jsonFormat = 0; + + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + + /** + * Creates a new FeatureSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet} FeatureSet instance + */ + FeatureSet.create = function create(properties) { + return new FeatureSet(properties); + }; + + /** + * Encodes the specified FeatureSet message. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSet.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.fieldPresence); + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.enumType); + if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repeatedFieldEncoding); + if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.utf8Validation); + if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); + if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); + return writer; + }; + + /** + * Encodes the specified FeatureSet message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FeatureSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet} FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSet.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.fieldPresence = reader.int32(); + break; + } + case 2: { + message.enumType = reader.int32(); + break; + } + case 3: { + message.repeatedFieldEncoding = reader.int32(); + break; + } + case 4: { + message.utf8Validation = reader.int32(); + break; + } + case 5: { + message.messageEncoding = reader.int32(); + break; + } + case 6: { + message.jsonFormat = reader.int32(); + break; + } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet} FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSet message. + * @function verify + * @memberof google.protobuf.FeatureSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSet.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) + switch (message.fieldPresence) { + default: + return "fieldPresence: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) + switch (message.enumType) { + default: + return "enumType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) + switch (message.repeatedFieldEncoding) { + default: + return "repeatedFieldEncoding: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) + switch (message.utf8Validation) { + default: + return "utf8Validation: enum value expected"; + case 0: + case 2: + case 3: + break; + } + if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) + switch (message.messageEncoding) { + default: + return "messageEncoding: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) + switch (message.jsonFormat) { + default: + return "jsonFormat: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a FeatureSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet} FeatureSet + */ + FeatureSet.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FeatureSet) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FeatureSet: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FeatureSet(); + switch (object.fieldPresence) { + default: + if (typeof object.fieldPresence === "number") { + message.fieldPresence = object.fieldPresence; + break; + } + break; + case "FIELD_PRESENCE_UNKNOWN": + case 0: + message.fieldPresence = 0; + break; + case "EXPLICIT": + case 1: + message.fieldPresence = 1; + break; + case "IMPLICIT": + case 2: + message.fieldPresence = 2; + break; + case "LEGACY_REQUIRED": + case 3: + message.fieldPresence = 3; + break; + } + switch (object.enumType) { + default: + if (typeof object.enumType === "number") { + message.enumType = object.enumType; + break; + } + break; + case "ENUM_TYPE_UNKNOWN": + case 0: + message.enumType = 0; + break; + case "OPEN": + case 1: + message.enumType = 1; + break; + case "CLOSED": + case 2: + message.enumType = 2; + break; + } + switch (object.repeatedFieldEncoding) { + default: + if (typeof object.repeatedFieldEncoding === "number") { + message.repeatedFieldEncoding = object.repeatedFieldEncoding; + break; + } + break; + case "REPEATED_FIELD_ENCODING_UNKNOWN": + case 0: + message.repeatedFieldEncoding = 0; + break; + case "PACKED": + case 1: + message.repeatedFieldEncoding = 1; + break; + case "EXPANDED": + case 2: + message.repeatedFieldEncoding = 2; + break; + } + switch (object.utf8Validation) { + default: + if (typeof object.utf8Validation === "number") { + message.utf8Validation = object.utf8Validation; + break; + } + break; + case "UTF8_VALIDATION_UNKNOWN": + case 0: + message.utf8Validation = 0; + break; + case "VERIFY": + case 2: + message.utf8Validation = 2; + break; + case "NONE": + case 3: + message.utf8Validation = 3; + break; + } + switch (object.messageEncoding) { + default: + if (typeof object.messageEncoding === "number") { + message.messageEncoding = object.messageEncoding; + break; + } + break; + case "MESSAGE_ENCODING_UNKNOWN": + case 0: + message.messageEncoding = 0; + break; + case "LENGTH_PREFIXED": + case 1: + message.messageEncoding = 1; + break; + case "DELIMITED": + case 2: + message.messageEncoding = 2; + break; + } + switch (object.jsonFormat) { + default: + if (typeof object.jsonFormat === "number") { + message.jsonFormat = object.jsonFormat; + break; + } + break; + case "JSON_FORMAT_UNKNOWN": + case 0: + message.jsonFormat = 0; + break; + case "ALLOW": + case 1: + message.jsonFormat = 1; + break; + case "LEGACY_BEST_EFFORT": + case 2: + message.jsonFormat = 2; + break; + } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.FeatureSet} message FeatureSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSet.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.fieldPresence = options.enums === String ? "FIELD_PRESENCE_UNKNOWN" : 0; + object.enumType = options.enums === String ? "ENUM_TYPE_UNKNOWN" : 0; + object.repeatedFieldEncoding = options.enums === String ? "REPEATED_FIELD_ENCODING_UNKNOWN" : 0; + object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; + object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; + object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; + } + if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) + object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) + object.enumType = options.enums === String ? $root.google.protobuf.FeatureSet.EnumType[message.enumType] === undefined ? message.enumType : $root.google.protobuf.FeatureSet.EnumType[message.enumType] : message.enumType; + if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) + object.repeatedFieldEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] === undefined ? message.repeatedFieldEncoding : $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] : message.repeatedFieldEncoding; + if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) + object.utf8Validation = options.enums === String ? $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] === undefined ? message.utf8Validation : $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] : message.utf8Validation; + if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) + object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; + if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) + object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; + return object; + }; + + /** + * Converts this FeatureSet to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet + * @instance + * @returns {Object.} JSON object + */ + FeatureSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSet + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet"; + }; + + /** + * FieldPresence enum. + * @name google.protobuf.FeatureSet.FieldPresence + * @enum {number} + * @property {number} FIELD_PRESENCE_UNKNOWN=0 FIELD_PRESENCE_UNKNOWN value + * @property {number} EXPLICIT=1 EXPLICIT value + * @property {number} IMPLICIT=2 IMPLICIT value + * @property {number} LEGACY_REQUIRED=3 LEGACY_REQUIRED value + */ + FeatureSet.FieldPresence = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_PRESENCE_UNKNOWN"] = 0; + values[valuesById[1] = "EXPLICIT"] = 1; + values[valuesById[2] = "IMPLICIT"] = 2; + values[valuesById[3] = "LEGACY_REQUIRED"] = 3; + return values; + })(); + + /** + * EnumType enum. + * @name google.protobuf.FeatureSet.EnumType + * @enum {number} + * @property {number} ENUM_TYPE_UNKNOWN=0 ENUM_TYPE_UNKNOWN value + * @property {number} OPEN=1 OPEN value + * @property {number} CLOSED=2 CLOSED value + */ + FeatureSet.EnumType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENUM_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "OPEN"] = 1; + values[valuesById[2] = "CLOSED"] = 2; + return values; + })(); + + /** + * RepeatedFieldEncoding enum. + * @name google.protobuf.FeatureSet.RepeatedFieldEncoding + * @enum {number} + * @property {number} REPEATED_FIELD_ENCODING_UNKNOWN=0 REPEATED_FIELD_ENCODING_UNKNOWN value + * @property {number} PACKED=1 PACKED value + * @property {number} EXPANDED=2 EXPANDED value + */ + FeatureSet.RepeatedFieldEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REPEATED_FIELD_ENCODING_UNKNOWN"] = 0; + values[valuesById[1] = "PACKED"] = 1; + values[valuesById[2] = "EXPANDED"] = 2; + return values; + })(); + + /** + * Utf8Validation enum. + * @name google.protobuf.FeatureSet.Utf8Validation + * @enum {number} + * @property {number} UTF8_VALIDATION_UNKNOWN=0 UTF8_VALIDATION_UNKNOWN value + * @property {number} VERIFY=2 VERIFY value + * @property {number} NONE=3 NONE value + */ + FeatureSet.Utf8Validation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UTF8_VALIDATION_UNKNOWN"] = 0; + values[valuesById[2] = "VERIFY"] = 2; + values[valuesById[3] = "NONE"] = 3; + return values; + })(); + + /** + * MessageEncoding enum. + * @name google.protobuf.FeatureSet.MessageEncoding + * @enum {number} + * @property {number} MESSAGE_ENCODING_UNKNOWN=0 MESSAGE_ENCODING_UNKNOWN value + * @property {number} LENGTH_PREFIXED=1 LENGTH_PREFIXED value + * @property {number} DELIMITED=2 DELIMITED value + */ + FeatureSet.MessageEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_ENCODING_UNKNOWN"] = 0; + values[valuesById[1] = "LENGTH_PREFIXED"] = 1; + values[valuesById[2] = "DELIMITED"] = 2; + return values; + })(); + + /** + * JsonFormat enum. + * @name google.protobuf.FeatureSet.JsonFormat + * @enum {number} + * @property {number} JSON_FORMAT_UNKNOWN=0 JSON_FORMAT_UNKNOWN value + * @property {number} ALLOW=1 ALLOW value + * @property {number} LEGACY_BEST_EFFORT=2 LEGACY_BEST_EFFORT value + */ + FeatureSet.JsonFormat = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JSON_FORMAT_UNKNOWN"] = 0; + values[valuesById[1] = "ALLOW"] = 1; + values[valuesById[2] = "LEGACY_BEST_EFFORT"] = 2; + return values; + })(); + + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + + return FeatureSet; + })(); + + protobuf.FeatureSetDefaults = (function() { + + /** + * Properties of a FeatureSetDefaults. + * @memberof google.protobuf + * @interface IFeatureSetDefaults + * @property {Array.|null} [defaults] FeatureSetDefaults defaults + * @property {google.protobuf.Edition|null} [minimumEdition] FeatureSetDefaults minimumEdition + * @property {google.protobuf.Edition|null} [maximumEdition] FeatureSetDefaults maximumEdition + */ + + /** + * Constructs a new FeatureSetDefaults. + * @memberof google.protobuf + * @classdesc Represents a FeatureSetDefaults. + * @implements IFeatureSetDefaults + * @constructor + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + */ + function FeatureSetDefaults(properties) { + this.defaults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSetDefaults defaults. + * @member {Array.} defaults + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.defaults = $util.emptyArray; + + /** + * FeatureSetDefaults minimumEdition. + * @member {google.protobuf.Edition} minimumEdition + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.minimumEdition = 0; + + /** + * FeatureSetDefaults maximumEdition. + * @member {google.protobuf.Edition} maximumEdition + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.maximumEdition = 0; + + /** + * Creates a new FeatureSetDefaults instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults instance + */ + FeatureSetDefaults.create = function create(properties) { + return new FeatureSetDefaults(properties); + }; + + /** + * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetDefaults.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.defaults != null && message.defaults.length) + for (var i = 0; i < message.defaults.length; ++i) + $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.encode(message.defaults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minimumEdition); + if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maximumEdition); + return writer; + }; + + /** + * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetDefaults.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetDefaults.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.defaults && message.defaults.length)) + message.defaults = []; + message.defaults.push($root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 4: { + message.minimumEdition = reader.int32(); + break; + } + case 5: { + message.maximumEdition = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetDefaults.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSetDefaults message. + * @function verify + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSetDefaults.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.defaults != null && Object.hasOwnProperty.call(message, "defaults")) { + if (!Array.isArray(message.defaults)) + return "defaults: array expected"; + for (var i = 0; i < message.defaults.length; ++i) { + var error = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify(message.defaults[i], long + 1); + if (error) + return "defaults." + error; + } + } + if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) + switch (message.minimumEdition) { + default: + return "minimumEdition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) + switch (message.maximumEdition) { + default: + return "maximumEdition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + */ + FeatureSetDefaults.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FeatureSetDefaults: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FeatureSetDefaults(); + if (object.defaults) { + if (!Array.isArray(object.defaults)) + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: array expected"); + message.defaults = []; + for (var i = 0; i < object.defaults.length; ++i) { + if (!$util.isObject(object.defaults[i])) + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: object expected"); + message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i], long + 1); + } + } + switch (object.minimumEdition) { + default: + if (typeof object.minimumEdition === "number") { + message.minimumEdition = object.minimumEdition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.minimumEdition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.minimumEdition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.minimumEdition = 999; + break; + case "EDITION_2023": + case 1000: + message.minimumEdition = 1000; + break; + case "EDITION_2024": + case 1001: + message.minimumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.minimumEdition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.minimumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.minimumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.minimumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.minimumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.minimumEdition = 2147483647; + break; + } + switch (object.maximumEdition) { + default: + if (typeof object.maximumEdition === "number") { + message.maximumEdition = object.maximumEdition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.maximumEdition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.maximumEdition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.maximumEdition = 999; + break; + case "EDITION_2023": + case 1000: + message.maximumEdition = 1000; + break; + case "EDITION_2024": + case 1001: + message.maximumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.maximumEdition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.maximumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.maximumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.maximumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.maximumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.maximumEdition = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.FeatureSetDefaults} message FeatureSetDefaults + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSetDefaults.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.defaults = []; + if (options.defaults) { + object.minimumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.maximumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.defaults && message.defaults.length) { + object.defaults = []; + for (var j = 0; j < message.defaults.length; ++j) + object.defaults[j] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.toObject(message.defaults[j], options, q + 1); + } + if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) + object.minimumEdition = options.enums === String ? $root.google.protobuf.Edition[message.minimumEdition] === undefined ? message.minimumEdition : $root.google.protobuf.Edition[message.minimumEdition] : message.minimumEdition; + if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) + object.maximumEdition = options.enums === String ? $root.google.protobuf.Edition[message.maximumEdition] === undefined ? message.maximumEdition : $root.google.protobuf.Edition[message.maximumEdition] : message.maximumEdition; + return object; + }; + + /** + * Converts this FeatureSetDefaults to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSetDefaults + * @instance + * @returns {Object.} JSON object + */ + FeatureSetDefaults.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSetDefaults + * @function getTypeUrl + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSetDefaults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults"; + }; + + FeatureSetDefaults.FeatureSetEditionDefault = (function() { + + /** + * Properties of a FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @interface IFeatureSetEditionDefault + * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures + */ + + /** + * Constructs a new FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @classdesc Represents a FeatureSetEditionDefault. + * @implements IFeatureSetEditionDefault + * @constructor + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set + */ + function FeatureSetEditionDefault(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSetEditionDefault edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.edition = 0; + + /** + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.fixedFeatures = null; + + /** + * Creates a new FeatureSetEditionDefault instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault instance + */ + FeatureSetEditionDefault.create = function create(properties) { + return new FeatureSetEditionDefault(properties); + }; + + /** + * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetEditionDefault.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetEditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetEditionDefault.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetEditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSetEditionDefault message. + * @function verify + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSetEditionDefault.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures, long + 1); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures, long + 1); + if (error) + return "fixedFeatures." + error; + } + return null; + }; + + /** + * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + */ + FeatureSetEditionDefault.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.overridableFeatures != null) { + if (!$util.isObject(object.overridableFeatures)) + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures, long + 1); + } + if (object.fixedFeatures != null) { + if (!$util.isObject(object.fixedFeatures)) + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} message FeatureSetEditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSetEditionDefault.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; + } + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options, q + 1); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options, q + 1); + return object; + }; + + /** + * Converts this FeatureSetEditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + * @returns {Object.} JSON object + */ + FeatureSetEditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSetEditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSetEditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"; + }; + + return FeatureSetEditionDefault; + })(); + + return FeatureSetDefaults; + })(); + + protobuf.SourceCodeInfo = (function() { + + /** + * Properties of a SourceCodeInfo. + * @memberof google.protobuf + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location + */ + + /** + * Constructs a new SourceCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo + * @constructor + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + */ + function SourceCodeInfo(properties) { + this.location = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo + * @instance + */ + SourceCodeInfo.prototype.location = $util.emptyArray; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + */ + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); + }; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceCodeInfo message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceCodeInfo.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.location != null && Object.hasOwnProperty.call(message, "location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i], long + 1); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + */ + SourceCodeInfo.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.SourceCodeInfo: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (!$util.isObject(object.location[i])) + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options, q + 1); + } + return object; + }; + + /** + * Converts this SourceCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo + * @instance + * @returns {Object.} JSON object + */ + SourceCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SourceCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; + }; + + SourceCodeInfo.Location = (function() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leadingComments] Location leadingComments + * @property {string|null} [trailingComments] Location trailingComments + * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leadingComments. + * @member {string} leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; + + /** + * Location trailingComments. + * @member {string} trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; + + /** + * Location leadingDetachedComments. + * @member {Array.} leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + } + case 3: { + message.leadingComments = reader.string(); + break; + } + case 4: { + message.trailingComments = reader.string(); + break; + } + case 6: { + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.path != null && Object.hasOwnProperty.call(message, "path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && Object.hasOwnProperty.call(message, "span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && Object.hasOwnProperty.call(message, "leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; + } + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Location + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; + }; + + return Location; + })(); + + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { + + /** + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + */ + + /** + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + */ + function GeneratedCodeInfo(properties) { + this.annotation = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + */ + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + */ + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); + }; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.annotation != null && message.annotation.length) + for (var i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratedCodeInfo message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratedCodeInfo.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.annotation != null && Object.hasOwnProperty.call(message, "annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (var i = 0; i < message.annotation.length; ++i) { + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i], long + 1); + if (error) + return "annotation." + error; + } + } + return null; + }; + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + */ + GeneratedCodeInfo.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.GeneratedCodeInfo: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (var i = 0; i < object.annotation.length; ++i) { + if (!$util.isObject(object.annotation[i])) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratedCodeInfo.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (var j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options, q + 1); + } + return object; + }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + * @returns {Object.} JSON object + */ + GeneratedCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; + }; + + GeneratedCodeInfo.Annotation = (function() { + + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.|null} [path] Annotation path + * @property {string|null} [sourceFile] Annotation sourceFile + * @property {number|null} [begin] Annotation begin + * @property {number|null} [end] Annotation end + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic + */ + + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @implements IAnnotation + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Annotation path. + * @member {Array.} path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; + + /** + * Annotation sourceFile. + * @member {string} sourceFile + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.sourceFile = ""; + + /** + * Annotation begin. + * @member {number} begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; + + /** + * Annotation end. + * @member {number} end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; + + /** + * Annotation semantic. + * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.semantic = 0; + + /** + * Creates a new Annotation instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance + */ + Annotation.create = function create(properties) { + return new Annotation(properties); + }; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); + return writer; + }; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + message.sourceFile = reader.string(); + break; + } + case 3: { + message.begin = reader.int32(); + break; + } + case 4: { + message.end = reader.int32(); + break; + } + case 5: { + message.semantic = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.path != null && Object.hasOwnProperty.call(message, "path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) + if (!$util.isString(message.sourceFile)) + return "sourceFile: string expected"; + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + switch (message.semantic) { + default: + return "semantic: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.sourceFile != null) + message.sourceFile = String(object.sourceFile); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; + break; + } + break; + case "NONE": + case 0: + message.semantic = 0; + break; + case "SET": + case 1: + message.semantic = 1; + break; + case "ALIAS": + case 2: + message.semantic = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.sourceFile = ""; + object.begin = 0; + object.end = 0; + object.semantic = options.enums === String ? "NONE" : 0; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) + object.sourceFile = message.sourceFile; + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + object.begin = message.begin; + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + object.end = message.end; + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; + return object; + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Annotation + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; + }; + + /** + * Semantic enum. + * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} SET=1 SET value + * @property {number} ALIAS=2 ALIAS value + */ + Annotation.Semantic = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "SET"] = 1; + values[valuesById[2] = "ALIAS"] = 2; + return values; + })(); + + return Annotation; + })(); + + return GeneratedCodeInfo; + })(); + + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + + protobuf.Timestamp = (function() { + + /** + * Properties of a Timestamp. + * @memberof google.protobuf + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos + */ + + /** + * Constructs a new Timestamp. + * @memberof google.protobuf + * @classdesc Represents a Timestamp. + * @implements ITimestamp + * @constructor + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + */ + function Timestamp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Creates a new Timestamp instance using the specified properties. + * @function create + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance + */ + Timestamp.create = function create(properties) { + return new Timestamp(properties); + }; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Timestamp.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.Timestamp) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Timestamp: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + message.seconds = $util.Long.fromValue(object.seconds, false); + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.seconds = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + object.nanos = 0; + } + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.seconds = typeof message.seconds === "number" ? BigInt(message.seconds) : $util.Long.fromBits(message.seconds.low >>> 0, message.seconds.high >>> 0, false).toBigInt(); + else if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Timestamp + * @function getTypeUrl + * @memberof google.protobuf.Timestamp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Timestamp"; + }; + + return Timestamp; + })(); + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @implements IDuration + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. + * @function create + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance + */ + Duration.create = function create(properties) { + return new Duration(properties); + }; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.Duration) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Duration: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + message.seconds = $util.Long.fromValue(object.seconds, false); + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.seconds = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + object.nanos = 0; + } + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.seconds = typeof message.seconds === "number" ? BigInt(message.seconds) : $util.Long.fromBits(message.seconds.low >>> 0, message.seconds.high >>> 0, false).toBigInt(); + else if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Duration + * @function getTypeUrl + * @memberof google.protobuf.Duration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Duration"; + }; + + return Duration; + })(); + + protobuf.Any = (function() { + + /** + * Properties of an Any. + * @memberof google.protobuf + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value + */ + + /** + * Constructs a new Any. + * @memberof google.protobuf + * @classdesc Represents an Any. + * @implements IAny + * @constructor + * @param {google.protobuf.IAny=} [properties] Properties to set + */ + function Any(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.type_url = ""; + + /** + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.value = $util.newBuffer([]); + + /** + * Creates a new Any instance using the specified properties. + * @function create + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance + */ + Any.create = function create(properties) { + return new Any(properties); + }; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type_url = reader.string(); + break; + } + case 2: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.Any) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Any: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.Any} message Any + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Any.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + object.type_url = message.type_url; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Any to JSON. + * @function toJSON + * @memberof google.protobuf.Any + * @instance + * @returns {Object.} JSON object + */ + Any.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Any + * @function getTypeUrl + * @memberof google.protobuf.Any + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Any"; + }; + + return Any; + })(); + + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + + return Empty; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.paths != null && Object.hasOwnProperty.call(message, "paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldMask: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldMask + * @function getTypeUrl + * @memberof google.protobuf.FieldMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldMask"; + }; + + return FieldMask; + })(); + + protobuf.Struct = (function() { + + /** + * Properties of a Struct. + * @memberof google.protobuf + * @interface IStruct + * @property {Object.|null} [fields] Struct fields + */ + + /** + * Constructs a new Struct. + * @memberof google.protobuf + * @classdesc Represents a Struct. + * @implements IStruct + * @constructor + * @param {google.protobuf.IStruct=} [properties] Properties to set + */ + function Struct(properties) { + this.fields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Struct fields. + * @member {Object.} fields + * @memberof google.protobuf.Struct + * @instance + */ + Struct.prototype.fields = $util.emptyObject; + + /** + * Creates a new Struct instance using the specified properties. + * @function create + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct=} [properties] Properties to set + * @returns {google.protobuf.Struct} Struct instance + */ + Struct.create = function create(properties) { + return new Struct(properties); + }; + + /** + * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) + for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Struct message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Struct(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32(), undefined, long + 1); + break; + default: + reader.skipType(tag2 & 7, long); + break; + } + } + if (key === "__proto__") + $util.makeProp(message.fields, key); + message.fields[key] = value; + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Struct message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Struct message. + * @function verify + * @memberof google.protobuf.Struct + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Struct.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { + if (!$util.isObject(message.fields)) + return "fields: object expected"; + var key = Object.keys(message.fields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.fields[key[i]], long + 1); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a Struct message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Struct + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Struct} Struct + */ + Struct.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.Struct) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Struct: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.Struct(); + if (object.fields) { + if (!$util.isObject(object.fields)) + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields = {}; + for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.fields, keys[i]); + if (!$util.isObject(object.fields[keys[i]])) + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a Struct message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.Struct} message Struct + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Struct.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.objects || options.defaults) + object.fields = {}; + var keys2; + if (message.fields && (keys2 = Object.keys(message.fields)).length) { + object.fields = {}; + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.fields, keys2[j]); + object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options, q + 1); + } + } + return object; + }; + + /** + * Converts this Struct to JSON. + * @function toJSON + * @memberof google.protobuf.Struct + * @instance + * @returns {Object.} JSON object + */ + Struct.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Struct + * @function getTypeUrl + * @memberof google.protobuf.Struct + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Struct.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Struct"; + }; + + return Struct; + })(); + + protobuf.Value = (function() { + + /** + * Properties of a Value. + * @memberof google.protobuf + * @interface IValue + * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue + * @property {number|null} [numberValue] Value numberValue + * @property {string|null} [stringValue] Value stringValue + * @property {boolean|null} [boolValue] Value boolValue + * @property {google.protobuf.IStruct|null} [structValue] Value structValue + * @property {google.protobuf.IListValue|null} [listValue] Value listValue + */ + + /** + * Constructs a new Value. + * @memberof google.protobuf + * @classdesc Represents a Value. + * @implements IValue + * @constructor + * @param {google.protobuf.IValue=} [properties] Properties to set + */ + function Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Value nullValue. + * @member {google.protobuf.NullValue|null|undefined} nullValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.nullValue = null; + + /** + * Value numberValue. + * @member {number|null|undefined} numberValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.numberValue = null; + + /** + * Value stringValue. + * @member {string|null|undefined} stringValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.stringValue = null; + + /** + * Value boolValue. + * @member {boolean|null|undefined} boolValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.boolValue = null; + + /** + * Value structValue. + * @member {google.protobuf.IStruct|null|undefined} structValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.structValue = null; + + /** + * Value listValue. + * @member {google.protobuf.IListValue|null|undefined} listValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.listValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Value kind. + * @member {"nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"|undefined} kind + * @memberof google.protobuf.Value + * @instance + */ + Object.defineProperty(Value.prototype, "kind", { + get: $util.oneOfGetter($oneOfFields = ["nullValue", "numberValue", "stringValue", "boolValue", "structValue", "listValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue=} [properties] Properties to set + * @returns {google.protobuf.Value} Value instance + */ + Value.create = function create(properties) { + return new Value(properties); + }; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nullValue); + if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.numberValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.stringValue); + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.boolValue); + if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) + $root.google.protobuf.Struct.encode(message.structValue, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) + $root.google.protobuf.ListValue.encode(message.listValue, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.nullValue = reader.int32(); + break; + } + case 2: { + message.numberValue = reader.double(); + break; + } + case 3: { + message.stringValue = reader.string(); + break; + } + case 4: { + message.boolValue = reader.bool(); + break; + } + case 5: { + message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 6: { + message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Value message. + * @function verify + * @memberof google.protobuf.Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Value.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) { + properties.kind = 1; + switch (message.nullValue) { + default: + return "nullValue: enum value expected"; + case 0: + break; + } + } + if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.numberValue !== "number") + return "numberValue: number expected"; + } + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (!$util.isString(message.stringValue)) + return "stringValue: string expected"; + } + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.boolValue !== "boolean") + return "boolValue: boolean expected"; + } + if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.Struct.verify(message.structValue, long + 1); + if (error) + return "structValue." + error; + } + } + if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.ListValue.verify(message.listValue, long + 1); + if (error) + return "listValue." + error; + } + } + return null; + }; + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Value} Value + */ + Value.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.Value) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Value: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.Value(); + switch (object.nullValue) { + default: + if (typeof object.nullValue === "number") { + message.nullValue = object.nullValue; + break; + } + break; + case "NULL_VALUE": + case 0: + message.nullValue = 0; + break; + } + if (object.numberValue != null) + message.numberValue = Number(object.numberValue); + if (object.stringValue != null) + message.stringValue = String(object.stringValue); + if (object.boolValue != null) + message.boolValue = Boolean(object.boolValue); + if (object.structValue != null) { + if (!$util.isObject(object.structValue)) + throw TypeError(".google.protobuf.Value.structValue: object expected"); + message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue, long + 1); + } + if (object.listValue != null) { + if (!$util.isObject(object.listValue)) + throw TypeError(".google.protobuf.Value.listValue: object expected"); + message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.Value} message Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Value.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) { + object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; + if (options.oneofs) + object.kind = "nullValue"; + } + if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) { + object.numberValue = options.json && !isFinite(message.numberValue) ? String(message.numberValue) : message.numberValue; + if (options.oneofs) + object.kind = "numberValue"; + } + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) { + object.stringValue = message.stringValue; + if (options.oneofs) + object.kind = "stringValue"; + } + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) { + object.boolValue = message.boolValue; + if (options.oneofs) + object.kind = "boolValue"; + } + if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) { + object.structValue = $root.google.protobuf.Struct.toObject(message.structValue, options, q + 1); + if (options.oneofs) + object.kind = "structValue"; + } + if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) { + object.listValue = $root.google.protobuf.ListValue.toObject(message.listValue, options, q + 1); + if (options.oneofs) + object.kind = "listValue"; + } + return object; + }; + + /** + * Converts this Value to JSON. + * @function toJSON + * @memberof google.protobuf.Value + * @instance + * @returns {Object.} JSON object + */ + Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Value + * @function getTypeUrl + * @memberof google.protobuf.Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Value"; + }; + + return Value; + })(); + + /** + * NullValue enum. + * @name google.protobuf.NullValue + * @enum {number} + * @property {number} NULL_VALUE=0 NULL_VALUE value + */ + protobuf.NullValue = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NULL_VALUE"] = 0; + return values; + })(); + + protobuf.ListValue = (function() { + + /** + * Properties of a ListValue. + * @memberof google.protobuf + * @interface IListValue + * @property {Array.|null} [values] ListValue values + */ + + /** + * Constructs a new ListValue. + * @memberof google.protobuf + * @classdesc Represents a ListValue. + * @implements IListValue + * @constructor + * @param {google.protobuf.IListValue=} [properties] Properties to set + */ + function ListValue(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListValue values. + * @member {Array.} values + * @memberof google.protobuf.ListValue + * @instance + */ + ListValue.prototype.values = $util.emptyArray; + + /** + * Creates a new ListValue instance using the specified properties. + * @function create + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue=} [properties] Properties to set + * @returns {google.protobuf.ListValue} ListValue instance + */ + ListValue.create = function create(properties) { + return new ListValue(properties); + }; + + /** + * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.protobuf.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ListValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListValue message. + * @function verify + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.values != null && Object.hasOwnProperty.call(message, "values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.values[i], long + 1); + if (error) + return "values." + error; + } + } + return null; + }; + + /** + * Creates a ListValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ListValue} ListValue + */ + ListValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.ListValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ListValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.ListValue(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.protobuf.ListValue.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (!$util.isObject(object.values[i])) + throw TypeError(".google.protobuf.ListValue.values: object expected"); + message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a ListValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.ListValue} message ListValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.protobuf.Value.toObject(message.values[j], options, q + 1); + } + return object; + }; + + /** + * Converts this ListValue to JSON. + * @function toJSON + * @memberof google.protobuf.ListValue + * @instance + * @returns {Object.} JSON object + */ + ListValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListValue + * @function getTypeUrl + * @memberof google.protobuf.ListValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ListValue"; + }; + + return ListValue; + })(); + + protobuf.DoubleValue = (function() { + + /** + * Properties of a DoubleValue. + * @memberof google.protobuf + * @interface IDoubleValue + * @property {number|null} [value] DoubleValue value + */ + + /** + * Constructs a new DoubleValue. + * @memberof google.protobuf + * @classdesc Represents a DoubleValue. + * @implements IDoubleValue + * @constructor + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + */ + function DoubleValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DoubleValue value. + * @member {number} value + * @memberof google.protobuf.DoubleValue + * @instance + */ + DoubleValue.prototype.value = 0; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @function create + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + * @returns {google.protobuf.DoubleValue} DoubleValue instance + */ + DoubleValue.create = function create(properties) { + return new DoubleValue(properties); + }; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); + return writer; + }; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DoubleValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.double(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DoubleValue message. + * @function verify + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoubleValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DoubleValue} DoubleValue + */ + DoubleValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.DoubleValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.DoubleValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.DoubleValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.DoubleValue} message DoubleValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoubleValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this DoubleValue to JSON. + * @function toJSON + * @memberof google.protobuf.DoubleValue + * @instance + * @returns {Object.} JSON object + */ + DoubleValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DoubleValue + * @function getTypeUrl + * @memberof google.protobuf.DoubleValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DoubleValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DoubleValue"; + }; + + return DoubleValue; + })(); + + protobuf.FloatValue = (function() { + + /** + * Properties of a FloatValue. + * @memberof google.protobuf + * @interface IFloatValue + * @property {number|null} [value] FloatValue value + */ + + /** + * Constructs a new FloatValue. + * @memberof google.protobuf + * @classdesc Represents a FloatValue. + * @implements IFloatValue + * @constructor + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + */ + function FloatValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * FloatValue value. + * @member {number} value + * @memberof google.protobuf.FloatValue + * @instance + */ + FloatValue.prototype.value = 0; + + /** + * Creates a new FloatValue instance using the specified properties. + * @function create + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + * @returns {google.protobuf.FloatValue} FloatValue instance + */ + FloatValue.create = function create(properties) { + return new FloatValue(properties); + }; + + /** + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); + return writer; + }; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FloatValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.float(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FloatValue message. + * @function verify + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FloatValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FloatValue} FloatValue + */ + FloatValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.FloatValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FloatValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.FloatValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.FloatValue} message FloatValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FloatValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this FloatValue to JSON. + * @function toJSON + * @memberof google.protobuf.FloatValue + * @instance + * @returns {Object.} JSON object + */ + FloatValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FloatValue + * @function getTypeUrl + * @memberof google.protobuf.FloatValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FloatValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FloatValue"; + }; + + return FloatValue; + })(); + + protobuf.Int64Value = (function() { + + /** + * Properties of an Int64Value. + * @memberof google.protobuf + * @interface IInt64Value + * @property {number|Long|null} [value] Int64Value value + */ + + /** + * Constructs a new Int64Value. + * @memberof google.protobuf + * @classdesc Represents an Int64Value. + * @implements IInt64Value + * @constructor + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + */ + function Int64Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Int64Value value. + * @member {number|Long} value + * @memberof google.protobuf.Int64Value + * @instance + */ + Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Int64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + * @returns {google.protobuf.Int64Value} Int64Value instance + */ + Int64Value.create = function create(properties) { + return new Int64Value(properties); + }; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); + return writer; + }; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.int64(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int64Value message. + * @function verify + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int64Value.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int64Value} Int64Value + */ + Int64Value.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.Int64Value) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Int64Value: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.Int64Value(); + if (object.value != null) + if ($util.Long) + message.value = $util.Long.fromValue(object.value, false); + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.Int64Value} message Int64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int64Value.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.value = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.value = typeof message.value === "number" ? BigInt(message.value) : $util.Long.fromBits(message.value.low >>> 0, message.value.high >>> 0, false).toBigInt(); + else if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; + return object; + }; + + /** + * Converts this Int64Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int64Value + * @instance + * @returns {Object.} JSON object + */ + Int64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Int64Value + * @function getTypeUrl + * @memberof google.protobuf.Int64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int64Value"; + }; + + return Int64Value; + })(); + + protobuf.UInt64Value = (function() { + + /** + * Properties of a UInt64Value. + * @memberof google.protobuf + * @interface IUInt64Value + * @property {number|Long|null} [value] UInt64Value value + */ + + /** + * Constructs a new UInt64Value. + * @memberof google.protobuf + * @classdesc Represents a UInt64Value. + * @implements IUInt64Value + * @constructor + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + */ + function UInt64Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UInt64Value value. + * @member {number|Long} value + * @memberof google.protobuf.UInt64Value + * @instance + */ + UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new UInt64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + * @returns {google.protobuf.UInt64Value} UInt64Value instance + */ + UInt64Value.create = function create(properties) { + return new UInt64Value(properties); + }; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); + return writer; + }; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.uint64(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt64Value message. + * @function verify + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt64Value.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt64Value} UInt64Value + */ + UInt64Value.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.UInt64Value) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.UInt64Value: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.UInt64Value(); + if (object.value != null) + if ($util.Long) + message.value = $util.Long.fromValue(object.value, true); + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.UInt64Value} message UInt64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt64Value.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; + } else + object.value = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.value = typeof message.value === "number" ? BigInt(message.value) : $util.Long.fromBits(message.value.low >>> 0, message.value.high >>> 0, true).toBigInt(); + else if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber(true) : message.value; + return object; + }; + + /** + * Converts this UInt64Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt64Value + * @instance + * @returns {Object.} JSON object + */ + UInt64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UInt64Value + * @function getTypeUrl + * @memberof google.protobuf.UInt64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt64Value"; + }; + + return UInt64Value; + })(); + + protobuf.Int32Value = (function() { + + /** + * Properties of an Int32Value. + * @memberof google.protobuf + * @interface IInt32Value + * @property {number|null} [value] Int32Value value + */ + + /** + * Constructs a new Int32Value. + * @memberof google.protobuf + * @classdesc Represents an Int32Value. + * @implements IInt32Value + * @constructor + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + */ + function Int32Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Int32Value value. + * @member {number} value + * @memberof google.protobuf.Int32Value + * @instance + */ + Int32Value.prototype.value = 0; + + /** + * Creates a new Int32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + * @returns {google.protobuf.Int32Value} Int32Value instance + */ + Int32Value.create = function create(properties) { + return new Int32Value(properties); + }; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value); + return writer; + }; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.int32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int32Value message. + * @function verify + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int32Value.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int32Value} Int32Value + */ + Int32Value.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.Int32Value) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Int32Value: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.Int32Value(); + if (object.value != null) + message.value = object.value | 0; + return message; + }; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.Int32Value} message Int32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int32Value.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = message.value; + return object; + }; + + /** + * Converts this Int32Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int32Value + * @instance + * @returns {Object.} JSON object + */ + Int32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Int32Value + * @function getTypeUrl + * @memberof google.protobuf.Int32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int32Value"; + }; + + return Int32Value; + })(); + + protobuf.UInt32Value = (function() { + + /** + * Properties of a UInt32Value. + * @memberof google.protobuf + * @interface IUInt32Value + * @property {number|null} [value] UInt32Value value + */ + + /** + * Constructs a new UInt32Value. + * @memberof google.protobuf + * @classdesc Represents a UInt32Value. + * @implements IUInt32Value + * @constructor + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + */ + function UInt32Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * UInt32Value value. + * @member {number} value + * @memberof google.protobuf.UInt32Value + * @instance + */ + UInt32Value.prototype.value = 0; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + * @returns {google.protobuf.UInt32Value} UInt32Value instance + */ + UInt32Value.create = function create(properties) { + return new UInt32Value(properties); + }; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); + return writer; + }; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt32Value message. + * @function verify + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt32Value.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt32Value} UInt32Value + */ + UInt32Value.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.UInt32Value) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.UInt32Value: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.UInt32Value(); + if (object.value != null) + message.value = object.value >>> 0; + return message; + }; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.UInt32Value} message UInt32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt32Value.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = message.value; + return object; + }; + + /** + * Converts this UInt32Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt32Value + * @instance + * @returns {Object.} JSON object + */ + UInt32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UInt32Value + * @function getTypeUrl + * @memberof google.protobuf.UInt32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt32Value"; + }; + + return UInt32Value; + })(); + + protobuf.BoolValue = (function() { + + /** + * Properties of a BoolValue. + * @memberof google.protobuf + * @interface IBoolValue + * @property {boolean|null} [value] BoolValue value + */ + + /** + * Constructs a new BoolValue. + * @memberof google.protobuf + * @classdesc Represents a BoolValue. + * @implements IBoolValue + * @constructor + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + */ + function BoolValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoolValue value. + * @member {boolean} value + * @memberof google.protobuf.BoolValue + * @instance + */ + BoolValue.prototype.value = false; + + /** + * Creates a new BoolValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + * @returns {google.protobuf.BoolValue} BoolValue instance + */ + BoolValue.create = function create(properties) { + return new BoolValue(properties); + }; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); + return writer; + }; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BoolValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.bool(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoolValue message. + * @function verify + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoolValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (typeof message.value !== "boolean") + return "value: boolean expected"; + return null; + }; + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BoolValue} BoolValue + */ + BoolValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.BoolValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.BoolValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.BoolValue(); + if (object.value != null) + message.value = Boolean(object.value); + return message; + }; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.BoolValue} message BoolValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoolValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.value = false; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = message.value; + return object; + }; + + /** + * Converts this BoolValue to JSON. + * @function toJSON + * @memberof google.protobuf.BoolValue + * @instance + * @returns {Object.} JSON object + */ + BoolValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BoolValue + * @function getTypeUrl + * @memberof google.protobuf.BoolValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoolValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BoolValue"; + }; + + return BoolValue; + })(); + + protobuf.StringValue = (function() { + + /** + * Properties of a StringValue. + * @memberof google.protobuf + * @interface IStringValue + * @property {string|null} [value] StringValue value + */ + + /** + * Constructs a new StringValue. + * @memberof google.protobuf + * @classdesc Represents a StringValue. + * @implements IStringValue + * @constructor + * @param {google.protobuf.IStringValue=} [properties] Properties to set + */ + function StringValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * StringValue value. + * @member {string} value + * @memberof google.protobuf.StringValue + * @instance + */ + StringValue.prototype.value = ""; + + /** + * Creates a new StringValue instance using the specified properties. + * @function create + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue=} [properties] Properties to set + * @returns {google.protobuf.StringValue} StringValue instance + */ + StringValue.create = function create(properties) { + return new StringValue(properties); + }; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + return writer; + }; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.StringValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StringValue message. + * @function verify + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StringValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.StringValue} StringValue + */ + StringValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.StringValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.StringValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.StringValue(); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.StringValue} message StringValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StringValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.value = ""; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = message.value; + return object; + }; + + /** + * Converts this StringValue to JSON. + * @function toJSON + * @memberof google.protobuf.StringValue + * @instance + * @returns {Object.} JSON object + */ + StringValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StringValue + * @function getTypeUrl + * @memberof google.protobuf.StringValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StringValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.StringValue"; + }; + + return StringValue; + })(); + + protobuf.BytesValue = (function() { + + /** + * Properties of a BytesValue. + * @memberof google.protobuf + * @interface IBytesValue + * @property {Uint8Array|null} [value] BytesValue value + */ + + /** + * Constructs a new BytesValue. + * @memberof google.protobuf + * @classdesc Represents a BytesValue. + * @implements IBytesValue + * @constructor + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + */ + function BytesValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * BytesValue value. + * @member {Uint8Array} value + * @memberof google.protobuf.BytesValue + * @instance + */ + BytesValue.prototype.value = $util.newBuffer([]); + + /** + * Creates a new BytesValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + * @returns {google.protobuf.BytesValue} BytesValue instance + */ + BytesValue.create = function create(properties) { + return new BytesValue(properties); + }; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BytesValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BytesValue message. + * @function verify + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BytesValue.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BytesValue} BytesValue + */ + BytesValue.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.protobuf.BytesValue) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.BytesValue: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.protobuf.BytesValue(); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.BytesValue} message BytesValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BytesValue.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this BytesValue to JSON. + * @function toJSON + * @memberof google.protobuf.BytesValue + * @instance + * @returns {Object.} JSON object + */ + BytesValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BytesValue + * @function getTypeUrl + * @memberof google.protobuf.BytesValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BytesValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BytesValue"; + }; + + return BytesValue; + })(); + + return protobuf; + })(); + + google.type = (function() { + + /** + * Namespace type. + * @memberof google + * @namespace + */ + var type = {}; + + /** + * DayOfWeek enum. + * @name google.type.DayOfWeek + * @enum {number} + * @property {number} DAY_OF_WEEK_UNSPECIFIED=0 DAY_OF_WEEK_UNSPECIFIED value + * @property {number} MONDAY=1 MONDAY value + * @property {number} TUESDAY=2 TUESDAY value + * @property {number} WEDNESDAY=3 WEDNESDAY value + * @property {number} THURSDAY=4 THURSDAY value + * @property {number} FRIDAY=5 FRIDAY value + * @property {number} SATURDAY=6 SATURDAY value + * @property {number} SUNDAY=7 SUNDAY value + */ + type.DayOfWeek = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DAY_OF_WEEK_UNSPECIFIED"] = 0; + values[valuesById[1] = "MONDAY"] = 1; + values[valuesById[2] = "TUESDAY"] = 2; + values[valuesById[3] = "WEDNESDAY"] = 3; + values[valuesById[4] = "THURSDAY"] = 4; + values[valuesById[5] = "FRIDAY"] = 5; + values[valuesById[6] = "SATURDAY"] = 6; + values[valuesById[7] = "SUNDAY"] = 7; + return values; + })(); + + type.LatLng = (function() { + + /** + * Properties of a LatLng. + * @memberof google.type + * @interface ILatLng + * @property {number|null} [latitude] LatLng latitude + * @property {number|null} [longitude] LatLng longitude + */ + + /** + * Constructs a new LatLng. + * @memberof google.type + * @classdesc Represents a LatLng. + * @implements ILatLng + * @constructor + * @param {google.type.ILatLng=} [properties] Properties to set + */ + function LatLng(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * LatLng latitude. + * @member {number} latitude + * @memberof google.type.LatLng + * @instance + */ + LatLng.prototype.latitude = 0; + + /** + * LatLng longitude. + * @member {number} longitude + * @memberof google.type.LatLng + * @instance + */ + LatLng.prototype.longitude = 0; + + /** + * Creates a new LatLng instance using the specified properties. + * @function create + * @memberof google.type.LatLng + * @static + * @param {google.type.ILatLng=} [properties] Properties to set + * @returns {google.type.LatLng} LatLng instance + */ + LatLng.create = function create(properties) { + return new LatLng(properties); + }; + + /** + * Encodes the specified LatLng message. Does not implicitly {@link google.type.LatLng.verify|verify} messages. + * @function encode + * @memberof google.type.LatLng + * @static + * @param {google.type.ILatLng} message LatLng message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LatLng.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.latitude != null && Object.hasOwnProperty.call(message, "latitude")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.latitude); + if (message.longitude != null && Object.hasOwnProperty.call(message, "longitude")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.longitude); + return writer; + }; + + /** + * Encodes the specified LatLng message, length delimited. Does not implicitly {@link google.type.LatLng.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.LatLng + * @static + * @param {google.type.ILatLng} message LatLng message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LatLng.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a LatLng message from the specified reader or buffer. + * @function decode + * @memberof google.type.LatLng + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.type.LatLng} LatLng + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LatLng.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.LatLng(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.latitude = reader.double(); + break; + } + case 2: { + message.longitude = reader.double(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a LatLng message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.LatLng + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.type.LatLng} LatLng + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LatLng.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LatLng message. + * @function verify + * @memberof google.type.LatLng + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LatLng.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.latitude != null && Object.hasOwnProperty.call(message, "latitude")) + if (typeof message.latitude !== "number") + return "latitude: number expected"; + if (message.longitude != null && Object.hasOwnProperty.call(message, "longitude")) + if (typeof message.longitude !== "number") + return "longitude: number expected"; + return null; + }; + + /** + * Creates a LatLng message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.LatLng + * @static + * @param {Object.} object Plain object + * @returns {google.type.LatLng} LatLng + */ + LatLng.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.type.LatLng) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.type.LatLng: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.type.LatLng(); + if (object.latitude != null) + message.latitude = Number(object.latitude); + if (object.longitude != null) + message.longitude = Number(object.longitude); + return message; + }; + + /** + * Creates a plain object from a LatLng message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.LatLng + * @static + * @param {google.type.LatLng} message LatLng + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LatLng.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.latitude = 0; + object.longitude = 0; + } + if (message.latitude != null && Object.hasOwnProperty.call(message, "latitude")) + object.latitude = options.json && !isFinite(message.latitude) ? String(message.latitude) : message.latitude; + if (message.longitude != null && Object.hasOwnProperty.call(message, "longitude")) + object.longitude = options.json && !isFinite(message.longitude) ? String(message.longitude) : message.longitude; + return object; + }; + + /** + * Converts this LatLng to JSON. + * @function toJSON + * @memberof google.type.LatLng + * @instance + * @returns {Object.} JSON object + */ + LatLng.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LatLng + * @function getTypeUrl + * @memberof google.type.LatLng + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LatLng.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.LatLng"; + }; + + return LatLng; + })(); + + return type; + })(); + + google.longrunning = (function() { + + /** + * Namespace longrunning. + * @memberof google + * @namespace + */ + var longrunning = {}; + + longrunning.Operations = (function() { + + /** + * Constructs a new Operations service. + * @memberof google.longrunning + * @classdesc Represents an Operations + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Operations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; + + /** + * Creates new Operations service using the specified rpc implementation. + * @function create + * @memberof google.longrunning.Operations + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Operations} RPC service. Useful where requests and/or responses are streamed. + */ + Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.longrunning.Operations|listOperations}. + * @memberof google.longrunning.Operations + * @typedef ListOperationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse + */ + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); + }, "name", { value: "ListOperations" }); + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|getOperation}. + * @memberof google.longrunning.Operations + * @typedef GetOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "GetOperation" }); + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. + * @memberof google.longrunning.Operations + * @typedef DeleteOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteOperation" }); + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. + * @memberof google.longrunning.Operations + * @typedef CancelOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "CancelOperation" }); + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|waitOperation}. + * @memberof google.longrunning.Operations + * @typedef WaitOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { + return $protobuf.rpc.Service.prototype.rpcCall.call(this, waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "WaitOperation" }); + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Operations; + })(); + + longrunning.Operation = (function() { + + /** + * Properties of an Operation. + * @memberof google.longrunning + * @interface IOperation + * @property {string|null} [name] Operation name + * @property {google.protobuf.IAny|null} [metadata] Operation metadata + * @property {boolean|null} [done] Operation done + * @property {google.rpc.IStatus|null} [error] Operation error + * @property {google.protobuf.IAny|null} [response] Operation response + */ + + /** + * Constructs a new Operation. + * @memberof google.longrunning + * @classdesc Represents an Operation. + * @implements IOperation + * @constructor + * @param {google.longrunning.IOperation=} [properties] Properties to set + */ + function Operation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Operation name. + * @member {string} name + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.name = ""; + + /** + * Operation metadata. + * @member {google.protobuf.IAny|null|undefined} metadata + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.metadata = null; + + /** + * Operation done. + * @member {boolean} done + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.done = false; + + /** + * Operation error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation response. + * @member {google.protobuf.IAny|null|undefined} response + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.response = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Operation result. + * @member {"error"|"response"|undefined} result + * @memberof google.longrunning.Operation + * @instance + */ + Object.defineProperty(Operation.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "response"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Operation instance using the specified properties. + * @function create + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation=} [properties] Properties to set + * @returns {google.longrunning.Operation} Operation instance + */ + Operation.create = function create(properties) { + return new Operation(properties); + }; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encode + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); + if (message.response != null && Object.hasOwnProperty.call(message, "response")) + $root.google.protobuf.Any.encode(message.response, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.Operation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 3: { + message.done = reader.bool(); + break; + } + case 4: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + case 5: { + message.response = $root.google.protobuf.Any.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Operation message. + * @function verify + * @memberof google.longrunning.Operation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Operation.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + var properties = {}; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) { + var error = $root.google.protobuf.Any.verify(message.metadata, long + 1); + if (error) + return "metadata." + error; + } + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + if (typeof message.done !== "boolean") + return "done: boolean expected"; + if (message.error != null && Object.hasOwnProperty.call(message, "error")) { + properties.result = 1; + { + var error = $root.google.rpc.Status.verify(message.error, long + 1); + if (error) + return "error." + error; + } + } + if (message.response != null && Object.hasOwnProperty.call(message, "response")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.google.protobuf.Any.verify(message.response, long + 1); + if (error) + return "response." + error; + } + } + return null; + }; + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.Operation + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.Operation} Operation + */ + Operation.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.longrunning.Operation) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.longrunning.Operation: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.longrunning.Operation(); + if (object.name != null) + message.name = String(object.name); + if (object.metadata != null) { + if (!$util.isObject(object.metadata)) + throw TypeError(".google.longrunning.Operation.metadata: object expected"); + message.metadata = $root.google.protobuf.Any.fromObject(object.metadata, long + 1); + } + if (object.done != null) + message.done = Boolean(object.done); + if (object.error != null) { + if (!$util.isObject(object.error)) + throw TypeError(".google.longrunning.Operation.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error, long + 1); + } + if (object.response != null) { + if (!$util.isObject(object.response)) + throw TypeError(".google.longrunning.Operation.response: object expected"); + message.response = $root.google.protobuf.Any.fromObject(object.response, long + 1); + } + return message; + }; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.Operation} message Operation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Operation.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.metadata = null; + object.done = false; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + object.metadata = $root.google.protobuf.Any.toObject(message.metadata, options, q + 1); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + object.done = message.done; + if (message.error != null && Object.hasOwnProperty.call(message, "error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options, q + 1); + if (options.oneofs) + object.result = "error"; + } + if (message.response != null && Object.hasOwnProperty.call(message, "response")) { + object.response = $root.google.protobuf.Any.toObject(message.response, options, q + 1); + if (options.oneofs) + object.result = "response"; + } + return object; + }; + + /** + * Converts this Operation to JSON. + * @function toJSON + * @memberof google.longrunning.Operation + * @instance + * @returns {Object.} JSON object + */ + Operation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Operation + * @function getTypeUrl + * @memberof google.longrunning.Operation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.Operation"; + }; + + return Operation; + })(); + + longrunning.GetOperationRequest = (function() { + + /** + * Properties of a GetOperationRequest. + * @memberof google.longrunning + * @interface IGetOperationRequest + * @property {string|null} [name] GetOperationRequest name + */ + + /** + * Constructs a new GetOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a GetOperationRequest. + * @implements IGetOperationRequest + * @constructor + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + */ + function GetOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetOperationRequest name. + * @member {string} name + * @memberof google.longrunning.GetOperationRequest + * @instance + */ + GetOperationRequest.prototype.name = ""; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest instance + */ + GetOperationRequest.create = function create(properties) { + return new GetOperationRequest(properties); + }; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.GetOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetOperationRequest message. + * @function verify + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetOperationRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + */ + GetOperationRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.longrunning.GetOperationRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.longrunning.GetOperationRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.longrunning.GetOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.GetOperationRequest} message GetOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetOperationRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.GetOperationRequest + * @instance + * @returns {Object.} JSON object + */ + GetOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.GetOperationRequest"; + }; + + return GetOperationRequest; + })(); + + longrunning.ListOperationsRequest = (function() { + + /** + * Properties of a ListOperationsRequest. + * @memberof google.longrunning + * @interface IListOperationsRequest + * @property {string|null} [name] ListOperationsRequest name + * @property {string|null} [filter] ListOperationsRequest filter + * @property {number|null} [pageSize] ListOperationsRequest pageSize + * @property {string|null} [pageToken] ListOperationsRequest pageToken + */ + + /** + * Constructs a new ListOperationsRequest. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsRequest. + * @implements IListOperationsRequest + * @constructor + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + */ + function ListOperationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsRequest name. + * @member {string} name + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.name = ""; + + /** + * ListOperationsRequest filter. + * @member {string} filter + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.filter = ""; + + /** + * ListOperationsRequest pageSize. + * @member {number} pageSize + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageSize = 0; + + /** + * ListOperationsRequest pageToken. + * @member {string} pageToken + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest instance + */ + ListOperationsRequest.create = function create(properties) { + return new ListOperationsRequest(properties); + }; + + /** + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 4: { + message.name = reader.string(); + break; + } + case 1: { + message.filter = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsRequest message. + * @function verify + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + */ + ListOperationsRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.longrunning.ListOperationsRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.longrunning.ListOperationsRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.longrunning.ListOperationsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.ListOperationsRequest} message ListOperationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + } + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + object.filter = message.filter; + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListOperationsRequest to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListOperationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListOperationsRequest + * @function getTypeUrl + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListOperationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.ListOperationsRequest"; + }; + + return ListOperationsRequest; + })(); + + longrunning.ListOperationsResponse = (function() { + + /** + * Properties of a ListOperationsResponse. + * @memberof google.longrunning + * @interface IListOperationsResponse + * @property {Array.|null} [operations] ListOperationsResponse operations + * @property {string|null} [nextPageToken] ListOperationsResponse nextPageToken + */ + + /** + * Constructs a new ListOperationsResponse. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsResponse. + * @implements IListOperationsResponse + * @constructor + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + */ + function ListOperationsResponse(properties) { + this.operations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsResponse operations. + * @member {Array.} operations + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.operations = $util.emptyArray; + + /** + * ListOperationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse instance + */ + ListOperationsResponse.create = function create(properties) { + return new ListOperationsResponse(properties); + }; + + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.operations != null && message.operations.length) + for (var i = 0; i < message.operations.length; ++i) + $root.google.longrunning.Operation.encode(message.operations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.operations && message.operations.length)) + message.operations = []; + message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsResponse message. + * @function verify + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsResponse.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.operations != null && Object.hasOwnProperty.call(message, "operations")) { + if (!Array.isArray(message.operations)) + return "operations: array expected"; + for (var i = 0; i < message.operations.length; ++i) { + var error = $root.google.longrunning.Operation.verify(message.operations[i], long + 1); + if (error) + return "operations." + error; + } + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + */ + ListOperationsResponse.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.longrunning.ListOperationsResponse) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.longrunning.ListOperationsResponse: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.longrunning.ListOperationsResponse(); + if (object.operations) { + if (!Array.isArray(object.operations)) + throw TypeError(".google.longrunning.ListOperationsResponse.operations: array expected"); + message.operations = []; + for (var i = 0; i < object.operations.length; ++i) { + if (!$util.isObject(object.operations[i])) + throw TypeError(".google.longrunning.ListOperationsResponse.operations: object expected"); + message.operations[i] = $root.google.longrunning.Operation.fromObject(object.operations[i], long + 1); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.ListOperationsResponse} message ListOperationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsResponse.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.operations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.operations && message.operations.length) { + object.operations = []; + for (var j = 0; j < message.operations.length; ++j) + object.operations[j] = $root.google.longrunning.Operation.toObject(message.operations[j], options, q + 1); + } + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListOperationsResponse to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListOperationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListOperationsResponse + * @function getTypeUrl + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListOperationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.ListOperationsResponse"; + }; + + return ListOperationsResponse; + })(); + + longrunning.CancelOperationRequest = (function() { + + /** + * Properties of a CancelOperationRequest. + * @memberof google.longrunning + * @interface ICancelOperationRequest + * @property {string|null} [name] CancelOperationRequest name + */ + + /** + * Constructs a new CancelOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a CancelOperationRequest. + * @implements ICancelOperationRequest + * @constructor + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + */ + function CancelOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * CancelOperationRequest name. + * @member {string} name + * @memberof google.longrunning.CancelOperationRequest + * @instance + */ + CancelOperationRequest.prototype.name = ""; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest instance + */ + CancelOperationRequest.create = function create(properties) { + return new CancelOperationRequest(properties); + }; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.CancelOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CancelOperationRequest message. + * @function verify + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CancelOperationRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + */ + CancelOperationRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.longrunning.CancelOperationRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.longrunning.CancelOperationRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.longrunning.CancelOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.CancelOperationRequest} message CancelOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CancelOperationRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CancelOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.CancelOperationRequest + * @instance + * @returns {Object.} JSON object + */ + CancelOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CancelOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CancelOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.CancelOperationRequest"; + }; + + return CancelOperationRequest; + })(); + + longrunning.DeleteOperationRequest = (function() { + + /** + * Properties of a DeleteOperationRequest. + * @memberof google.longrunning + * @interface IDeleteOperationRequest + * @property {string|null} [name] DeleteOperationRequest name + */ + + /** + * Constructs a new DeleteOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a DeleteOperationRequest. + * @implements IDeleteOperationRequest + * @constructor + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + */ + function DeleteOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteOperationRequest name. + * @member {string} name + * @memberof google.longrunning.DeleteOperationRequest + * @instance + */ + DeleteOperationRequest.prototype.name = ""; + + /** + * Creates a new DeleteOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest instance + */ + DeleteOperationRequest.create = function create(properties) { + return new DeleteOperationRequest(properties); + }; + + /** + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.DeleteOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteOperationRequest message. + * @function verify + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteOperationRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + */ + DeleteOperationRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.longrunning.DeleteOperationRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.longrunning.DeleteOperationRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.longrunning.DeleteOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.DeleteOperationRequest} message DeleteOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteOperationRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.DeleteOperationRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.DeleteOperationRequest"; + }; + + return DeleteOperationRequest; + })(); + + longrunning.WaitOperationRequest = (function() { + + /** + * Properties of a WaitOperationRequest. + * @memberof google.longrunning + * @interface IWaitOperationRequest + * @property {string|null} [name] WaitOperationRequest name + * @property {google.protobuf.IDuration|null} [timeout] WaitOperationRequest timeout + */ + + /** + * Constructs a new WaitOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a WaitOperationRequest. + * @implements IWaitOperationRequest + * @constructor + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + */ + function WaitOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitOperationRequest name. + * @member {string} name + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.name = ""; + + /** + * WaitOperationRequest timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.timeout = null; + + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest instance + */ + WaitOperationRequest.create = function create(properties) { + return new WaitOperationRequest(properties); + }; + + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.WaitOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitOperationRequest message. + * @function verify + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitOperationRequest.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout, long + 1); + if (error) + return "timeout." + error; + } + return null; + }; + + /** + * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + */ + WaitOperationRequest.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.longrunning.WaitOperationRequest) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.longrunning.WaitOperationRequest: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.longrunning.WaitOperationRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.timeout != null) { + if (!$util.isObject(object.timeout)) + throw TypeError(".google.longrunning.WaitOperationRequest.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout, long + 1); + } + return message; + }; + + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.WaitOperationRequest} message WaitOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitOperationRequest.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.name = ""; + object.timeout = null; + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + object.name = message.name; + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options, q + 1); + return object; + }; + + /** + * Converts this WaitOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.WaitOperationRequest + * @instance + * @returns {Object.} JSON object + */ + WaitOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WaitOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WaitOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.WaitOperationRequest"; + }; + + return WaitOperationRequest; + })(); + + longrunning.OperationInfo = (function() { + + /** + * Properties of an OperationInfo. + * @memberof google.longrunning + * @interface IOperationInfo + * @property {string|null} [responseType] OperationInfo responseType + * @property {string|null} [metadataType] OperationInfo metadataType + */ + + /** + * Constructs a new OperationInfo. + * @memberof google.longrunning + * @classdesc Represents an OperationInfo. + * @implements IOperationInfo + * @constructor + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + */ + function OperationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationInfo responseType. + * @member {string} responseType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.responseType = ""; + + /** + * OperationInfo metadataType. + * @member {string} metadataType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.metadataType = ""; + + /** + * Creates a new OperationInfo instance using the specified properties. + * @function create + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + * @returns {google.longrunning.OperationInfo} OperationInfo instance + */ + OperationInfo.create = function create(properties) { + return new OperationInfo(properties); + }; + + /** + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encode + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); + if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.metadataType); + return writer; + }; + + /** + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.OperationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.responseType = reader.string(); + break; + } + case 2: { + message.metadataType = reader.string(); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationInfo message. + * @function verify + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationInfo.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) + if (!$util.isString(message.responseType)) + return "responseType: string expected"; + if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) + if (!$util.isString(message.metadataType)) + return "metadataType: string expected"; + return null; + }; + + /** + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.OperationInfo} OperationInfo + */ + OperationInfo.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.longrunning.OperationInfo) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.longrunning.OperationInfo: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.longrunning.OperationInfo(); + if (object.responseType != null) + message.responseType = String(object.responseType); + if (object.metadataType != null) + message.metadataType = String(object.metadataType); + return message; + }; + + /** + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.OperationInfo} message OperationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationInfo.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.defaults) { + object.responseType = ""; + object.metadataType = ""; + } + if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) + object.responseType = message.responseType; + if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) + object.metadataType = message.metadataType; + return object; + }; + + /** + * Converts this OperationInfo to JSON. + * @function toJSON + * @memberof google.longrunning.OperationInfo + * @instance + * @returns {Object.} JSON object + */ + OperationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationInfo + * @function getTypeUrl + * @memberof google.longrunning.OperationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.OperationInfo"; + }; + + return OperationInfo; + })(); + + return longrunning; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { + + /** + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details + */ + + /** + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus + * @constructor + * @param {google.rpc.IStatus=} [properties] Properties to set + */ + function Status(properties) { + this.details = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null && keys[i] !== "__proto__") + this[keys[i]] = properties[keys[i]]; + } + + /** + * Status code. + * @member {number} code + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.code = 0; + + /** + * Status message. + * @member {string} message + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.message = ""; + + /** + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. + * @function create + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance + */ + Status.create = function create(properties) { + return new Status(properties); + }; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encode + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encode = function encode(message, writer, q) { + if (!writer) + writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); + return writer; + }; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encodeDelimited + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); + }; + + /** + * Decodes a Status message from the specified reader or buffer. + * @function decode + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decode = function decode(reader, length, error, long) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32(), undefined, long + 1)); + break; + } + default: + reader.skipType(tag & 7, long); + break; + } + } + return message; + }; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Status message. + * @function verify + * @memberof google.rpc.Status + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Status.verify = function verify(message, long) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && Object.hasOwnProperty.call(message, "details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i], long + 1); + if (error) + return "details." + error; + } + } + return null; + }; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.rpc.Status + * @static + * @param {Object.} object Plain object + * @returns {google.rpc.Status} Status + */ + Status.fromObject = function fromObject(object, long) { + if (object instanceof $root.google.rpc.Status) + return object; + if (!$util.isObject(object)) + throw TypeError(".google.rpc.Status: object expected"); + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (!$util.isObject(object.details[i])) + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i], long + 1); + } + } + return message; + }; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @function toObject + * @memberof google.rpc.Status + * @static + * @param {google.rpc.Status} message Status + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Status.toObject = function toObject(message, options, q) { + if (!options) + options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); + var object = {}; + if (options.arrays || options.defaults) + object.details = []; + if (options.defaults) { + object.code = 0; + object.message = ""; + } + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + object.code = message.code; + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options, q + 1); + } + return object; + }; + + /** + * Converts this Status to JSON. + * @function toJSON + * @memberof google.rpc.Status + * @instance + * @returns {Object.} JSON object + */ + Status.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Status + * @function getTypeUrl + * @memberof google.rpc.Status + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.rpc.Status"; + }; + + return Status; + })(); + + return rpc; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-firestore-api/protos/protos.json b/packages/google-cloud-firestore-api/protos/protos.json new file mode 100644 index 000000000000..aac674ec8021 --- /dev/null +++ b/packages/google-cloud-firestore-api/protos/protos.json @@ -0,0 +1,8959 @@ +{ + "nested": { + "google": { + "nested": { + "firestore": { + "nested": { + "admin": { + "nested": { + "v1": { + "options": { + "csharp_namespace": "Google.Cloud.Firestore.Admin.V1", + "go_package": "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb", + "java_multiple_files": true, + "java_outer_classname": "LocationProto", + "java_package": "com.google.firestore.admin.v1", + "objc_class_prefix": "GCFS", + "php_namespace": "Google\\Cloud\\Firestore\\Admin\\V1", + "ruby_package": "Google::Cloud::Firestore::Admin::V1", + "(google.api.resource_definition).type": "firestore.googleapis.com/CollectionGroup", + "(google.api.resource_definition).pattern": "projects/{project}/databases/{database}/collectionGroups/{collection}" + }, + "nested": { + "Backup": { + "options": { + "(google.api.resource).type": "firestore.googleapis.com/Backup", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/backups/{backup}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "database": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + }, + "databaseUid": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "snapshotTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "expireTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "stats": { + "type": "Stats", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "State", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Stats": { + "fields": { + "sizeBytes": { + "type": "int64", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "documentCount": { + "type": "int64", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "indexCount": { + "type": "int64", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "READY": 2, + "NOT_AVAILABLE": 3 + } + } + } + }, + "Database": { + "options": { + "(google.api.resource).type": "firestore.googleapis.com/Database", + "(google.api.resource).pattern": "projects/{project}/databases/{database}", + "(google.api.resource).style": "DECLARATIVE_FRIENDLY" + }, + "oneofs": { + "_freeTier": { + "oneof": [ + "freeTier" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "uid": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "deleteTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "locationId": { + "type": "string", + "id": 9 + }, + "type": { + "type": "DatabaseType", + "id": 10 + }, + "concurrencyMode": { + "type": "ConcurrencyMode", + "id": 15 + }, + "versionRetentionPeriod": { + "type": "google.protobuf.Duration", + "id": 17, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "earliestVersionTime": { + "type": "google.protobuf.Timestamp", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "pointInTimeRecoveryEnablement": { + "type": "PointInTimeRecoveryEnablement", + "id": 21 + }, + "appEngineIntegrationMode": { + "type": "AppEngineIntegrationMode", + "id": 19 + }, + "keyPrefix": { + "type": "string", + "id": 20, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "deleteProtectionState": { + "type": "DeleteProtectionState", + "id": 22 + }, + "cmekConfig": { + "type": "CmekConfig", + "id": 23, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "previousId": { + "type": "string", + "id": 25, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "sourceInfo": { + "type": "SourceInfo", + "id": 26, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "tags": { + "keyType": "string", + "type": "string", + "id": 29, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "freeTier": { + "type": "bool", + "id": 30, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "etag": { + "type": "string", + "id": 99 + }, + "databaseEdition": { + "type": "DatabaseEdition", + "id": 28, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "realtimeUpdatesMode": { + "type": "RealtimeUpdatesMode", + "id": 31, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "firestoreDataAccessMode": { + "type": "DataAccessMode", + "id": 33, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mongodbCompatibleDataAccessMode": { + "type": "DataAccessMode", + "id": 34, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "DatabaseType": { + "values": { + "DATABASE_TYPE_UNSPECIFIED": 0, + "FIRESTORE_NATIVE": 1, + "DATASTORE_MODE": 2 + } + }, + "ConcurrencyMode": { + "values": { + "CONCURRENCY_MODE_UNSPECIFIED": 0, + "OPTIMISTIC": 1, + "PESSIMISTIC": 2, + "OPTIMISTIC_WITH_ENTITY_GROUPS": 3 + } + }, + "PointInTimeRecoveryEnablement": { + "values": { + "POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED": 0, + "POINT_IN_TIME_RECOVERY_ENABLED": 1, + "POINT_IN_TIME_RECOVERY_DISABLED": 2 + } + }, + "AppEngineIntegrationMode": { + "values": { + "APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED": 0, + "ENABLED": 1, + "DISABLED": 2 + } + }, + "DeleteProtectionState": { + "values": { + "DELETE_PROTECTION_STATE_UNSPECIFIED": 0, + "DELETE_PROTECTION_DISABLED": 1, + "DELETE_PROTECTION_ENABLED": 2 + } + }, + "CmekConfig": { + "fields": { + "kmsKeyName": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "activeKeyVersion": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "SourceInfo": { + "oneofs": { + "source": { + "oneof": [ + "backup" + ] + } + }, + "fields": { + "backup": { + "type": "BackupSource", + "id": 1 + }, + "operation": { + "type": "string", + "id": 3, + "options": { + "(google.api.resource_reference).type": "firestore.googleapis.com/Operation" + } + } + }, + "nested": { + "BackupSource": { + "fields": { + "backup": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "firestore.googleapis.com/Backup" + } + } + } + } + } + }, + "EncryptionConfig": { + "oneofs": { + "encryptionType": { + "oneof": [ + "googleDefaultEncryption", + "useSourceEncryption", + "customerManagedEncryption" + ] + } + }, + "fields": { + "googleDefaultEncryption": { + "type": "GoogleDefaultEncryptionOptions", + "id": 1 + }, + "useSourceEncryption": { + "type": "SourceEncryptionOptions", + "id": 2 + }, + "customerManagedEncryption": { + "type": "CustomerManagedEncryptionOptions", + "id": 3 + } + }, + "nested": { + "GoogleDefaultEncryptionOptions": { + "fields": {} + }, + "SourceEncryptionOptions": { + "fields": {} + }, + "CustomerManagedEncryptionOptions": { + "fields": { + "kmsKeyName": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "DatabaseEdition": { + "values": { + "DATABASE_EDITION_UNSPECIFIED": 0, + "STANDARD": 1, + "ENTERPRISE": 2 + } + }, + "DataAccessMode": { + "values": { + "DATA_ACCESS_MODE_UNSPECIFIED": 0, + "DATA_ACCESS_MODE_ENABLED": 1, + "DATA_ACCESS_MODE_DISABLED": 2 + } + } + } + }, + "RealtimeUpdatesMode": { + "values": { + "REALTIME_UPDATES_MODE_UNSPECIFIED": 0, + "REALTIME_UPDATES_MODE_ENABLED": 1, + "REALTIME_UPDATES_MODE_DISABLED": 2 + } + }, + "Field": { + "options": { + "(google.api.resource).type": "firestore.googleapis.com/Field", + "(google.api.resource).pattern": "projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "indexConfig": { + "type": "IndexConfig", + "id": 2 + }, + "ttlConfig": { + "type": "TtlConfig", + "id": 3 + } + }, + "nested": { + "IndexConfig": { + "fields": { + "indexes": { + "rule": "repeated", + "type": "Index", + "id": 1 + }, + "usesAncestorConfig": { + "type": "bool", + "id": 2 + }, + "ancestorField": { + "type": "string", + "id": 3 + }, + "reverting": { + "type": "bool", + "id": 4 + } + } + }, + "TtlConfig": { + "fields": { + "state": { + "type": "State", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "expirationOffset": { + "type": "google.protobuf.Duration", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "ACTIVE": 2, + "NEEDS_REPAIR": 3 + } + } + } + } + } + }, + "Index": { + "options": { + "(google.api.resource).type": "firestore.googleapis.com/Index", + "(google.api.resource).pattern": "projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "queryScope": { + "type": "QueryScope", + "id": 2 + }, + "apiScope": { + "type": "ApiScope", + "id": 5 + }, + "fields": { + "rule": "repeated", + "type": "IndexField", + "id": 3 + }, + "state": { + "type": "State", + "id": 4 + }, + "density": { + "type": "Density", + "id": 6, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "multikey": { + "type": "bool", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "shardCount": { + "type": "int32", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "unique": { + "type": "bool", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "searchIndexOptions": { + "type": "SearchIndexOptions", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "QueryScope": { + "values": { + "QUERY_SCOPE_UNSPECIFIED": 0, + "COLLECTION": 1, + "COLLECTION_GROUP": 2, + "COLLECTION_RECURSIVE": 3 + } + }, + "ApiScope": { + "values": { + "ANY_API": 0, + "DATASTORE_MODE_API": 1, + "MONGODB_COMPATIBLE_API": 2 + } + }, + "IndexField": { + "oneofs": { + "valueMode": { + "oneof": [ + "order", + "arrayConfig", + "vectorConfig", + "searchConfig" + ] + } + }, + "fields": { + "fieldPath": { + "type": "string", + "id": 1 + }, + "order": { + "type": "Order", + "id": 2 + }, + "arrayConfig": { + "type": "ArrayConfig", + "id": 3 + }, + "vectorConfig": { + "type": "VectorConfig", + "id": 4 + }, + "searchConfig": { + "type": "SearchConfig", + "id": 5 + } + }, + "nested": { + "Order": { + "values": { + "ORDER_UNSPECIFIED": 0, + "ASCENDING": 1, + "DESCENDING": 2 + } + }, + "ArrayConfig": { + "values": { + "ARRAY_CONFIG_UNSPECIFIED": 0, + "CONTAINS": 1 + } + }, + "VectorConfig": { + "oneofs": { + "type": { + "oneof": [ + "flat" + ] + } + }, + "fields": { + "dimension": { + "type": "int32", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "flat": { + "type": "FlatIndex", + "id": 2 + } + }, + "nested": { + "FlatIndex": { + "fields": {} + } + } + }, + "SearchConfig": { + "fields": { + "textSpec": { + "type": "SearchTextSpec", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "geoSpec": { + "type": "SearchGeoSpec", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "TextIndexType": { + "values": { + "TEXT_INDEX_TYPE_UNSPECIFIED": 0, + "TOKENIZED": 1 + } + }, + "TextMatchType": { + "values": { + "TEXT_MATCH_TYPE_UNSPECIFIED": 0, + "MATCH_GLOBALLY": 1 + } + }, + "SearchTextIndexSpec": { + "fields": { + "indexType": { + "type": "TextIndexType", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "matchType": { + "type": "TextMatchType", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SearchTextSpec": { + "fields": { + "indexSpecs": { + "rule": "repeated", + "type": "SearchTextIndexSpec", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SearchGeoSpec": { + "fields": { + "geoJsonIndexingDisabled": { + "type": "bool", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "READY": 2, + "NEEDS_REPAIR": 3 + } + }, + "Density": { + "values": { + "DENSITY_UNSPECIFIED": 0, + "SPARSE_ALL": 1, + "SPARSE_ANY": 2, + "DENSE": 3 + } + }, + "SearchIndexOptions": { + "fields": { + "textLanguage": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "textLanguageOverrideFieldPath": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "FirestoreAdmin": { + "options": { + "(google.api.default_host)": "firestore.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/datastore" + }, + "methods": { + "CreateIndex": { + "requestType": "CreateIndexRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes", + "(google.api.http).body": "index", + "(google.api.method_signature)": "parent,index", + "(google.longrunning.operation_info).response_type": "Index", + "(google.longrunning.operation_info).metadata_type": "IndexOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes", + "body": "index" + } + }, + { + "(google.api.method_signature)": "parent,index" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Index", + "metadata_type": "IndexOperationMetadata" + } + } + ] + }, + "ListIndexes": { + "requestType": "ListIndexesRequest", + "responseType": "ListIndexesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetIndex": { + "requestType": "GetIndexRequest", + "responseType": "Index", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteIndex": { + "requestType": "DeleteIndexRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetField": { + "requestType": "GetFieldRequest", + "responseType": "Field", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateField": { + "requestType": "UpdateFieldRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}", + "(google.api.http).body": "field", + "(google.api.method_signature)": "field", + "(google.longrunning.operation_info).response_type": "Field", + "(google.longrunning.operation_info).metadata_type": "FieldOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}", + "body": "field" + } + }, + { + "(google.api.method_signature)": "field" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Field", + "metadata_type": "FieldOperationMetadata" + } + } + ] + }, + "ListFields": { + "requestType": "ListFieldsRequest", + "responseType": "ListFieldsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ExportDocuments": { + "requestType": "ExportDocumentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/databases/*}:exportDocuments", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "ExportDocumentsResponse", + "(google.longrunning.operation_info).metadata_type": "ExportDocumentsMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/databases/*}:exportDocuments", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ExportDocumentsResponse", + "metadata_type": "ExportDocumentsMetadata" + } + } + ] + }, + "ImportDocuments": { + "requestType": "ImportDocumentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/databases/*}:importDocuments", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "ImportDocumentsMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/databases/*}:importDocuments", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "ImportDocumentsMetadata" + } + } + ] + }, + "BulkDeleteDocuments": { + "requestType": "BulkDeleteDocumentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/databases/*}:bulkDeleteDocuments", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "BulkDeleteDocumentsResponse", + "(google.longrunning.operation_info).metadata_type": "BulkDeleteDocumentsMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/databases/*}:bulkDeleteDocuments", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BulkDeleteDocumentsResponse", + "metadata_type": "BulkDeleteDocumentsMetadata" + } + } + ] + }, + "CreateDatabase": { + "requestType": "CreateDatabaseRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}/databases", + "(google.api.http).body": "database", + "(google.api.method_signature)": "parent,database,database_id", + "(google.longrunning.operation_info).response_type": "Database", + "(google.longrunning.operation_info).metadata_type": "CreateDatabaseMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/databases", + "body": "database" + } + }, + { + "(google.api.method_signature)": "parent,database,database_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Database", + "metadata_type": "CreateDatabaseMetadata" + } + } + ] + }, + "GetDatabase": { + "requestType": "GetDatabaseRequest", + "responseType": "Database", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/databases/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/databases/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListDatabases": { + "requestType": "ListDatabasesRequest", + "responseType": "ListDatabasesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*}/databases", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*}/databases" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateDatabase": { + "requestType": "UpdateDatabaseRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{database.name=projects/*/databases/*}", + "(google.api.http).body": "database", + "(google.api.method_signature)": "database,update_mask", + "(google.longrunning.operation_info).response_type": "Database", + "(google.longrunning.operation_info).metadata_type": "UpdateDatabaseMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{database.name=projects/*/databases/*}", + "body": "database" + } + }, + { + "(google.api.method_signature)": "database,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Database", + "metadata_type": "UpdateDatabaseMetadata" + } + } + ] + }, + "DeleteDatabase": { + "requestType": "DeleteDatabaseRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/databases/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "Database", + "(google.longrunning.operation_info).metadata_type": "DeleteDatabaseMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/databases/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Database", + "metadata_type": "DeleteDatabaseMetadata" + } + } + ] + }, + "CreateUserCreds": { + "requestType": "CreateUserCredsRequest", + "responseType": "UserCreds", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/databases/*}/userCreds", + "(google.api.http).body": "user_creds", + "(google.api.method_signature)": "parent,user_creds,user_creds_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/databases/*}/userCreds", + "body": "user_creds" + } + }, + { + "(google.api.method_signature)": "parent,user_creds,user_creds_id" + } + ] + }, + "GetUserCreds": { + "requestType": "GetUserCredsRequest", + "responseType": "UserCreds", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/databases/*/userCreds/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/databases/*/userCreds/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListUserCreds": { + "requestType": "ListUserCredsRequest", + "responseType": "ListUserCredsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/databases/*}/userCreds", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/databases/*}/userCreds" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "EnableUserCreds": { + "requestType": "EnableUserCredsRequest", + "responseType": "UserCreds", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/databases/*/userCreds/*}:enable", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/databases/*/userCreds/*}:enable", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DisableUserCreds": { + "requestType": "DisableUserCredsRequest", + "responseType": "UserCreds", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/databases/*/userCreds/*}:disable", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/databases/*/userCreds/*}:disable", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ResetUserPassword": { + "requestType": "ResetUserPasswordRequest", + "responseType": "UserCreds", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/databases/*/userCreds/*}:resetPassword", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/databases/*/userCreds/*}:resetPassword", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteUserCreds": { + "requestType": "DeleteUserCredsRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/databases/*/userCreds/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/databases/*/userCreds/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetBackup": { + "requestType": "GetBackupRequest", + "responseType": "Backup", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/backups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/backups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListBackups": { + "requestType": "ListBackupsRequest", + "responseType": "ListBackupsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/backups", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/backups" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "DeleteBackup": { + "requestType": "DeleteBackupRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/backups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/backups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "RestoreDatabase": { + "requestType": "RestoreDatabaseRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}/databases:restore", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "Database", + "(google.longrunning.operation_info).metadata_type": "RestoreDatabaseMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/databases:restore", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Database", + "metadata_type": "RestoreDatabaseMetadata" + } + } + ] + }, + "CreateBackupSchedule": { + "requestType": "CreateBackupScheduleRequest", + "responseType": "BackupSchedule", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/databases/*}/backupSchedules", + "(google.api.http).body": "backup_schedule", + "(google.api.method_signature)": "parent,backup_schedule" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/databases/*}/backupSchedules", + "body": "backup_schedule" + } + }, + { + "(google.api.method_signature)": "parent,backup_schedule" + } + ] + }, + "GetBackupSchedule": { + "requestType": "GetBackupScheduleRequest", + "responseType": "BackupSchedule", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/databases/*/backupSchedules/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/databases/*/backupSchedules/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListBackupSchedules": { + "requestType": "ListBackupSchedulesRequest", + "responseType": "ListBackupSchedulesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/databases/*}/backupSchedules", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/databases/*}/backupSchedules" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateBackupSchedule": { + "requestType": "UpdateBackupScheduleRequest", + "responseType": "BackupSchedule", + "options": { + "(google.api.http).patch": "/v1/{backup_schedule.name=projects/*/databases/*/backupSchedules/*}", + "(google.api.http).body": "backup_schedule", + "(google.api.method_signature)": "backup_schedule,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{backup_schedule.name=projects/*/databases/*/backupSchedules/*}", + "body": "backup_schedule" + } + }, + { + "(google.api.method_signature)": "backup_schedule,update_mask" + } + ] + }, + "DeleteBackupSchedule": { + "requestType": "DeleteBackupScheduleRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/databases/*/backupSchedules/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/databases/*/backupSchedules/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CloneDatabase": { + "requestType": "CloneDatabaseRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}/databases:clone", + "(google.api.http).body": "*", + "(google.api.routing).routing_parameters.field": "pitr_snapshot.database", + "(google.api.routing).routing_parameters.path_template": "projects/*/databases/{database_id=*}/**", + "(google.longrunning.operation_info).response_type": "Database", + "(google.longrunning.operation_info).metadata_type": "CloneDatabaseMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/databases:clone", + "body": "*" + } + }, + { + "(google.api.routing)": { + "routing_parameters": [ + { + "field": "pitr_snapshot.database", + "path_template": "projects/{project_id=*}/**" + }, + { + "field": "pitr_snapshot.database", + "path_template": "projects/*/databases/{database_id=*}/**" + } + ] + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Database", + "metadata_type": "CloneDatabaseMetadata" + } + } + ] + } + } + }, + "ListDatabasesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "firestore.googleapis.com/Database" + } + }, + "showDeleted": { + "type": "bool", + "id": 4 + } + } + }, + "CreateDatabaseRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "firestore.googleapis.com/Database" + } + }, + "database": { + "type": "Database", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "databaseId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CreateDatabaseMetadata": { + "fields": {} + }, + "ListDatabasesResponse": { + "fields": { + "databases": { + "rule": "repeated", + "type": "Database", + "id": 1 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetDatabaseRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + } + } + }, + "UpdateDatabaseRequest": { + "fields": { + "database": { + "type": "Database", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "UpdateDatabaseMetadata": { + "fields": {} + }, + "DeleteDatabaseRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + }, + "etag": { + "type": "string", + "id": 3 + } + } + }, + "DeleteDatabaseMetadata": { + "fields": {} + }, + "CreateUserCredsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "firestore.googleapis.com/UserCreds" + } + }, + "userCreds": { + "type": "UserCreds", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userCredsId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetUserCredsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/UserCreds" + } + } + } + }, + "ListUserCredsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "firestore.googleapis.com/UserCreds" + } + } + } + }, + "ListUserCredsResponse": { + "fields": { + "userCreds": { + "rule": "repeated", + "type": "UserCreds", + "id": 1 + } + } + }, + "EnableUserCredsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/UserCreds" + } + } + } + }, + "DisableUserCredsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/UserCreds" + } + } + } + }, + "ResetUserPasswordRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/UserCreds" + } + } + } + }, + "DeleteUserCredsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/UserCreds" + } + } + } + }, + "CreateBackupScheduleRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + }, + "backupSchedule": { + "type": "BackupSchedule", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetBackupScheduleRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/BackupSchedule" + } + } + } + }, + "UpdateBackupScheduleRequest": { + "fields": { + "backupSchedule": { + "type": "BackupSchedule", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "ListBackupSchedulesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + } + } + }, + "ListBackupSchedulesResponse": { + "fields": { + "backupSchedules": { + "rule": "repeated", + "type": "BackupSchedule", + "id": 1 + } + } + }, + "DeleteBackupScheduleRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/BackupSchedule" + } + } + } + }, + "CreateIndexRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/CollectionGroup" + } + }, + "index": { + "type": "Index", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListIndexesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/CollectionGroup" + } + }, + "filter": { + "type": "string", + "id": 2 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListIndexesResponse": { + "fields": { + "indexes": { + "rule": "repeated", + "type": "Index", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetIndexRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Index" + } + } + } + }, + "DeleteIndexRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Index" + } + } + } + }, + "UpdateFieldRequest": { + "fields": { + "field": { + "type": "Field", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "GetFieldRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Field" + } + } + } + }, + "ListFieldsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/CollectionGroup" + } + }, + "filter": { + "type": "string", + "id": 2 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListFieldsResponse": { + "fields": { + "fields": { + "rule": "repeated", + "type": "Field", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ExportDocumentsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + }, + "collectionIds": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "outputUriPrefix": { + "type": "string", + "id": 3 + }, + "namespaceIds": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "snapshotTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + } + } + }, + "ImportDocumentsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + }, + "collectionIds": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "inputUriPrefix": { + "type": "string", + "id": 3 + }, + "namespaceIds": { + "rule": "repeated", + "type": "string", + "id": 4 + } + } + }, + "BulkDeleteDocumentsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + }, + "collectionIds": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "namespaceIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BulkDeleteDocumentsResponse": { + "fields": {} + }, + "GetBackupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Backup" + } + } + } + }, + "ListBackupsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Location" + } + }, + "filter": { + "type": "string", + "id": 2 + } + } + }, + "ListBackupsResponse": { + "fields": { + "backups": { + "rule": "repeated", + "type": "Backup", + "id": 1 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "DeleteBackupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Backup" + } + } + } + }, + "RestoreDatabaseRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "firestore.googleapis.com/Database" + } + }, + "databaseId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "backup": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Backup" + } + }, + "encryptionConfig": { + "type": "Database.EncryptionConfig", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "tags": { + "keyType": "string", + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "CloneDatabaseRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "firestore.googleapis.com/Database" + } + }, + "databaseId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pitrSnapshot": { + "type": "PitrSnapshot", + "id": 6, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "encryptionConfig": { + "type": "Database.EncryptionConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "tags": { + "keyType": "string", + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "IndexOperationMetadata": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "index": { + "type": "string", + "id": 3 + }, + "state": { + "type": "OperationState", + "id": 4 + }, + "progressDocuments": { + "type": "Progress", + "id": 5 + }, + "progressBytes": { + "type": "Progress", + "id": 6 + } + } + }, + "FieldOperationMetadata": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "field": { + "type": "string", + "id": 3 + }, + "indexConfigDeltas": { + "rule": "repeated", + "type": "IndexConfigDelta", + "id": 4 + }, + "state": { + "type": "OperationState", + "id": 5 + }, + "progressDocuments": { + "type": "Progress", + "id": 6 + }, + "progressBytes": { + "type": "Progress", + "id": 7 + }, + "ttlConfigDelta": { + "type": "TtlConfigDelta", + "id": 8 + } + }, + "nested": { + "IndexConfigDelta": { + "fields": { + "changeType": { + "type": "ChangeType", + "id": 1 + }, + "index": { + "type": "Index", + "id": 2 + } + }, + "nested": { + "ChangeType": { + "values": { + "CHANGE_TYPE_UNSPECIFIED": 0, + "ADD": 1, + "REMOVE": 2 + } + } + } + }, + "TtlConfigDelta": { + "fields": { + "changeType": { + "type": "ChangeType", + "id": 1 + }, + "expirationOffset": { + "type": "google.protobuf.Duration", + "id": 3 + } + }, + "nested": { + "ChangeType": { + "values": { + "CHANGE_TYPE_UNSPECIFIED": 0, + "ADD": 1, + "REMOVE": 2 + } + } + } + } + } + }, + "ExportDocumentsMetadata": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "operationState": { + "type": "OperationState", + "id": 3 + }, + "progressDocuments": { + "type": "Progress", + "id": 4 + }, + "progressBytes": { + "type": "Progress", + "id": 5 + }, + "collectionIds": { + "rule": "repeated", + "type": "string", + "id": 6 + }, + "outputUriPrefix": { + "type": "string", + "id": 7 + }, + "namespaceIds": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "snapshotTime": { + "type": "google.protobuf.Timestamp", + "id": 9 + } + } + }, + "ImportDocumentsMetadata": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "operationState": { + "type": "OperationState", + "id": 3 + }, + "progressDocuments": { + "type": "Progress", + "id": 4 + }, + "progressBytes": { + "type": "Progress", + "id": 5 + }, + "collectionIds": { + "rule": "repeated", + "type": "string", + "id": 6 + }, + "inputUriPrefix": { + "type": "string", + "id": 7 + }, + "namespaceIds": { + "rule": "repeated", + "type": "string", + "id": 8 + } + } + }, + "BulkDeleteDocumentsMetadata": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "operationState": { + "type": "OperationState", + "id": 3 + }, + "progressDocuments": { + "type": "Progress", + "id": 4 + }, + "progressBytes": { + "type": "Progress", + "id": 5 + }, + "collectionIds": { + "rule": "repeated", + "type": "string", + "id": 6 + }, + "namespaceIds": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "snapshotTime": { + "type": "google.protobuf.Timestamp", + "id": 8 + } + } + }, + "ExportDocumentsResponse": { + "fields": { + "outputUriPrefix": { + "type": "string", + "id": 1 + } + } + }, + "RestoreDatabaseMetadata": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "operationState": { + "type": "OperationState", + "id": 3 + }, + "database": { + "type": "string", + "id": 4, + "options": { + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + }, + "backup": { + "type": "string", + "id": 5, + "options": { + "(google.api.resource_reference).type": "firestore.googleapis.com/Backup" + } + }, + "progressPercentage": { + "type": "Progress", + "id": 8 + } + } + }, + "CloneDatabaseMetadata": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "operationState": { + "type": "OperationState", + "id": 3 + }, + "database": { + "type": "string", + "id": 4, + "options": { + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + }, + "pitrSnapshot": { + "type": "PitrSnapshot", + "id": 7 + }, + "progressPercentage": { + "type": "Progress", + "id": 6 + } + } + }, + "Progress": { + "fields": { + "estimatedWork": { + "type": "int64", + "id": 1 + }, + "completedWork": { + "type": "int64", + "id": 2 + } + } + }, + "OperationState": { + "values": { + "OPERATION_STATE_UNSPECIFIED": 0, + "INITIALIZING": 1, + "PROCESSING": 2, + "CANCELLING": 3, + "FINALIZING": 4, + "SUCCESSFUL": 5, + "FAILED": 6, + "CANCELLED": 7 + } + }, + "PitrSnapshot": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "firestore.googleapis.com/Database" + } + }, + "databaseUid": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "snapshotTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "BackupSchedule": { + "options": { + "(google.api.resource).type": "firestore.googleapis.com/BackupSchedule", + "(google.api.resource).pattern": "projects/{project}/databases/{database}/backupSchedules/{backup_schedule}" + }, + "oneofs": { + "recurrence": { + "oneof": [ + "dailyRecurrence", + "weeklyRecurrence" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "retention": { + "type": "google.protobuf.Duration", + "id": 6 + }, + "dailyRecurrence": { + "type": "DailyRecurrence", + "id": 7 + }, + "weeklyRecurrence": { + "type": "WeeklyRecurrence", + "id": 8 + } + } + }, + "DailyRecurrence": { + "fields": {} + }, + "WeeklyRecurrence": { + "fields": { + "day": { + "type": "google.type.DayOfWeek", + "id": 2 + } + } + }, + "UserCreds": { + "options": { + "(google.api.resource).type": "firestore.googleapis.com/UserCreds", + "(google.api.resource).pattern": "projects/{project}/databases/{database}/userCreds/{user_creds}", + "(google.api.resource).plural": "userCreds", + "(google.api.resource).singular": "userCreds" + }, + "oneofs": { + "UserCredsIdentity": { + "oneof": [ + "resourceIdentity" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "State", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "securePassword": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "resourceIdentity": { + "type": "ResourceIdentity", + "id": 6 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ENABLED": 1, + "DISABLED": 2 + } + }, + "ResourceIdentity": { + "fields": { + "principal": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + } + } + }, + "LocationMetadata": { + "fields": {} + } + } + } + } + }, + "v1": { + "options": { + "csharp_namespace": "Google.Cloud.Firestore.V1", + "go_package": "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb", + "java_multiple_files": true, + "java_outer_classname": "WriteProto", + "java_package": "com.google.firestore.v1", + "objc_class_prefix": "GCFS", + "php_namespace": "Google\\Cloud\\Firestore\\V1", + "ruby_package": "Google::Cloud::Firestore::V1" + }, + "nested": { + "AggregationResult": { + "fields": { + "aggregateFields": { + "keyType": "string", + "type": "Value", + "id": 2 + } + } + }, + "Document": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "fields": { + "keyType": "string", + "type": "Value", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "Value": { + "oneofs": { + "valueType": { + "oneof": [ + "nullValue", + "booleanValue", + "integerValue", + "doubleValue", + "timestampValue", + "stringValue", + "bytesValue", + "referenceValue", + "geoPointValue", + "arrayValue", + "mapValue", + "fieldReferenceValue", + "variableReferenceValue", + "functionValue", + "pipelineValue" + ] + } + }, + "fields": { + "nullValue": { + "type": "google.protobuf.NullValue", + "id": 11 + }, + "booleanValue": { + "type": "bool", + "id": 1 + }, + "integerValue": { + "type": "int64", + "id": 2 + }, + "doubleValue": { + "type": "double", + "id": 3 + }, + "timestampValue": { + "type": "google.protobuf.Timestamp", + "id": 10 + }, + "stringValue": { + "type": "string", + "id": 17 + }, + "bytesValue": { + "type": "bytes", + "id": 18 + }, + "referenceValue": { + "type": "string", + "id": 5 + }, + "geoPointValue": { + "type": "google.type.LatLng", + "id": 8 + }, + "arrayValue": { + "type": "ArrayValue", + "id": 9 + }, + "mapValue": { + "type": "MapValue", + "id": 6 + }, + "fieldReferenceValue": { + "type": "string", + "id": 19 + }, + "variableReferenceValue": { + "type": "string", + "id": 22 + }, + "functionValue": { + "type": "Function", + "id": 20 + }, + "pipelineValue": { + "type": "Pipeline", + "id": 21 + } + } + }, + "ArrayValue": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + } + } + }, + "MapValue": { + "fields": { + "fields": { + "keyType": "string", + "type": "Value", + "id": 1 + } + } + }, + "Function": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "args": { + "rule": "repeated", + "type": "Value", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "options": { + "keyType": "string", + "type": "Value", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Pipeline": { + "fields": { + "stages": { + "rule": "repeated", + "type": "Stage", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "Stage": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "args": { + "rule": "repeated", + "type": "Value", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "options": { + "keyType": "string", + "type": "Value", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "BitSequence": { + "fields": { + "bitmap": { + "type": "bytes", + "id": 1 + }, + "padding": { + "type": "int32", + "id": 2 + } + } + }, + "BloomFilter": { + "fields": { + "bits": { + "type": "BitSequence", + "id": 1 + }, + "hashCount": { + "type": "int32", + "id": 2 + } + } + }, + "DocumentMask": { + "fields": { + "fieldPaths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Precondition": { + "oneofs": { + "conditionType": { + "oneof": [ + "exists", + "updateTime" + ] + } + }, + "fields": { + "exists": { + "type": "bool", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "TransactionOptions": { + "oneofs": { + "mode": { + "oneof": [ + "readOnly", + "readWrite" + ] + } + }, + "fields": { + "readOnly": { + "type": "ReadOnly", + "id": 2 + }, + "readWrite": { + "type": "ReadWrite", + "id": 3 + } + }, + "nested": { + "ConcurrencyMode": { + "values": { + "CONCURRENCY_MODE_UNSPECIFIED": 0, + "OPTIMISTIC": 1, + "PESSIMISTIC": 2 + } + }, + "ReadWrite": { + "fields": { + "retryTransaction": { + "type": "bytes", + "id": 1 + }, + "concurrencyMode": { + "type": "ConcurrencyMode", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ReadOnly": { + "oneofs": { + "consistencySelector": { + "oneof": [ + "readTime" + ] + } + }, + "fields": { + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + } + } + }, + "ExplainStats": { + "fields": { + "data": { + "type": "google.protobuf.Any", + "id": 1 + } + } + }, + "Firestore": { + "options": { + "(google.api.default_host)": "firestore.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/datastore" + }, + "methods": { + "GetDocument": { + "requestType": "GetDocumentRequest", + "responseType": "Document", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/databases/*/documents/*/**}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/databases/*/documents/*/**}" + } + } + ] + }, + "ListDocuments": { + "requestType": "ListDocumentsRequest", + "responseType": "ListDocumentsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}", + "(google.api.http).additional_bindings.get": "/v1/{parent=projects/*/databases/*/documents}/{collection_id}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}", + "additional_bindings": { + "get": "/v1/{parent=projects/*/databases/*/documents}/{collection_id}" + } + } + } + ] + }, + "UpdateDocument": { + "requestType": "UpdateDocumentRequest", + "responseType": "Document", + "options": { + "(google.api.http).patch": "/v1/{document.name=projects/*/databases/*/documents/*/**}", + "(google.api.http).body": "document", + "(google.api.method_signature)": "document,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{document.name=projects/*/databases/*/documents/*/**}", + "body": "document" + } + }, + { + "(google.api.method_signature)": "document,update_mask" + } + ] + }, + "DeleteDocument": { + "requestType": "DeleteDocumentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/databases/*/documents/*/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/databases/*/documents/*/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "BatchGetDocuments": { + "requestType": "BatchGetDocumentsRequest", + "responseType": "BatchGetDocumentsResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1/{database=projects/*/databases/*}/documents:batchGet", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{database=projects/*/databases/*}/documents:batchGet", + "body": "*" + } + } + ] + }, + "BeginTransaction": { + "requestType": "BeginTransactionRequest", + "responseType": "BeginTransactionResponse", + "options": { + "(google.api.http).post": "/v1/{database=projects/*/databases/*}/documents:beginTransaction", + "(google.api.http).body": "*", + "(google.api.method_signature)": "database" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{database=projects/*/databases/*}/documents:beginTransaction", + "body": "*" + } + }, + { + "(google.api.method_signature)": "database" + } + ] + }, + "Commit": { + "requestType": "CommitRequest", + "responseType": "CommitResponse", + "options": { + "(google.api.http).post": "/v1/{database=projects/*/databases/*}/documents:commit", + "(google.api.http).body": "*", + "(google.api.method_signature)": "database,writes" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{database=projects/*/databases/*}/documents:commit", + "body": "*" + } + }, + { + "(google.api.method_signature)": "database,writes" + } + ] + }, + "Rollback": { + "requestType": "RollbackRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v1/{database=projects/*/databases/*}/documents:rollback", + "(google.api.http).body": "*", + "(google.api.method_signature)": "database,transaction" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{database=projects/*/databases/*}/documents:rollback", + "body": "*" + } + }, + { + "(google.api.method_signature)": "database,transaction" + } + ] + }, + "RunQuery": { + "requestType": "RunQueryRequest", + "responseType": "RunQueryResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/databases/*/documents}:runQuery", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1/{parent=projects/*/databases/*/documents/*/**}:runQuery", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/databases/*/documents}:runQuery", + "body": "*", + "additional_bindings": { + "post": "/v1/{parent=projects/*/databases/*/documents/*/**}:runQuery", + "body": "*" + } + } + } + ] + }, + "ExecutePipeline": { + "requestType": "ExecutePipelineRequest", + "responseType": "ExecutePipelineResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1/{database=projects/*/databases/*}/documents:executePipeline", + "(google.api.http).body": "*", + "(google.api.routing).routing_parameters.field": "database", + "(google.api.routing).routing_parameters.path_template": "projects/*/databases/{database_id=*}/**" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{database=projects/*/databases/*}/documents:executePipeline", + "body": "*" + } + }, + { + "(google.api.routing)": { + "routing_parameters": [ + { + "field": "database", + "path_template": "projects/{project_id=*}/**" + }, + { + "field": "database", + "path_template": "projects/*/databases/{database_id=*}/**" + } + ] + } + } + ] + }, + "RunAggregationQuery": { + "requestType": "RunAggregationQueryRequest", + "responseType": "RunAggregationQueryResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/databases/*/documents}:runAggregationQuery", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1/{parent=projects/*/databases/*/documents/*/**}:runAggregationQuery", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/databases/*/documents}:runAggregationQuery", + "body": "*", + "additional_bindings": { + "post": "/v1/{parent=projects/*/databases/*/documents/*/**}:runAggregationQuery", + "body": "*" + } + } + } + ] + }, + "PartitionQuery": { + "requestType": "PartitionQueryRequest", + "responseType": "PartitionQueryResponse", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/databases/*/documents}:partitionQuery", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/databases/*/documents}:partitionQuery", + "body": "*", + "additional_bindings": { + "post": "/v1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery", + "body": "*" + } + } + } + ] + }, + "Write": { + "requestType": "WriteRequest", + "requestStream": true, + "responseType": "WriteResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1/{database=projects/*/databases/*}/documents:write", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{database=projects/*/databases/*}/documents:write", + "body": "*" + } + } + ] + }, + "Listen": { + "requestType": "ListenRequest", + "requestStream": true, + "responseType": "ListenResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1/{database=projects/*/databases/*}/documents:listen", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{database=projects/*/databases/*}/documents:listen", + "body": "*" + } + } + ] + }, + "ListCollectionIds": { + "requestType": "ListCollectionIdsRequest", + "responseType": "ListCollectionIdsResponse", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/databases/*/documents}:listCollectionIds", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/databases/*/documents}:listCollectionIds", + "body": "*", + "additional_bindings": { + "post": "/v1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "BatchWrite": { + "requestType": "BatchWriteRequest", + "responseType": "BatchWriteResponse", + "options": { + "(google.api.http).post": "/v1/{database=projects/*/databases/*}/documents:batchWrite", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{database=projects/*/databases/*}/documents:batchWrite", + "body": "*" + } + } + ] + }, + "CreateDocument": { + "requestType": "CreateDocumentRequest", + "responseType": "Document", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/databases/*/documents/**}/{collection_id}", + "(google.api.http).body": "document" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/databases/*/documents/**}/{collection_id}", + "body": "document" + } + } + ] + } + } + }, + "GetDocumentRequest": { + "oneofs": { + "consistencySelector": { + "oneof": [ + "transaction", + "readTime" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "mask": { + "type": "DocumentMask", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 3 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + } + } + }, + "ListDocumentsRequest": { + "oneofs": { + "consistencySelector": { + "oneof": [ + "transaction", + "readTime" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "collectionId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mask": { + "type": "DocumentMask", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "transaction": { + "type": "bytes", + "id": 8 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + }, + "showMissing": { + "type": "bool", + "id": 12 + } + } + }, + "ListDocumentsResponse": { + "fields": { + "documents": { + "rule": "repeated", + "type": "Document", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CreateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "collectionId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentId": { + "type": "string", + "id": 3 + }, + "document": { + "type": "Document", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "mask": { + "type": "DocumentMask", + "id": 5 + } + } + }, + "UpdateDocumentRequest": { + "fields": { + "document": { + "type": "Document", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "DocumentMask", + "id": 2 + }, + "mask": { + "type": "DocumentMask", + "id": 3 + }, + "currentDocument": { + "type": "Precondition", + "id": 4 + } + } + }, + "DeleteDocumentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "currentDocument": { + "type": "Precondition", + "id": 2 + } + } + }, + "BatchGetDocumentsRequest": { + "oneofs": { + "consistencySelector": { + "oneof": [ + "transaction", + "newTransaction", + "readTime" + ] + } + }, + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documents": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "mask": { + "type": "DocumentMask", + "id": 3 + }, + "transaction": { + "type": "bytes", + "id": 4 + }, + "newTransaction": { + "type": "TransactionOptions", + "id": 5 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + } + } + }, + "BatchGetDocumentsResponse": { + "oneofs": { + "result": { + "oneof": [ + "found", + "missing" + ] + } + }, + "fields": { + "found": { + "type": "Document", + "id": 1 + }, + "missing": { + "type": "string", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 3 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "BeginTransactionRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "options": { + "type": "TransactionOptions", + "id": 2 + } + } + }, + "BeginTransactionResponse": { + "fields": { + "transaction": { + "type": "bytes", + "id": 1 + } + } + }, + "CommitRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "writes": { + "rule": "repeated", + "type": "Write", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 3 + } + } + }, + "CommitResponse": { + "fields": { + "writeResults": { + "rule": "repeated", + "type": "WriteResult", + "id": 1 + }, + "commitTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "RollbackRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "transaction": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "RunQueryRequest": { + "oneofs": { + "queryType": { + "oneof": [ + "structuredQuery" + ] + }, + "consistencySelector": { + "oneof": [ + "transaction", + "newTransaction", + "readTime" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "structuredQuery": { + "type": "StructuredQuery", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 5 + }, + "newTransaction": { + "type": "TransactionOptions", + "id": 6 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "explainOptions": { + "type": "ExplainOptions", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "RunQueryResponse": { + "oneofs": { + "continuationSelector": { + "oneof": [ + "done" + ] + } + }, + "fields": { + "transaction": { + "type": "bytes", + "id": 2 + }, + "document": { + "type": "Document", + "id": 1 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "skippedResults": { + "type": "int32", + "id": 4 + }, + "done": { + "type": "bool", + "id": 6 + }, + "explainMetrics": { + "type": "ExplainMetrics", + "id": 11 + } + } + }, + "ExecutePipelineRequest": { + "oneofs": { + "pipelineType": { + "oneof": [ + "structuredPipeline" + ] + }, + "consistencySelector": { + "oneof": [ + "transaction", + "newTransaction", + "readTime" + ] + } + }, + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "structuredPipeline": { + "type": "StructuredPipeline", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 5 + }, + "newTransaction": { + "type": "TransactionOptions", + "id": 6 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "autoCommitTransaction": { + "type": "bool", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ExecutePipelineResponse": { + "fields": { + "transaction": { + "type": "bytes", + "id": 1 + }, + "results": { + "rule": "repeated", + "type": "Document", + "id": 2 + }, + "executionTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "explainStats": { + "type": "ExplainStats", + "id": 4 + } + } + }, + "RunAggregationQueryRequest": { + "oneofs": { + "queryType": { + "oneof": [ + "structuredAggregationQuery" + ] + }, + "consistencySelector": { + "oneof": [ + "transaction", + "newTransaction", + "readTime" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "structuredAggregationQuery": { + "type": "StructuredAggregationQuery", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 4 + }, + "newTransaction": { + "type": "TransactionOptions", + "id": 5 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "explainOptions": { + "type": "ExplainOptions", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "RunAggregationQueryResponse": { + "fields": { + "result": { + "type": "AggregationResult", + "id": 1 + }, + "transaction": { + "type": "bytes", + "id": 2 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "explainMetrics": { + "type": "ExplainMetrics", + "id": 10 + } + } + }, + "PartitionQueryRequest": { + "oneofs": { + "queryType": { + "oneof": [ + "structuredQuery" + ] + }, + "consistencySelector": { + "oneof": [ + "readTime" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "structuredQuery": { + "type": "StructuredQuery", + "id": 2 + }, + "partitionCount": { + "type": "int64", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "pageSize": { + "type": "int32", + "id": 5 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + } + } + }, + "PartitionQueryResponse": { + "fields": { + "partitions": { + "rule": "repeated", + "type": "Cursor", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "WriteRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "streamId": { + "type": "string", + "id": 2 + }, + "writes": { + "rule": "repeated", + "type": "Write", + "id": 3 + }, + "streamToken": { + "type": "bytes", + "id": 4 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 5 + } + } + }, + "WriteResponse": { + "fields": { + "streamId": { + "type": "string", + "id": 1 + }, + "streamToken": { + "type": "bytes", + "id": 2 + }, + "writeResults": { + "rule": "repeated", + "type": "WriteResult", + "id": 3 + }, + "commitTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "ListenRequest": { + "oneofs": { + "targetChange": { + "oneof": [ + "addTarget", + "removeTarget" + ] + } + }, + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addTarget": { + "type": "Target", + "id": 2 + }, + "removeTarget": { + "type": "int32", + "id": 3 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 4 + } + } + }, + "ListenResponse": { + "oneofs": { + "responseType": { + "oneof": [ + "targetChange", + "documentChange", + "documentDelete", + "documentRemove", + "filter" + ] + } + }, + "fields": { + "targetChange": { + "type": "TargetChange", + "id": 2 + }, + "documentChange": { + "type": "DocumentChange", + "id": 3 + }, + "documentDelete": { + "type": "DocumentDelete", + "id": 4 + }, + "documentRemove": { + "type": "DocumentRemove", + "id": 6 + }, + "filter": { + "type": "ExistenceFilter", + "id": 5 + } + } + }, + "Target": { + "oneofs": { + "targetType": { + "oneof": [ + "query", + "documents" + ] + }, + "resumeType": { + "oneof": [ + "resumeToken", + "readTime" + ] + } + }, + "fields": { + "query": { + "type": "QueryTarget", + "id": 2 + }, + "documents": { + "type": "DocumentsTarget", + "id": 3 + }, + "resumeToken": { + "type": "bytes", + "id": 4 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 11 + }, + "targetId": { + "type": "int32", + "id": 5 + }, + "once": { + "type": "bool", + "id": 6 + }, + "expectedCount": { + "type": "google.protobuf.Int32Value", + "id": 12 + } + }, + "nested": { + "DocumentsTarget": { + "fields": { + "documents": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "QueryTarget": { + "oneofs": { + "queryType": { + "oneof": [ + "structuredQuery" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "structuredQuery": { + "type": "StructuredQuery", + "id": 2 + } + } + } + } + }, + "TargetChange": { + "fields": { + "targetChangeType": { + "type": "TargetChangeType", + "id": 1 + }, + "targetIds": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "cause": { + "type": "google.rpc.Status", + "id": 3 + }, + "resumeToken": { + "type": "bytes", + "id": 4 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + } + }, + "nested": { + "TargetChangeType": { + "values": { + "NO_CHANGE": 0, + "ADD": 1, + "REMOVE": 2, + "CURRENT": 3, + "RESET": 4 + } + } + } + }, + "ListCollectionIdsRequest": { + "oneofs": { + "consistencySelector": { + "oneof": [ + "readTime" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "ListCollectionIdsResponse": { + "fields": { + "collectionIds": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "BatchWriteRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "writes": { + "rule": "repeated", + "type": "Write", + "id": 2 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 3 + } + } + }, + "BatchWriteResponse": { + "fields": { + "writeResults": { + "rule": "repeated", + "type": "WriteResult", + "id": 1 + }, + "status": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 2 + } + } + }, + "StructuredPipeline": { + "fields": { + "pipeline": { + "type": "Pipeline", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "options": { + "keyType": "string", + "type": "Value", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "StructuredQuery": { + "fields": { + "select": { + "type": "Projection", + "id": 1 + }, + "from": { + "rule": "repeated", + "type": "CollectionSelector", + "id": 2 + }, + "where": { + "type": "Filter", + "id": 3 + }, + "orderBy": { + "rule": "repeated", + "type": "Order", + "id": 4 + }, + "startAt": { + "type": "Cursor", + "id": 7 + }, + "endAt": { + "type": "Cursor", + "id": 8 + }, + "offset": { + "type": "int32", + "id": 6 + }, + "limit": { + "type": "google.protobuf.Int32Value", + "id": 5 + }, + "findNearest": { + "type": "FindNearest", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "CollectionSelector": { + "fields": { + "collectionId": { + "type": "string", + "id": 2 + }, + "allDescendants": { + "type": "bool", + "id": 3 + } + } + }, + "Filter": { + "oneofs": { + "filterType": { + "oneof": [ + "compositeFilter", + "fieldFilter", + "unaryFilter" + ] + } + }, + "fields": { + "compositeFilter": { + "type": "CompositeFilter", + "id": 1 + }, + "fieldFilter": { + "type": "FieldFilter", + "id": 2 + }, + "unaryFilter": { + "type": "UnaryFilter", + "id": 3 + } + } + }, + "CompositeFilter": { + "fields": { + "op": { + "type": "Operator", + "id": 1 + }, + "filters": { + "rule": "repeated", + "type": "Filter", + "id": 2 + } + }, + "nested": { + "Operator": { + "values": { + "OPERATOR_UNSPECIFIED": 0, + "AND": 1, + "OR": 2 + } + } + } + }, + "FieldFilter": { + "fields": { + "field": { + "type": "FieldReference", + "id": 1 + }, + "op": { + "type": "Operator", + "id": 2 + }, + "value": { + "type": "Value", + "id": 3 + } + }, + "nested": { + "Operator": { + "values": { + "OPERATOR_UNSPECIFIED": 0, + "LESS_THAN": 1, + "LESS_THAN_OR_EQUAL": 2, + "GREATER_THAN": 3, + "GREATER_THAN_OR_EQUAL": 4, + "EQUAL": 5, + "NOT_EQUAL": 6, + "ARRAY_CONTAINS": 7, + "IN": 8, + "ARRAY_CONTAINS_ANY": 9, + "NOT_IN": 10 + } + } + } + }, + "UnaryFilter": { + "oneofs": { + "operandType": { + "oneof": [ + "field" + ] + } + }, + "fields": { + "op": { + "type": "Operator", + "id": 1 + }, + "field": { + "type": "FieldReference", + "id": 2 + } + }, + "nested": { + "Operator": { + "values": { + "OPERATOR_UNSPECIFIED": 0, + "IS_NAN": 2, + "IS_NULL": 3, + "IS_NOT_NAN": 4, + "IS_NOT_NULL": 5 + } + } + } + }, + "Order": { + "fields": { + "field": { + "type": "FieldReference", + "id": 1 + }, + "direction": { + "type": "Direction", + "id": 2 + } + } + }, + "Direction": { + "values": { + "DIRECTION_UNSPECIFIED": 0, + "ASCENDING": 1, + "DESCENDING": 2 + } + }, + "FieldReference": { + "fields": { + "fieldPath": { + "type": "string", + "id": 2 + } + } + }, + "Projection": { + "fields": { + "fields": { + "rule": "repeated", + "type": "FieldReference", + "id": 2 + } + } + }, + "FindNearest": { + "fields": { + "vectorField": { + "type": "FieldReference", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "queryVector": { + "type": "Value", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "distanceMeasure": { + "type": "DistanceMeasure", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "limit": { + "type": "google.protobuf.Int32Value", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "distanceResultField": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "distanceThreshold": { + "type": "google.protobuf.DoubleValue", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "DistanceMeasure": { + "values": { + "DISTANCE_MEASURE_UNSPECIFIED": 0, + "EUCLIDEAN": 1, + "COSINE": 2, + "DOT_PRODUCT": 3 + } + } + } + } + } + }, + "StructuredAggregationQuery": { + "oneofs": { + "queryType": { + "oneof": [ + "structuredQuery" + ] + } + }, + "fields": { + "structuredQuery": { + "type": "StructuredQuery", + "id": 1 + }, + "aggregations": { + "rule": "repeated", + "type": "Aggregation", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Aggregation": { + "oneofs": { + "operator": { + "oneof": [ + "count", + "sum", + "avg" + ] + } + }, + "fields": { + "count": { + "type": "Count", + "id": 1 + }, + "sum": { + "type": "Sum", + "id": 2 + }, + "avg": { + "type": "Avg", + "id": 3 + }, + "alias": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Count": { + "fields": { + "upTo": { + "type": "google.protobuf.Int64Value", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Sum": { + "fields": { + "field": { + "type": "StructuredQuery.FieldReference", + "id": 1 + } + } + }, + "Avg": { + "fields": { + "field": { + "type": "StructuredQuery.FieldReference", + "id": 1 + } + } + } + } + } + } + }, + "Cursor": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + }, + "before": { + "type": "bool", + "id": 2 + } + } + }, + "ExplainOptions": { + "fields": { + "analyze": { + "type": "bool", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ExplainMetrics": { + "fields": { + "planSummary": { + "type": "PlanSummary", + "id": 1 + }, + "executionStats": { + "type": "ExecutionStats", + "id": 2 + } + } + }, + "PlanSummary": { + "fields": { + "indexesUsed": { + "rule": "repeated", + "type": "google.protobuf.Struct", + "id": 1 + } + } + }, + "ExecutionStats": { + "fields": { + "resultsReturned": { + "type": "int64", + "id": 1 + }, + "executionDuration": { + "type": "google.protobuf.Duration", + "id": 3 + }, + "readOperations": { + "type": "int64", + "id": 4 + }, + "debugStats": { + "type": "google.protobuf.Struct", + "id": 5 + } + } + }, + "Write": { + "oneofs": { + "operation": { + "oneof": [ + "update", + "delete", + "transform" + ] + } + }, + "fields": { + "update": { + "type": "Document", + "id": 1 + }, + "delete": { + "type": "string", + "id": 2 + }, + "transform": { + "type": "DocumentTransform", + "id": 6 + }, + "updateMask": { + "type": "DocumentMask", + "id": 3 + }, + "updateTransforms": { + "rule": "repeated", + "type": "DocumentTransform.FieldTransform", + "id": 7 + }, + "currentDocument": { + "type": "Precondition", + "id": 4 + } + } + }, + "DocumentTransform": { + "fields": { + "document": { + "type": "string", + "id": 1 + }, + "fieldTransforms": { + "rule": "repeated", + "type": "FieldTransform", + "id": 2 + } + }, + "nested": { + "FieldTransform": { + "oneofs": { + "transformType": { + "oneof": [ + "setToServerValue", + "increment", + "maximum", + "minimum", + "appendMissingElements", + "removeAllFromArray" + ] + } + }, + "fields": { + "fieldPath": { + "type": "string", + "id": 1 + }, + "setToServerValue": { + "type": "ServerValue", + "id": 2 + }, + "increment": { + "type": "Value", + "id": 3 + }, + "maximum": { + "type": "Value", + "id": 4 + }, + "minimum": { + "type": "Value", + "id": 5 + }, + "appendMissingElements": { + "type": "ArrayValue", + "id": 6 + }, + "removeAllFromArray": { + "type": "ArrayValue", + "id": 7 + } + }, + "nested": { + "ServerValue": { + "values": { + "SERVER_VALUE_UNSPECIFIED": 0, + "REQUEST_TIME": 1 + } + } + } + } + } + }, + "WriteResult": { + "fields": { + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "transformResults": { + "rule": "repeated", + "type": "Value", + "id": 2 + } + } + }, + "DocumentChange": { + "fields": { + "document": { + "type": "Document", + "id": 1 + }, + "targetIds": { + "rule": "repeated", + "type": "int32", + "id": 5 + }, + "removedTargetIds": { + "rule": "repeated", + "type": "int32", + "id": 6 + } + } + }, + "DocumentDelete": { + "fields": { + "document": { + "type": "string", + "id": 1 + }, + "removedTargetIds": { + "rule": "repeated", + "type": "int32", + "id": 6 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "DocumentRemove": { + "fields": { + "document": { + "type": "string", + "id": 1 + }, + "removedTargetIds": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "ExistenceFilter": { + "fields": { + "targetId": { + "type": "int32", + "id": 1 + }, + "count": { + "type": "int32", + "id": 2 + }, + "unchangedNames": { + "type": "BloomFilter", + "id": 3 + } + } + } + } + }, + "v1beta1": { + "options": { + "csharp_namespace": "Google.Cloud.Firestore.V1Beta1", + "go_package": "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb", + "java_multiple_files": true, + "java_outer_classname": "UndeliverableFirstGenEventProto", + "java_package": "com.google.firestore.v1beta1", + "objc_class_prefix": "GCFS", + "php_namespace": "Google\\Cloud\\Firestore\\V1beta1", + "ruby_package": "Google::Cloud::Firestore::V1beta1" + }, + "nested": { + "DocumentMask": { + "fields": { + "fieldPaths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Precondition": { + "oneofs": { + "conditionType": { + "oneof": [ + "exists", + "updateTime" + ] + } + }, + "fields": { + "exists": { + "type": "bool", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "TransactionOptions": { + "oneofs": { + "mode": { + "oneof": [ + "readOnly", + "readWrite" + ] + } + }, + "fields": { + "readOnly": { + "type": "ReadOnly", + "id": 2 + }, + "readWrite": { + "type": "ReadWrite", + "id": 3 + } + }, + "nested": { + "ReadWrite": { + "fields": { + "retryTransaction": { + "type": "bytes", + "id": 1 + } + } + }, + "ReadOnly": { + "oneofs": { + "consistencySelector": { + "oneof": [ + "readTime" + ] + } + }, + "fields": { + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + } + } + }, + "Document": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "fields": { + "keyType": "string", + "type": "Value", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "Value": { + "oneofs": { + "valueType": { + "oneof": [ + "nullValue", + "booleanValue", + "integerValue", + "doubleValue", + "timestampValue", + "stringValue", + "bytesValue", + "referenceValue", + "geoPointValue", + "arrayValue", + "mapValue" + ] + } + }, + "fields": { + "nullValue": { + "type": "google.protobuf.NullValue", + "id": 11 + }, + "booleanValue": { + "type": "bool", + "id": 1 + }, + "integerValue": { + "type": "int64", + "id": 2 + }, + "doubleValue": { + "type": "double", + "id": 3 + }, + "timestampValue": { + "type": "google.protobuf.Timestamp", + "id": 10 + }, + "stringValue": { + "type": "string", + "id": 17 + }, + "bytesValue": { + "type": "bytes", + "id": 18 + }, + "referenceValue": { + "type": "string", + "id": 5 + }, + "geoPointValue": { + "type": "google.type.LatLng", + "id": 8 + }, + "arrayValue": { + "type": "ArrayValue", + "id": 9 + }, + "mapValue": { + "type": "MapValue", + "id": 6 + } + } + }, + "ArrayValue": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + } + } + }, + "MapValue": { + "fields": { + "fields": { + "keyType": "string", + "type": "Value", + "id": 1 + } + } + }, + "Firestore": { + "options": { + "(google.api.default_host)": "firestore.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/datastore" + }, + "methods": { + "GetDocument": { + "requestType": "GetDocumentRequest", + "responseType": "Document", + "options": { + "(google.api.http).get": "/v1beta1/{name=projects/*/databases/*/documents/*/**}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta1/{name=projects/*/databases/*/documents/*/**}" + } + } + ] + }, + "ListDocuments": { + "requestType": "ListDocumentsRequest", + "responseType": "ListDocumentsResponse", + "options": { + "(google.api.http).get": "/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}" + } + } + ] + }, + "UpdateDocument": { + "requestType": "UpdateDocumentRequest", + "responseType": "Document", + "options": { + "(google.api.http).patch": "/v1beta1/{document.name=projects/*/databases/*/documents/*/**}", + "(google.api.http).body": "document", + "(google.api.method_signature)": "document,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1beta1/{document.name=projects/*/databases/*/documents/*/**}", + "body": "document" + } + }, + { + "(google.api.method_signature)": "document,update_mask" + } + ] + }, + "DeleteDocument": { + "requestType": "DeleteDocumentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1beta1/{name=projects/*/databases/*/documents/*/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1beta1/{name=projects/*/databases/*/documents/*/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "BatchGetDocuments": { + "requestType": "BatchGetDocumentsRequest", + "responseType": "BatchGetDocumentsResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1beta1/{database=projects/*/databases/*}/documents:batchGet", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{database=projects/*/databases/*}/documents:batchGet", + "body": "*" + } + } + ] + }, + "BeginTransaction": { + "requestType": "BeginTransactionRequest", + "responseType": "BeginTransactionResponse", + "options": { + "(google.api.http).post": "/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction", + "(google.api.http).body": "*", + "(google.api.method_signature)": "database" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction", + "body": "*" + } + }, + { + "(google.api.method_signature)": "database" + } + ] + }, + "Commit": { + "requestType": "CommitRequest", + "responseType": "CommitResponse", + "options": { + "(google.api.http).post": "/v1beta1/{database=projects/*/databases/*}/documents:commit", + "(google.api.http).body": "*", + "(google.api.method_signature)": "database,writes" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{database=projects/*/databases/*}/documents:commit", + "body": "*" + } + }, + { + "(google.api.method_signature)": "database,writes" + } + ] + }, + "Rollback": { + "requestType": "RollbackRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v1beta1/{database=projects/*/databases/*}/documents:rollback", + "(google.api.http).body": "*", + "(google.api.method_signature)": "database,transaction" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{database=projects/*/databases/*}/documents:rollback", + "body": "*" + } + }, + { + "(google.api.method_signature)": "database,transaction" + } + ] + }, + "RunQuery": { + "requestType": "RunQueryRequest", + "responseType": "RunQueryResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1beta1/{parent=projects/*/databases/*/documents}:runQuery", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:runQuery", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*/databases/*/documents}:runQuery", + "body": "*", + "additional_bindings": { + "post": "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:runQuery", + "body": "*" + } + } + } + ] + }, + "PartitionQuery": { + "requestType": "PartitionQueryRequest", + "responseType": "PartitionQueryResponse", + "options": { + "(google.api.http).post": "/v1beta1/{parent=projects/*/databases/*/documents}:partitionQuery", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*/databases/*/documents}:partitionQuery", + "body": "*", + "additional_bindings": { + "post": "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery", + "body": "*" + } + } + } + ] + }, + "Write": { + "requestType": "WriteRequest", + "requestStream": true, + "responseType": "WriteResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1beta1/{database=projects/*/databases/*}/documents:write", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{database=projects/*/databases/*}/documents:write", + "body": "*" + } + } + ] + }, + "Listen": { + "requestType": "ListenRequest", + "requestStream": true, + "responseType": "ListenResponse", + "responseStream": true, + "options": { + "(google.api.http).post": "/v1beta1/{database=projects/*/databases/*}/documents:listen", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{database=projects/*/databases/*}/documents:listen", + "body": "*" + } + } + ] + }, + "ListCollectionIds": { + "requestType": "ListCollectionIdsRequest", + "responseType": "ListCollectionIdsResponse", + "options": { + "(google.api.http).post": "/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds", + "body": "*", + "additional_bindings": { + "post": "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "BatchWrite": { + "requestType": "BatchWriteRequest", + "responseType": "BatchWriteResponse", + "options": { + "(google.api.http).post": "/v1beta1/{database=projects/*/databases/*}/documents:batchWrite", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{database=projects/*/databases/*}/documents:batchWrite", + "body": "*" + } + } + ] + }, + "CreateDocument": { + "requestType": "CreateDocumentRequest", + "responseType": "Document", + "options": { + "(google.api.http).post": "/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}", + "(google.api.http).body": "document" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}", + "body": "document" + } + } + ] + } + } + }, + "GetDocumentRequest": { + "oneofs": { + "consistencySelector": { + "oneof": [ + "transaction", + "readTime" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "mask": { + "type": "DocumentMask", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 3 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + } + } + }, + "ListDocumentsRequest": { + "oneofs": { + "consistencySelector": { + "oneof": [ + "transaction", + "readTime" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "collectionId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "orderBy": { + "type": "string", + "id": 6 + }, + "mask": { + "type": "DocumentMask", + "id": 7 + }, + "transaction": { + "type": "bytes", + "id": 8 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + }, + "showMissing": { + "type": "bool", + "id": 12 + } + } + }, + "ListDocumentsResponse": { + "fields": { + "documents": { + "rule": "repeated", + "type": "Document", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CreateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "collectionId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentId": { + "type": "string", + "id": 3 + }, + "document": { + "type": "Document", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "mask": { + "type": "DocumentMask", + "id": 5 + } + } + }, + "UpdateDocumentRequest": { + "fields": { + "document": { + "type": "Document", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "DocumentMask", + "id": 2 + }, + "mask": { + "type": "DocumentMask", + "id": 3 + }, + "currentDocument": { + "type": "Precondition", + "id": 4 + } + } + }, + "DeleteDocumentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "currentDocument": { + "type": "Precondition", + "id": 2 + } + } + }, + "BatchGetDocumentsRequest": { + "oneofs": { + "consistencySelector": { + "oneof": [ + "transaction", + "newTransaction", + "readTime" + ] + } + }, + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documents": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "mask": { + "type": "DocumentMask", + "id": 3 + }, + "transaction": { + "type": "bytes", + "id": 4 + }, + "newTransaction": { + "type": "TransactionOptions", + "id": 5 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + } + } + }, + "BatchGetDocumentsResponse": { + "oneofs": { + "result": { + "oneof": [ + "found", + "missing" + ] + } + }, + "fields": { + "found": { + "type": "Document", + "id": 1 + }, + "missing": { + "type": "string", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 3 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "BeginTransactionRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "options": { + "type": "TransactionOptions", + "id": 2 + } + } + }, + "BeginTransactionResponse": { + "fields": { + "transaction": { + "type": "bytes", + "id": 1 + } + } + }, + "CommitRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "writes": { + "rule": "repeated", + "type": "Write", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 3 + } + } + }, + "CommitResponse": { + "fields": { + "writeResults": { + "rule": "repeated", + "type": "WriteResult", + "id": 1 + }, + "commitTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "RollbackRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "transaction": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "RunQueryRequest": { + "oneofs": { + "queryType": { + "oneof": [ + "structuredQuery" + ] + }, + "consistencySelector": { + "oneof": [ + "transaction", + "newTransaction", + "readTime" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "structuredQuery": { + "type": "StructuredQuery", + "id": 2 + }, + "transaction": { + "type": "bytes", + "id": 5 + }, + "newTransaction": { + "type": "TransactionOptions", + "id": 6 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + } + } + }, + "RunQueryResponse": { + "fields": { + "transaction": { + "type": "bytes", + "id": 2 + }, + "document": { + "type": "Document", + "id": 1 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "skippedResults": { + "type": "int32", + "id": 4 + } + } + }, + "PartitionQueryRequest": { + "oneofs": { + "queryType": { + "oneof": [ + "structuredQuery" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "structuredQuery": { + "type": "StructuredQuery", + "id": 2 + }, + "partitionCount": { + "type": "int64", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "pageSize": { + "type": "int32", + "id": 5 + } + } + }, + "PartitionQueryResponse": { + "fields": { + "partitions": { + "rule": "repeated", + "type": "Cursor", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "WriteRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "streamId": { + "type": "string", + "id": 2 + }, + "writes": { + "rule": "repeated", + "type": "Write", + "id": 3 + }, + "streamToken": { + "type": "bytes", + "id": 4 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 5 + } + } + }, + "WriteResponse": { + "fields": { + "streamId": { + "type": "string", + "id": 1 + }, + "streamToken": { + "type": "bytes", + "id": 2 + }, + "writeResults": { + "rule": "repeated", + "type": "WriteResult", + "id": 3 + }, + "commitTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "ListenRequest": { + "oneofs": { + "targetChange": { + "oneof": [ + "addTarget", + "removeTarget" + ] + } + }, + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addTarget": { + "type": "Target", + "id": 2 + }, + "removeTarget": { + "type": "int32", + "id": 3 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 4 + } + } + }, + "ListenResponse": { + "oneofs": { + "responseType": { + "oneof": [ + "targetChange", + "documentChange", + "documentDelete", + "documentRemove", + "filter" + ] + } + }, + "fields": { + "targetChange": { + "type": "TargetChange", + "id": 2 + }, + "documentChange": { + "type": "DocumentChange", + "id": 3 + }, + "documentDelete": { + "type": "DocumentDelete", + "id": 4 + }, + "documentRemove": { + "type": "DocumentRemove", + "id": 6 + }, + "filter": { + "type": "ExistenceFilter", + "id": 5 + } + } + }, + "Target": { + "oneofs": { + "targetType": { + "oneof": [ + "query", + "documents" + ] + }, + "resumeType": { + "oneof": [ + "resumeToken", + "readTime" + ] + } + }, + "fields": { + "query": { + "type": "QueryTarget", + "id": 2 + }, + "documents": { + "type": "DocumentsTarget", + "id": 3 + }, + "resumeToken": { + "type": "bytes", + "id": 4 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 11 + }, + "targetId": { + "type": "int32", + "id": 5 + }, + "once": { + "type": "bool", + "id": 6 + } + }, + "nested": { + "DocumentsTarget": { + "fields": { + "documents": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "QueryTarget": { + "oneofs": { + "queryType": { + "oneof": [ + "structuredQuery" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "structuredQuery": { + "type": "StructuredQuery", + "id": 2 + } + } + } + } + }, + "TargetChange": { + "fields": { + "targetChangeType": { + "type": "TargetChangeType", + "id": 1 + }, + "targetIds": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "cause": { + "type": "google.rpc.Status", + "id": 3 + }, + "resumeToken": { + "type": "bytes", + "id": 4 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + } + }, + "nested": { + "TargetChangeType": { + "values": { + "NO_CHANGE": 0, + "ADD": 1, + "REMOVE": 2, + "CURRENT": 3, + "RESET": 4 + } + } + } + }, + "ListCollectionIdsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListCollectionIdsResponse": { + "fields": { + "collectionIds": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "BatchWriteRequest": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "writes": { + "rule": "repeated", + "type": "Write", + "id": 2 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 3 + } + } + }, + "BatchWriteResponse": { + "fields": { + "writeResults": { + "rule": "repeated", + "type": "WriteResult", + "id": 1 + }, + "status": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 2 + } + } + }, + "StructuredQuery": { + "fields": { + "select": { + "type": "Projection", + "id": 1 + }, + "from": { + "rule": "repeated", + "type": "CollectionSelector", + "id": 2 + }, + "where": { + "type": "Filter", + "id": 3 + }, + "orderBy": { + "rule": "repeated", + "type": "Order", + "id": 4 + }, + "startAt": { + "type": "Cursor", + "id": 7 + }, + "endAt": { + "type": "Cursor", + "id": 8 + }, + "offset": { + "type": "int32", + "id": 6 + }, + "limit": { + "type": "google.protobuf.Int32Value", + "id": 5 + } + }, + "nested": { + "CollectionSelector": { + "fields": { + "collectionId": { + "type": "string", + "id": 2 + }, + "allDescendants": { + "type": "bool", + "id": 3 + } + } + }, + "Filter": { + "oneofs": { + "filterType": { + "oneof": [ + "compositeFilter", + "fieldFilter", + "unaryFilter" + ] + } + }, + "fields": { + "compositeFilter": { + "type": "CompositeFilter", + "id": 1 + }, + "fieldFilter": { + "type": "FieldFilter", + "id": 2 + }, + "unaryFilter": { + "type": "UnaryFilter", + "id": 3 + } + } + }, + "CompositeFilter": { + "fields": { + "op": { + "type": "Operator", + "id": 1 + }, + "filters": { + "rule": "repeated", + "type": "Filter", + "id": 2 + } + }, + "nested": { + "Operator": { + "values": { + "OPERATOR_UNSPECIFIED": 0, + "AND": 1 + } + } + } + }, + "FieldFilter": { + "fields": { + "field": { + "type": "FieldReference", + "id": 1 + }, + "op": { + "type": "Operator", + "id": 2 + }, + "value": { + "type": "Value", + "id": 3 + } + }, + "nested": { + "Operator": { + "values": { + "OPERATOR_UNSPECIFIED": 0, + "LESS_THAN": 1, + "LESS_THAN_OR_EQUAL": 2, + "GREATER_THAN": 3, + "GREATER_THAN_OR_EQUAL": 4, + "EQUAL": 5, + "NOT_EQUAL": 6, + "ARRAY_CONTAINS": 7, + "IN": 8, + "ARRAY_CONTAINS_ANY": 9, + "NOT_IN": 10 + } + } + } + }, + "UnaryFilter": { + "oneofs": { + "operandType": { + "oneof": [ + "field" + ] + } + }, + "fields": { + "op": { + "type": "Operator", + "id": 1 + }, + "field": { + "type": "FieldReference", + "id": 2 + } + }, + "nested": { + "Operator": { + "values": { + "OPERATOR_UNSPECIFIED": 0, + "IS_NAN": 2, + "IS_NULL": 3, + "IS_NOT_NAN": 4, + "IS_NOT_NULL": 5 + } + } + } + }, + "FieldReference": { + "fields": { + "fieldPath": { + "type": "string", + "id": 2 + } + } + }, + "Order": { + "fields": { + "field": { + "type": "FieldReference", + "id": 1 + }, + "direction": { + "type": "Direction", + "id": 2 + } + } + }, + "Projection": { + "fields": { + "fields": { + "rule": "repeated", + "type": "FieldReference", + "id": 2 + } + } + }, + "Direction": { + "values": { + "DIRECTION_UNSPECIFIED": 0, + "ASCENDING": 1, + "DESCENDING": 2 + } + } + } + }, + "Cursor": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + }, + "before": { + "type": "bool", + "id": 2 + } + } + }, + "Write": { + "oneofs": { + "operation": { + "oneof": [ + "update", + "delete", + "transform" + ] + } + }, + "fields": { + "update": { + "type": "Document", + "id": 1 + }, + "delete": { + "type": "string", + "id": 2 + }, + "transform": { + "type": "DocumentTransform", + "id": 6 + }, + "updateMask": { + "type": "DocumentMask", + "id": 3 + }, + "updateTransforms": { + "rule": "repeated", + "type": "DocumentTransform.FieldTransform", + "id": 7 + }, + "currentDocument": { + "type": "Precondition", + "id": 4 + } + } + }, + "DocumentTransform": { + "fields": { + "document": { + "type": "string", + "id": 1 + }, + "fieldTransforms": { + "rule": "repeated", + "type": "FieldTransform", + "id": 2 + } + }, + "nested": { + "FieldTransform": { + "oneofs": { + "transformType": { + "oneof": [ + "setToServerValue", + "increment", + "maximum", + "minimum", + "appendMissingElements", + "removeAllFromArray" + ] + } + }, + "fields": { + "fieldPath": { + "type": "string", + "id": 1 + }, + "setToServerValue": { + "type": "ServerValue", + "id": 2 + }, + "increment": { + "type": "Value", + "id": 3 + }, + "maximum": { + "type": "Value", + "id": 4 + }, + "minimum": { + "type": "Value", + "id": 5 + }, + "appendMissingElements": { + "type": "ArrayValue", + "id": 6 + }, + "removeAllFromArray": { + "type": "ArrayValue", + "id": 7 + } + }, + "nested": { + "ServerValue": { + "values": { + "SERVER_VALUE_UNSPECIFIED": 0, + "REQUEST_TIME": 1 + } + } + } + } + } + }, + "WriteResult": { + "fields": { + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "transformResults": { + "rule": "repeated", + "type": "Value", + "id": 2 + } + } + }, + "DocumentChange": { + "fields": { + "document": { + "type": "Document", + "id": 1 + }, + "targetIds": { + "rule": "repeated", + "type": "int32", + "id": 5 + }, + "removedTargetIds": { + "rule": "repeated", + "type": "int32", + "id": 6 + } + } + }, + "DocumentDelete": { + "fields": { + "document": { + "type": "string", + "id": 1 + }, + "removedTargetIds": { + "rule": "repeated", + "type": "int32", + "id": 6 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "DocumentRemove": { + "fields": { + "document": { + "type": "string", + "id": 1 + }, + "removedTargetIds": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "ExistenceFilter": { + "fields": { + "targetId": { + "type": "int32", + "id": 1 + }, + "count": { + "type": "int32", + "id": 2 + } + } + }, + "UndeliverableFirstGenEvent": { + "fields": { + "message": { + "type": "string", + "id": 1 + }, + "reason": { + "type": "Reason", + "id": 2 + }, + "documentName": { + "type": "string", + "id": 3 + }, + "documentChangeType": { + "type": "DocumentChangeType", + "id": 4 + }, + "functionName": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "triggeredTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + } + }, + "nested": { + "Reason": { + "values": { + "REASON_UNSPECIFIED": 0, + "EXCEEDING_SIZE_LIMIT": 1 + } + }, + "DocumentChangeType": { + "values": { + "DOCUMENT_CHANGE_TYPE_UNSPECIFIED": 0, + "CREATE": 1, + "DELETE": 2, + "UPDATE": 3 + } + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", + "java_multiple_files": true, + "java_outer_classname": "RoutingProto", + "java_package": "com.google.api", + "objc_class_prefix": "GAPI" + }, + "nested": { + "fieldBehavior": { + "rule": "repeated", + "type": "google.api.FieldBehavior", + "id": 1052, + "extend": "google.protobuf.FieldOptions", + "options": { + "packed": false + } + }, + "FieldBehavior": { + "values": { + "FIELD_BEHAVIOR_UNSPECIFIED": 0, + "OPTIONAL": 1, + "REQUIRED": 2, + "OUTPUT_ONLY": 3, + "INPUT_ONLY": 4, + "IMMUTABLE": 5, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7, + "IDENTIFIER": 8 + } + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } + }, + "http": { + "type": "HttpRule", + "id": 72295728, + "extend": "google.protobuf.MethodOptions" + }, + "Http": { + "fields": { + "rules": { + "rule": "repeated", + "type": "HttpRule", + "id": 1 + }, + "fullyDecodeReservedExpansion": { + "type": "bool", + "id": 2 + } + } + }, + "HttpRule": { + "oneofs": { + "pattern": { + "oneof": [ + "get", + "put", + "post", + "delete", + "patch", + "custom" + ] + } + }, + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "get": { + "type": "string", + "id": 2 + }, + "put": { + "type": "string", + "id": 3 + }, + "post": { + "type": "string", + "id": 4 + }, + "delete": { + "type": "string", + "id": 5 + }, + "patch": { + "type": "string", + "id": 6 + }, + "custom": { + "type": "CustomHttpPattern", + "id": 8 + }, + "body": { + "type": "string", + "id": 7 + }, + "responseBody": { + "type": "string", + "id": 12 + }, + "additionalBindings": { + "rule": "repeated", + "type": "HttpRule", + "id": 11 + } + } + }, + "CustomHttpPattern": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + }, + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" + }, + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" + }, + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" + }, + "apiVersion": { + "type": "string", + "id": 525000001, + "extend": "google.protobuf.ServiceOptions" + }, + "CommonLanguageSettings": { + "fields": { + "referenceDocsUri": { + "type": "string", + "id": 1, + "options": { + "deprecated": true + } + }, + "destinations": { + "rule": "repeated", + "type": "ClientLibraryDestination", + "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 + } + } + }, + "ClientLibrarySettings": { + "fields": { + "version": { + "type": "string", + "id": 1 + }, + "launchStage": { + "type": "LaunchStage", + "id": 2 + }, + "restNumericEnums": { + "type": "bool", + "id": 3 + }, + "javaSettings": { + "type": "JavaSettings", + "id": 21 + }, + "cppSettings": { + "type": "CppSettings", + "id": 22 + }, + "phpSettings": { + "type": "PhpSettings", + "id": 23 + }, + "pythonSettings": { + "type": "PythonSettings", + "id": 24 + }, + "nodeSettings": { + "type": "NodeSettings", + "id": 25 + }, + "dotnetSettings": { + "type": "DotnetSettings", + "id": 26 + }, + "rubySettings": { + "type": "RubySettings", + "id": 27 + }, + "goSettings": { + "type": "GoSettings", + "id": 28 + } + } + }, + "Publishing": { + "fields": { + "methodSettings": { + "rule": "repeated", + "type": "MethodSettings", + "id": 2 + }, + "newIssueUri": { + "type": "string", + "id": 101 + }, + "documentationUri": { + "type": "string", + "id": 102 + }, + "apiShortName": { + "type": "string", + "id": 103 + }, + "githubLabel": { + "type": "string", + "id": 104 + }, + "codeownerGithubTeams": { + "rule": "repeated", + "type": "string", + "id": 105 + }, + "docTagPrefix": { + "type": "string", + "id": 106 + }, + "organization": { + "type": "ClientLibraryOrganization", + "id": 107 + }, + "librarySettings": { + "rule": "repeated", + "type": "ClientLibrarySettings", + "id": 109 + }, + "protoReferenceDocumentationUri": { + "type": "string", + "id": 110 + }, + "restReferenceDocumentationUri": { + "type": "string", + "id": 111 + } + } + }, + "JavaSettings": { + "fields": { + "libraryPackage": { + "type": "string", + "id": 1 + }, + "serviceClassNames": { + "keyType": "string", + "type": "string", + "id": 2 + }, + "common": { + "type": "CommonLanguageSettings", + "id": 3 + } + } + }, + "CppSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + } + } + }, + "PhpSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + } + } + }, + "PythonSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } + } + } + }, + "NodeSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + } + } + }, + "DotnetSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 + }, + "renamedResources": { + "keyType": "string", + "type": "string", + "id": 3 + }, + "ignoredResources": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "forcedNamespaceAliases": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "handwrittenSignatures": { + "rule": "repeated", + "type": "string", + "id": 6 + } + } + }, + "RubySettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + } + } + }, + "GoSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 + } + } + }, + "MethodSettings": { + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "longRunning": { + "type": "LongRunning", + "id": 2 + }, + "autoPopulatedFields": { + "rule": "repeated", + "type": "string", + "id": 3 + } + }, + "nested": { + "LongRunning": { + "fields": { + "initialPollDelay": { + "type": "google.protobuf.Duration", + "id": 1 + }, + "pollDelayMultiplier": { + "type": "float", + "id": 2 + }, + "maxPollDelay": { + "type": "google.protobuf.Duration", + "id": 3 + }, + "totalPollTimeout": { + "type": "google.protobuf.Duration", + "id": 4 + } + } + } + } + }, + "ClientLibraryOrganization": { + "values": { + "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": 0, + "CLOUD": 1, + "ADS": 2, + "PHOTOS": 3, + "STREET_VIEW": 4, + "SHOPPING": 5, + "GEO": 6, + "GENERATIVE_AI": 7 + } + }, + "ClientLibraryDestination": { + "values": { + "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": 0, + "GITHUB": 10, + "PACKAGE_MANAGER": 20 + } + }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, + "LaunchStage": { + "values": { + "LAUNCH_STAGE_UNSPECIFIED": 0, + "UNIMPLEMENTED": 6, + "PRELAUNCH": 7, + "EARLY_ACCESS": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5 + } + }, + "routing": { + "type": "google.api.RoutingRule", + "id": 72295729, + "extend": "google.protobuf.MethodOptions" + }, + "RoutingRule": { + "fields": { + "routingParameters": { + "rule": "repeated", + "type": "RoutingParameter", + "id": 2 + } + } + }, + "RoutingParameter": { + "fields": { + "field": { + "type": "string", + "id": 1 + }, + "pathTemplate": { + "type": "string", + "id": 2 + } + } + } + } + }, + "protobuf": { + "options": { + "go_package": "google.golang.org/protobuf/types/descriptorpb", + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "csharp_namespace": "Google.Protobuf.Reflection", + "objc_class_prefix": "GPB", + "cc_enable_arenas": true, + "optimize_for": "SPEED" + }, + "nested": { + "FileDescriptorSet": { + "edition": "proto2", + "fields": { + "file": { + "rule": "repeated", + "type": "FileDescriptorProto", + "id": 1 + } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] + }, + "Edition": { + "edition": "proto2", + "values": { + "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, + "EDITION_PROTO2": 998, + "EDITION_PROTO3": 999, + "EDITION_2023": 1000, + "EDITION_2024": 1001, + "EDITION_1_TEST_ONLY": 1, + "EDITION_2_TEST_ONLY": 2, + "EDITION_99997_TEST_ONLY": 99997, + "EDITION_99998_TEST_ONLY": 99998, + "EDITION_99999_TEST_ONLY": 99999, + "EDITION_MAX": 2147483647 + } + }, + "FileDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "package": { + "type": "string", + "id": 2 + }, + "dependency": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "publicDependency": { + "rule": "repeated", + "type": "int32", + "id": 10 + }, + "weakDependency": { + "rule": "repeated", + "type": "int32", + "id": 11 + }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, + "messageType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 4 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 5 + }, + "service": { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "id": 6 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 7 + }, + "options": { + "type": "FileOptions", + "id": 8 + }, + "sourceCodeInfo": { + "type": "SourceCodeInfo", + "id": 9 + }, + "syntax": { + "type": "string", + "id": 12 + }, + "edition": { + "type": "Edition", + "id": 14 + } + } + }, + "DescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "field": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 2 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 6 + }, + "nestedType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 3 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 4 + }, + "extensionRange": { + "rule": "repeated", + "type": "ExtensionRange", + "id": 5 + }, + "oneofDecl": { + "rule": "repeated", + "type": "OneofDescriptorProto", + "id": 8 + }, + "options": { + "type": "MessageOptions", + "id": 7 + }, + "reservedRange": { + "rule": "repeated", + "type": "ReservedRange", + "id": 9 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 + } + }, + "nested": { + "ExtensionRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "ExtensionRangeOptions", + "id": 3 + } + } + }, + "ReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "ExtensionRangeOptions": { + "edition": "proto2", + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + }, + "declaration": { + "rule": "repeated", + "type": "Declaration", + "id": 2, + "options": { + "retention": "RETENTION_SOURCE" + } + }, + "features": { + "type": "FeatureSet", + "id": 50 + }, + "verification": { + "type": "VerificationState", + "id": 3, + "options": { + "default": "UNVERIFIED", + "retention": "RETENTION_SOURCE" + } + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "nested": { + "Declaration": { + "fields": { + "number": { + "type": "int32", + "id": 1 + }, + "fullName": { + "type": "string", + "id": 2 + }, + "type": { + "type": "string", + "id": 3 + }, + "reserved": { + "type": "bool", + "id": 5 + }, + "repeated": { + "type": "bool", + "id": 6 + } + }, + "reserved": [ + [ + 4, + 4 + ] + ] + }, + "VerificationState": { + "values": { + "DECLARATION": 0, + "UNVERIFIED": 1 + } + } + } + }, + "FieldDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 3 + }, + "label": { + "type": "Label", + "id": 4 + }, + "type": { + "type": "Type", + "id": 5 + }, + "typeName": { + "type": "string", + "id": 6 + }, + "extendee": { + "type": "string", + "id": 2 + }, + "defaultValue": { + "type": "string", + "id": 7 + }, + "oneofIndex": { + "type": "int32", + "id": 9 + }, + "jsonName": { + "type": "string", + "id": 10 + }, + "options": { + "type": "FieldOptions", + "id": 8 + }, + "proto3Optional": { + "type": "bool", + "id": 17 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18 + } + }, + "Label": { + "values": { + "LABEL_OPTIONAL": 1, + "LABEL_REPEATED": 3, + "LABEL_REQUIRED": 2 + } + } + } + }, + "OneofDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "options": { + "type": "OneofOptions", + "id": 2 + } + } + }, + "EnumDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "rule": "repeated", + "type": "EnumValueDescriptorProto", + "id": 2 + }, + "options": { + "type": "EnumOptions", + "id": 3 + }, + "reservedRange": { + "rule": "repeated", + "type": "EnumReservedRange", + "id": 4 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 + } + }, + "nested": { + "EnumReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "EnumValueDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "EnumValueOptions", + "id": 3 + } + } + }, + "ServiceDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "method": { + "rule": "repeated", + "type": "MethodDescriptorProto", + "id": 2 + }, + "options": { + "type": "ServiceOptions", + "id": 3 + } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] + }, + "MethodDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "inputType": { + "type": "string", + "id": 2 + }, + "outputType": { + "type": "string", + "id": 3 + }, + "options": { + "type": "MethodOptions", + "id": 4 + }, + "clientStreaming": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "serverStreaming": { + "type": "bool", + "id": 6, + "options": { + "default": false + } + } + } + }, + "FileOptions": { + "edition": "proto2", + "fields": { + "javaPackage": { + "type": "string", + "id": 1 + }, + "javaOuterClassname": { + "type": "string", + "id": 8 + }, + "javaMultipleFiles": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "javaGenerateEqualsAndHash": { + "type": "bool", + "id": 20, + "options": { + "deprecated": true + } + }, + "javaStringCheckUtf8": { + "type": "bool", + "id": 27, + "options": { + "default": false + } + }, + "optimizeFor": { + "type": "OptimizeMode", + "id": 9, + "options": { + "default": "SPEED" + } + }, + "goPackage": { + "type": "string", + "id": 11 + }, + "ccGenericServices": { + "type": "bool", + "id": 16, + "options": { + "default": false + } + }, + "javaGenericServices": { + "type": "bool", + "id": 17, + "options": { + "default": false + } + }, + "pyGenericServices": { + "type": "bool", + "id": 18, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 23, + "options": { + "default": false + } + }, + "ccEnableArenas": { + "type": "bool", + "id": 31, + "options": { + "default": true + } + }, + "objcClassPrefix": { + "type": "string", + "id": 36 + }, + "csharpNamespace": { + "type": "string", + "id": 37 + }, + "swiftPrefix": { + "type": "string", + "id": 39 + }, + "phpClassPrefix": { + "type": "string", + "id": 40 + }, + "phpNamespace": { + "type": "string", + "id": 41 + }, + "phpMetadataNamespace": { + "type": "string", + "id": 44 + }, + "rubyPackage": { + "type": "string", + "id": 45 + }, + "features": { + "type": "FeatureSet", + "id": 50 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 42, + 42 + ], + "php_generic_services", + [ + 38, + 38 + ] + ], + "nested": { + "OptimizeMode": { + "values": { + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3 + } + } + } + }, + "MessageOptions": { + "edition": "proto2", + "fields": { + "messageSetWireFormat": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "noStandardDescriptorAccessor": { + "type": "bool", + "id": 2, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "mapEntry": { + "type": "bool", + "id": 7 + }, + "deprecatedLegacyJsonFieldConflicts": { + "type": "bool", + "id": 11, + "options": { + "deprecated": true + } + }, + "features": { + "type": "FeatureSet", + "id": 12 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], + [ + 8, + 8 + ], + [ + 9, + 9 + ] + ] + }, + "FieldOptions": { + "edition": "proto2", + "fields": { + "ctype": { + "type": "CType", + "id": 1, + "options": { + "default": "STRING" + } + }, + "packed": { + "type": "bool", + "id": 2 + }, + "jstype": { + "type": "JSType", + "id": 6, + "options": { + "default": "JS_NORMAL" + } + }, + "lazy": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "weak": { + "type": "bool", + "id": 10, + "options": { + "default": false, + "deprecated": true + } + }, + "debugRedact": { + "type": "bool", + "id": 16, + "options": { + "default": false + } + }, + "retention": { + "type": "OptionRetention", + "id": 17 + }, + "targets": { + "rule": "repeated", + "type": "OptionTargetType", + "id": 19 + }, + "editionDefaults": { + "rule": "repeated", + "type": "EditionDefault", + "id": 20 + }, + "features": { + "type": "FeatureSet", + "id": 21 + }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ], + [ + 18, + 18 + ] + ], + "nested": { + "CType": { + "values": { + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2 + } + }, + "JSType": { + "values": { + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2 + } + }, + "OptionRetention": { + "values": { + "RETENTION_UNKNOWN": 0, + "RETENTION_RUNTIME": 1, + "RETENTION_SOURCE": 2 + } + }, + "OptionTargetType": { + "values": { + "TARGET_TYPE_UNKNOWN": 0, + "TARGET_TYPE_FILE": 1, + "TARGET_TYPE_EXTENSION_RANGE": 2, + "TARGET_TYPE_MESSAGE": 3, + "TARGET_TYPE_FIELD": 4, + "TARGET_TYPE_ONEOF": 5, + "TARGET_TYPE_ENUM": 6, + "TARGET_TYPE_ENUM_ENTRY": 7, + "TARGET_TYPE_SERVICE": 8, + "TARGET_TYPE_METHOD": 9 + } + }, + "EditionDefault": { + "fields": { + "edition": { + "type": "Edition", + "id": 3 + }, + "value": { + "type": "string", + "id": 2 + } + } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } + } + } + }, + "OneofOptions": { + "edition": "proto2", + "fields": { + "features": { + "type": "FeatureSet", + "id": 1 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "EnumOptions": { + "edition": "proto2", + "fields": { + "allowAlias": { + "type": "bool", + "id": 2 + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "deprecatedLegacyJsonFieldConflicts": { + "type": "bool", + "id": 6, + "options": { + "deprecated": true + } + }, + "features": { + "type": "FeatureSet", + "id": 7 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 5, + 5 + ] + ] + }, + "EnumValueOptions": { + "edition": "proto2", + "fields": { + "deprecated": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "features": { + "type": "FeatureSet", + "id": 2 + }, + "debugRedact": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "ServiceOptions": { + "edition": "proto2", + "fields": { + "features": { + "type": "FeatureSet", + "id": 34 + }, + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "MethodOptions": { + "edition": "proto2", + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "idempotencyLevel": { + "type": "IdempotencyLevel", + "id": 34, + "options": { + "default": "IDEMPOTENCY_UNKNOWN" + } + }, + "features": { + "type": "FeatureSet", + "id": 35 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "nested": { + "IdempotencyLevel": { + "values": { + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2 + } + } + } + }, + "UninterpretedOption": { + "edition": "proto2", + "fields": { + "name": { + "rule": "repeated", + "type": "NamePart", + "id": 2 + }, + "identifierValue": { + "type": "string", + "id": 3 + }, + "positiveIntValue": { + "type": "uint64", + "id": 4 + }, + "negativeIntValue": { + "type": "int64", + "id": 5 + }, + "doubleValue": { + "type": "double", + "id": 6 + }, + "stringValue": { + "type": "bytes", + "id": 7 + }, + "aggregateValue": { + "type": "string", + "id": 8 + } + }, + "nested": { + "NamePart": { + "fields": { + "namePart": { + "rule": "required", + "type": "string", + "id": 1 + }, + "isExtension": { + "rule": "required", + "type": "bool", + "id": 2 + } + } + } + } + }, + "FeatureSet": { + "edition": "proto2", + "fields": { + "fieldPresence": { + "type": "FieldPresence", + "id": 1, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_2023", + "edition_defaults.value": "EXPLICIT" + } + }, + "enumType": { + "type": "EnumType", + "id": 2, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_PROTO3", + "edition_defaults.value": "OPEN" + } + }, + "repeatedFieldEncoding": { + "type": "RepeatedFieldEncoding", + "id": 3, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_PROTO3", + "edition_defaults.value": "PACKED" + } + }, + "utf8Validation": { + "type": "Utf8Validation", + "id": 4, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_PROTO3", + "edition_defaults.value": "VERIFY" + } + }, + "messageEncoding": { + "type": "MessageEncoding", + "id": 5, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", + "edition_defaults.value": "LENGTH_PREFIXED" + } + }, + "jsonFormat": { + "type": "JsonFormat", + "id": 6, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_PROTO3", + "edition_defaults.value": "ALLOW" + } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } + } + }, + "extensions": [ + [ + 1000, + 9994 + ], + [ + 9995, + 9999 + ], + [ + 10000, + 10000 + ] + ], + "reserved": [ + [ + 999, + 999 + ] + ], + "nested": { + "FieldPresence": { + "values": { + "FIELD_PRESENCE_UNKNOWN": 0, + "EXPLICIT": 1, + "IMPLICIT": 2, + "LEGACY_REQUIRED": 3 + } + }, + "EnumType": { + "values": { + "ENUM_TYPE_UNKNOWN": 0, + "OPEN": 1, + "CLOSED": 2 + } + }, + "RepeatedFieldEncoding": { + "values": { + "REPEATED_FIELD_ENCODING_UNKNOWN": 0, + "PACKED": 1, + "EXPANDED": 2 + } + }, + "Utf8Validation": { + "values": { + "UTF8_VALIDATION_UNKNOWN": 0, + "VERIFY": 2, + "NONE": 3 + }, + "reserved": [ + [ + 1, + 1 + ] + ] + }, + "MessageEncoding": { + "values": { + "MESSAGE_ENCODING_UNKNOWN": 0, + "LENGTH_PREFIXED": 1, + "DELIMITED": 2 + } + }, + "JsonFormat": { + "values": { + "JSON_FORMAT_UNKNOWN": 0, + "ALLOW": 1, + "LEGACY_BEST_EFFORT": 2 + } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } + } + } + }, + "FeatureSetDefaults": { + "edition": "proto2", + "fields": { + "defaults": { + "rule": "repeated", + "type": "FeatureSetEditionDefault", + "id": 1 + }, + "minimumEdition": { + "type": "Edition", + "id": 4 + }, + "maximumEdition": { + "type": "Edition", + "id": 5 + } + }, + "nested": { + "FeatureSetEditionDefault": { + "fields": { + "edition": { + "type": "Edition", + "id": 3 + }, + "overridableFeatures": { + "type": "FeatureSet", + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 + } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] + } + } + }, + "SourceCodeInfo": { + "edition": "proto2", + "fields": { + "location": { + "rule": "repeated", + "type": "Location", + "id": 1 + } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], + "nested": { + "Location": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1, + "options": { + "packed": true + } + }, + "span": { + "rule": "repeated", + "type": "int32", + "id": 2, + "options": { + "packed": true + } + }, + "leadingComments": { + "type": "string", + "id": 3 + }, + "trailingComments": { + "type": "string", + "id": 4 + }, + "leadingDetachedComments": { + "rule": "repeated", + "type": "string", + "id": 6 + } + } + } + } + }, + "GeneratedCodeInfo": { + "edition": "proto2", + "fields": { + "annotation": { + "rule": "repeated", + "type": "Annotation", + "id": 1 + } + }, + "nested": { + "Annotation": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1, + "options": { + "packed": true + } + }, + "sourceFile": { + "type": "string", + "id": 2 + }, + "begin": { + "type": "int32", + "id": 3 + }, + "end": { + "type": "int32", + "id": 4 + }, + "semantic": { + "type": "Semantic", + "id": 5 + } + }, + "nested": { + "Semantic": { + "values": { + "NONE": 0, + "SET": 1, + "ALIAS": 2 + } + } + } + } + } + }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "Duration": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "Empty": { + "fields": {} + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Struct": { + "fields": { + "fields": { + "keyType": "string", + "type": "Value", + "id": 1 + } + } + }, + "Value": { + "oneofs": { + "kind": { + "oneof": [ + "nullValue", + "numberValue", + "stringValue", + "boolValue", + "structValue", + "listValue" + ] + } + }, + "fields": { + "nullValue": { + "type": "NullValue", + "id": 1 + }, + "numberValue": { + "type": "double", + "id": 2 + }, + "stringValue": { + "type": "string", + "id": 3 + }, + "boolValue": { + "type": "bool", + "id": 4 + }, + "structValue": { + "type": "Struct", + "id": 5 + }, + "listValue": { + "type": "ListValue", + "id": 6 + } + } + }, + "NullValue": { + "values": { + "NULL_VALUE": 0 + } + }, + "ListValue": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + } + } + }, + "DoubleValue": { + "fields": { + "value": { + "type": "double", + "id": 1 + } + } + }, + "FloatValue": { + "fields": { + "value": { + "type": "float", + "id": 1 + } + } + }, + "Int64Value": { + "fields": { + "value": { + "type": "int64", + "id": 1 + } + } + }, + "UInt64Value": { + "fields": { + "value": { + "type": "uint64", + "id": 1 + } + } + }, + "Int32Value": { + "fields": { + "value": { + "type": "int32", + "id": 1 + } + } + }, + "UInt32Value": { + "fields": { + "value": { + "type": "uint32", + "id": 1 + } + } + }, + "BoolValue": { + "fields": { + "value": { + "type": "bool", + "id": 1 + } + } + }, + "StringValue": { + "fields": { + "value": { + "type": "string", + "id": 1 + } + } + }, + "BytesValue": { + "fields": { + "value": { + "type": "bytes", + "id": 1 + } + } + } + } + }, + "type": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/type/latlng;latlng", + "java_multiple_files": true, + "java_outer_classname": "LatLngProto", + "java_package": "com.google.type", + "objc_class_prefix": "GTP", + "cc_enable_arenas": true + }, + "nested": { + "DayOfWeek": { + "values": { + "DAY_OF_WEEK_UNSPECIFIED": 0, + "MONDAY": 1, + "TUESDAY": 2, + "WEDNESDAY": 3, + "THURSDAY": 4, + "FRIDAY": 5, + "SATURDAY": 6, + "SUNDAY": 7 + } + }, + "LatLng": { + "fields": { + "latitude": { + "type": "double", + "id": 1 + }, + "longitude": { + "type": "double", + "id": 2 + } + } + } + } + }, + "longrunning": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.LongRunning", + "go_package": "cloud.google.com/go/longrunning/autogen/longrunningpb;longrunningpb", + "java_multiple_files": true, + "java_outer_classname": "OperationsProto", + "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", + "php_namespace": "Google\\LongRunning" + }, + "nested": { + "operationInfo": { + "type": "google.longrunning.OperationInfo", + "id": 1049, + "extend": "google.protobuf.MethodOptions" + }, + "Operations": { + "options": { + "(google.api.default_host)": "longrunning.googleapis.com" + }, + "methods": { + "ListOperations": { + "requestType": "ListOperationsRequest", + "responseType": "ListOperationsResponse", + "options": { + "(google.api.http).get": "/v1/{name=operations}", + "(google.api.method_signature)": "name,filter" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations}" + } + }, + { + "(google.api.method_signature)": "name,filter" + } + ] + }, + "GetOperation": { + "requestType": "GetOperationRequest", + "responseType": "Operation", + "options": { + "(google.api.http).get": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteOperation": { + "requestType": "DeleteOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CancelOperation": { + "requestType": "CancelOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v1/{name=operations/**}:cancel", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=operations/**}:cancel", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "WaitOperation": { + "requestType": "WaitOperationRequest", + "responseType": "Operation" + } + } + }, + "Operation": { + "oneofs": { + "result": { + "oneof": [ + "error", + "response" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "metadata": { + "type": "google.protobuf.Any", + "id": 2 + }, + "done": { + "type": "bool", + "id": 3 + }, + "error": { + "type": "google.rpc.Status", + "id": 4 + }, + "response": { + "type": "google.protobuf.Any", + "id": 5 + } + } + }, + "GetOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "ListOperationsRequest": { + "fields": { + "name": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 1 + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListOperationsResponse": { + "fields": { + "operations": { + "rule": "repeated", + "type": "Operation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CancelOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "DeleteOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "WaitOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "timeout": { + "type": "google.protobuf.Duration", + "id": 2 + } + } + }, + "OperationInfo": { + "fields": { + "responseType": { + "type": "string", + "id": 1 + }, + "metadataType": { + "type": "string", + "id": 2 + } + } + } + } + }, + "rpc": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", + "java_multiple_files": true, + "java_outer_classname": "StatusProto", + "java_package": "com.google.rpc", + "objc_class_prefix": "RPC" + }, + "nested": { + "Status": { + "fields": { + "code": { + "type": "int32", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "details": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.batch_get_documents.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.batch_get_documents.js new file mode 100644 index 000000000000..cc7ed84b0114 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.batch_get_documents.js @@ -0,0 +1,95 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1_generated_Firestore_BatchGetDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * The names of the documents to retrieve. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * The request will fail if any of the document is not a child resource of the + * given `database`. Duplicate names will be elided. + */ + // const documents = ['abc','def'] + /** + * The fields to return. If not set, returns all fields. + * If a document has a field that is not present in this mask, that field will + * not be returned in the response. + */ + // const mask = {} + /** + * Reads documents in a transaction. + */ + // const transaction = Buffer.from('string') + /** + * Starts a new transaction and reads the documents. + * Defaults to a read-only transaction. + * The new transaction ID will be returned as the first response in the + * stream. + */ + // const newTransaction = {} + /** + * Reads documents as they were at the given time. + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + */ + // const readTime = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callBatchGetDocuments() { + // Construct request + const request = { + database, + }; + + // Run request + const stream = await firestoreClient.batchGetDocuments(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callBatchGetDocuments(); + // [END firestore_v1_generated_Firestore_BatchGetDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.batch_write.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.batch_write.js new file mode 100644 index 000000000000..9af564b9f5c3 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.batch_write.js @@ -0,0 +1,73 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1_generated_Firestore_BatchWrite_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * The writes to apply. + * Method does not apply writes atomically and does not guarantee ordering. + * Each write succeeds or fails independently. You cannot write to the same + * document more than once per request. + */ + // const writes = [1,2,3,4] + /** + * Labels associated with this batch write. + */ + // const labels = [1,2,3,4] + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callBatchWrite() { + // Construct request + const request = { + database, + }; + + // Run request + const response = await firestoreClient.batchWrite(request); + console.log(response); + } + + callBatchWrite(); + // [END firestore_v1_generated_Firestore_BatchWrite_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.begin_transaction.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.begin_transaction.js new file mode 100644 index 000000000000..0b18d4c0dbbd --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.begin_transaction.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1_generated_Firestore_BeginTransaction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * The options for the transaction. + * Defaults to a read-write transaction. + */ + // const options = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callBeginTransaction() { + // Construct request + const request = { + database, + }; + + // Run request + const response = await firestoreClient.beginTransaction(request); + console.log(response); + } + + callBeginTransaction(); + // [END firestore_v1_generated_Firestore_BeginTransaction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.commit.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.commit.js new file mode 100644 index 000000000000..497347241af2 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.commit.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1_generated_Firestore_Commit_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * The writes to apply. + * Always executed atomically and in order. + */ + // const writes = [1,2,3,4] + /** + * If set, applies all writes in this transaction, and commits it. + */ + // const transaction = Buffer.from('string') + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callCommit() { + // Construct request + const request = { + database, + }; + + // Run request + const response = await firestoreClient.commit(request); + console.log(response); + } + + callCommit(); + // [END firestore_v1_generated_Firestore_Commit_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.create_document.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.create_document.js new file mode 100644 index 000000000000..2e6d79ee5089 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.create_document.js @@ -0,0 +1,85 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, collectionId, document) { + // [START firestore_v1_generated_Firestore_CreateDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource. For example: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}` + */ + // const parent = 'abc123' + /** + * Required. The collection ID, relative to `parent`, to list. For example: + * `chatrooms`. + */ + // const collectionId = 'abc123' + /** + * The client-assigned document ID to use for this document. + * Optional. If not specified, an ID will be assigned by the service. + */ + // const documentId = 'abc123' + /** + * Required. The document to create. `name` must not be set. + */ + // const document = {} + /** + * The fields to return. If not set, returns all fields. + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + */ + // const mask = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callCreateDocument() { + // Construct request + const request = { + parent, + collectionId, + document, + }; + + // Run request + const response = await firestoreClient.createDocument(request); + console.log(response); + } + + callCreateDocument(); + // [END firestore_v1_generated_Firestore_CreateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.delete_document.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.delete_document.js new file mode 100644 index 000000000000..c5603d6f487a --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.delete_document.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_Firestore_DeleteDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Document to delete. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + */ + // const name = 'abc123' + /** + * An optional precondition on the document. + * The request will fail if this is set and not met by the target document. + */ + // const currentDocument = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callDeleteDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await firestoreClient.deleteDocument(request); + console.log(response); + } + + callDeleteDocument(); + // [END firestore_v1_generated_Firestore_DeleteDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.execute_pipeline.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.execute_pipeline.js new file mode 100644 index 000000000000..d4828129606b --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.execute_pipeline.js @@ -0,0 +1,92 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1_generated_Firestore_ExecutePipeline_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Database identifier, in the form + * `projects/{project}/databases/{database}`. + */ + // const database = 'abc123' + /** + * A pipelined operation. + */ + // const structuredPipeline = {} + /** + * Run the query within an already active transaction. + * The value here is the opaque transaction ID to execute the query in. + */ + // const transaction = Buffer.from('string') + /** + * Execute the pipeline in a new transaction. + * The identifier of the newly created transaction will be returned in the + * first response on the stream. This defaults to a read-only transaction. + */ + // const newTransaction = {} + /** + * Execute the pipeline in a snapshot transaction at the given time. + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + */ + // const readTime = {} + /** + * Optional. Automatically commits the transaction after the pipeline has been + * executed. Only permitted in combination with `transaction` or + * `new_transaction`. + */ + // const autoCommitTransaction = true + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callExecutePipeline() { + // Construct request + const request = { + database, + }; + + // Run request + const stream = await firestoreClient.executePipeline(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callExecutePipeline(); + // [END firestore_v1_generated_Firestore_ExecutePipeline_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.get_document.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.get_document.js new file mode 100644 index 000000000000..893795fb97df --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.get_document.js @@ -0,0 +1,79 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_Firestore_GetDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Document to get. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + */ + // const name = 'abc123' + /** + * The fields to return. If not set, returns all fields. + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + */ + // const mask = {} + /** + * Reads the document in a transaction. + */ + // const transaction = Buffer.from('string') + /** + * Reads the version of the document at the given time. + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + */ + // const readTime = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callGetDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await firestoreClient.getDocument(request); + console.log(response); + } + + callGetDocument(); + // [END firestore_v1_generated_Firestore_GetDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.list_collection_ids.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.list_collection_ids.js new file mode 100644 index 000000000000..f051bb45d5b2 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.list_collection_ids.js @@ -0,0 +1,84 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_Firestore_ListCollectionIds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent document. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * Use `projects/{project_id}/databases/{database_id}/documents` to list + * top-level collections. + */ + // const parent = 'abc123' + /** + * The maximum number of results to return. + */ + // const pageSize = 1234 + /** + * A page token. Must be a value from + * ListCollectionIdsResponse google.firestore.v1.ListCollectionIdsResponse. + */ + // const pageToken = 'abc123' + /** + * Reads documents as they were at the given time. + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + */ + // const readTime = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callListCollectionIds() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = firestoreClient.listCollectionIdsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCollectionIds(); + // [END firestore_v1_generated_Firestore_ListCollectionIds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.list_documents.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.list_documents.js new file mode 100644 index 000000000000..6ac06308f271 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.list_documents.js @@ -0,0 +1,122 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_Firestore_ListDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + */ + // const parent = 'abc123' + /** + * Optional. The collection ID, relative to `parent`, to list. + * For example: `chatrooms` or `messages`. + * This is optional, and when not provided, Firestore will list documents + * from all collections under the provided `parent`. + */ + // const collectionId = 'abc123' + /** + * Optional. The maximum number of documents to return in a single response. + * Firestore may return fewer than this value. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListDocuments` response. + * Provide this to retrieve the subsequent page. When paginating, all other + * parameters (with the exception of `page_size`) must match the values set + * in the request that generated the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The optional ordering of the documents to return. + * For example: `priority desc, __name__ desc`. + * This mirrors the `ORDER BY` google.firestore.v1.StructuredQuery.order_by + * used in Firestore queries but in a string representation. When absent, + * documents are ordered based on `__name__ ASC`. + */ + // const orderBy = 'abc123' + /** + * Optional. The fields to return. If not set, returns all fields. + * If a document has a field that is not present in this mask, that field + * will not be returned in the response. + */ + // const mask = {} + /** + * Perform the read as part of an already active transaction. + */ + // const transaction = Buffer.from('string') + /** + * Perform the read at the provided time. + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + */ + // const readTime = {} + /** + * If the list should show missing documents. + * A document is missing if it does not exist, but there are sub-documents + * nested underneath it. When true, such missing documents will be returned + * with a key but will not have fields, + * `create_time` google.firestore.v1.Document.create_time, or + * `update_time` google.firestore.v1.Document.update_time set. + * Requests with `show_missing` may not specify `where` or `order_by`. + */ + // const showMissing = true + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callListDocuments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = firestoreClient.listDocumentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDocuments(); + // [END firestore_v1_generated_Firestore_ListDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.listen.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.listen.js new file mode 100644 index 000000000000..75e652515a9d --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.listen.js @@ -0,0 +1,78 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1_generated_Firestore_Listen_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * A target to add to this stream. + */ + // const addTarget = {} + /** + * The ID of a target to remove from this stream. + */ + // const removeTarget = 1234 + /** + * Labels associated with this target change. + */ + // const labels = [1,2,3,4] + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callListen() { + // Construct request + const request = { + database, + }; + + // Run request + const stream = await firestoreClient.listen(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callListen(); + // [END firestore_v1_generated_Firestore_Listen_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.partition_query.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.partition_query.js new file mode 100644 index 000000000000..99f7fba7fe41 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.partition_query.js @@ -0,0 +1,112 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_Firestore_PartitionQuery_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents`. + * Document resource names are not supported; only database resource names + * can be specified. + */ + // const parent = 'abc123' + /** + * A structured query. + * Query must specify collection with all descendants and be ordered by name + * ascending. Other filters, order bys, limits, offsets, and start/end + * cursors are not supported. + */ + // const structuredQuery = {} + /** + * The desired maximum number of partition points. + * The partitions may be returned across multiple pages of results. + * The number must be positive. The actual number of partitions + * returned may be fewer. + * For example, this may be set to one fewer than the number of parallel + * queries to be run, or in running a data pipeline job, one fewer than the + * number of workers or compute instances available. + */ + // const partitionCount = 1234 + /** + * The `next_page_token` value returned from a previous call to + * PartitionQuery that may be used to get an additional set of results. + * There are no ordering guarantees between sets of results. Thus, using + * multiple sets of results will require merging the different result sets. + * For example, two subsequent calls using a page_token may return: + * * cursor B, cursor M, cursor Q + * * cursor A, cursor U, cursor W + * To obtain a complete result set ordered with respect to the results of the + * query supplied to PartitionQuery, the results sets should be merged: + * cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + */ + // const pageToken = 'abc123' + /** + * The maximum number of partitions to return in this call, subject to + * `partition_count`. + * For example, if `partition_count` = 10 and `page_size` = 8, the first call + * to PartitionQuery will return up to 8 partitions and a `next_page_token` + * if more results exist. A second call to PartitionQuery will return up to + * 2 partitions, to complete the total of 10 specified in `partition_count`. + */ + // const pageSize = 1234 + /** + * Reads documents as they were at the given time. + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + */ + // const readTime = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callPartitionQuery() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = firestoreClient.partitionQueryAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callPartitionQuery(); + // [END firestore_v1_generated_Firestore_PartitionQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.rollback.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.rollback.js new file mode 100644 index 000000000000..e92cff23212a --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.rollback.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database, transaction) { + // [START firestore_v1_generated_Firestore_Rollback_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * Required. The transaction to roll back. + */ + // const transaction = Buffer.from('string') + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callRollback() { + // Construct request + const request = { + database, + transaction, + }; + + // Run request + const response = await firestoreClient.rollback(request); + console.log(response); + } + + callRollback(); + // [END firestore_v1_generated_Firestore_Rollback_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.run_aggregation_query.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.run_aggregation_query.js new file mode 100644 index 000000000000..c49a0bd287d3 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.run_aggregation_query.js @@ -0,0 +1,95 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_Firestore_RunAggregationQuery_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + */ + // const parent = 'abc123' + /** + * An aggregation query. + */ + // const structuredAggregationQuery = {} + /** + * Run the aggregation within an already active transaction. + * The value here is the opaque transaction ID to execute the query in. + */ + // const transaction = Buffer.from('string') + /** + * Starts a new transaction as part of the query, defaulting to read-only. + * The new transaction ID will be returned as the first response in the + * stream. + */ + // const newTransaction = {} + /** + * Executes the query at the given timestamp. + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + */ + // const readTime = {} + /** + * Optional. Explain options for the query. If set, additional query + * statistics will be returned. If not, only query results will be returned. + */ + // const explainOptions = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callRunAggregationQuery() { + // Construct request + const request = { + parent, + }; + + // Run request + const stream = await firestoreClient.runAggregationQuery(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callRunAggregationQuery(); + // [END firestore_v1_generated_Firestore_RunAggregationQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.run_query.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.run_query.js new file mode 100644 index 000000000000..404fe86c9b97 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.run_query.js @@ -0,0 +1,96 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_Firestore_RunQuery_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + */ + // const parent = 'abc123' + /** + * A structured query. + */ + // const structuredQuery = {} + /** + * Run the query within an already active transaction. + * The value here is the opaque transaction ID to execute the query in. + */ + // const transaction = Buffer.from('string') + /** + * Starts a new transaction and reads the documents. + * Defaults to a read-only transaction. + * The new transaction ID will be returned as the first response in the + * stream. + */ + // const newTransaction = {} + /** + * Reads documents as they were at the given time. + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + */ + // const readTime = {} + /** + * Optional. Explain options for the query. If set, additional query + * statistics will be returned. If not, only query results will be returned. + */ + // const explainOptions = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callRunQuery() { + // Construct request + const request = { + parent, + }; + + // Run request + const stream = await firestoreClient.runQuery(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callRunQuery(); + // [END firestore_v1_generated_Firestore_RunQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.update_document.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.update_document.js new file mode 100644 index 000000000000..020d4a5e5784 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.update_document.js @@ -0,0 +1,82 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(document) { + // [START firestore_v1_generated_Firestore_UpdateDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The updated document. + * Creates the document if it does not already exist. + */ + // const document = {} + /** + * The fields to update. + * None of the field paths in the mask may contain a reserved name. + * If the document exists on the server and has fields not referenced in the + * mask, they are left unchanged. + * Fields referenced in the mask, but not present in the input document, are + * deleted from the document on the server. + */ + // const updateMask = {} + /** + * The fields to return. If not set, returns all fields. + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + */ + // const mask = {} + /** + * An optional precondition on the document. + * The request will fail if this is set and not met by the target document. + */ + // const currentDocument = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callUpdateDocument() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await firestoreClient.updateDocument(request); + console.log(response); + } + + callUpdateDocument(); + // [END firestore_v1_generated_Firestore_UpdateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore.write.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.write.js new file mode 100644 index 000000000000..29287e6dd4b8 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore.write.js @@ -0,0 +1,98 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1_generated_Firestore_Write_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * This is only required in the first message. + */ + // const database = 'abc123' + /** + * The ID of the write stream to resume. + * This may only be set in the first message. When left empty, a new write + * stream will be created. + */ + // const streamId = 'abc123' + /** + * The writes to apply. + * Always executed atomically and in order. + * This must be empty on the first request. + * This may be empty on the last request. + * This must not be empty on all other requests. + */ + // const writes = [1,2,3,4] + /** + * A stream token that was previously sent by the server. + * The client should set this field to the token from the most recent + * WriteResponse google.firestore.v1.WriteResponse it has received. This + * acknowledges that the client has received responses up to this token. After + * sending this token, earlier tokens may not be used anymore. + * The server may close the stream if there are too many unacknowledged + * responses. + * Leave this field unset when creating a new stream. To resume a stream at + * a specific point, set this field and the `stream_id` field. + * Leave this field unset when creating a new stream. + */ + // const streamToken = Buffer.from('string') + /** + * Labels associated with this write request. + */ + // const labels = [1,2,3,4] + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callWrite() { + // Construct request + const request = { + database, + }; + + // Run request + const stream = await firestoreClient.write(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callWrite(); + // [END firestore_v1_generated_Firestore_Write_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.bulk_delete_documents.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.bulk_delete_documents.js new file mode 100644 index 000000000000..44c31b022e48 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.bulk_delete_documents.js @@ -0,0 +1,79 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_BulkDeleteDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Database to operate. Should be of the form: + * `projects/{project_id}/databases/{database_id}`. + */ + // const name = 'abc123' + /** + * Optional. IDs of the collection groups to delete. Unspecified means all + * collection groups. + * Each collection group in this list must be unique. + */ + // const collectionIds = ['abc','def'] + /** + * Optional. Namespaces to delete. + * An empty list means all namespaces. This is the recommended + * usage for databases that don't use namespaces. + * An empty string element represents the default namespace. This should be + * used if the database has data in non-default namespaces, but doesn't want + * to delete from them. + * Each namespace in this list must be unique. + */ + // const namespaceIds = ['abc','def'] + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callBulkDeleteDocuments() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await adminClient.bulkDeleteDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBulkDeleteDocuments(); + // [END firestore_v1_generated_FirestoreAdmin_BulkDeleteDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.clone_database.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.clone_database.js new file mode 100644 index 000000000000..3c1cb46b3b25 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.clone_database.js @@ -0,0 +1,96 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, databaseId, pitrSnapshot, tags) { + // [START firestore_v1_generated_FirestoreAdmin_CloneDatabase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to clone the database in. Format is + * `projects/{project_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID to use for the database, which will become the final + * component of the database's resource name. This database ID must not be + * associated with an existing database. + * This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ + * with first character a letter and the last a letter or a number. Must not + * be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + * "(default)" database ID is also valid if the database is Standard edition. + */ + // const databaseId = 'abc123' + /** + * Required. Specification of the PITR data to clone from. The source database + * must exist. + * The cloned database will be created in the same location as the source + * database. + */ + // const pitrSnapshot = {} + /** + * Optional. Encryption configuration for the cloned database. + * If this field is not specified, the cloned database will use + * the same encryption configuration as the source database, namely + * use_source_encryption google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption. + */ + // const encryptionConfig = {} + /** + * Optional. Immutable. Tags to be bound to the cloned database. + * The tags should be provided in the format of + * `tagKeys/{tag_key_id} -> tagValues/{tag_value_id}`. + */ + // const tags = [1,2,3,4] + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callCloneDatabase() { + // Construct request + const request = { + parent, + databaseId, + pitrSnapshot, + tags, + }; + + // Run request + const [operation] = await adminClient.cloneDatabase(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCloneDatabase(); + // [END firestore_v1_generated_FirestoreAdmin_CloneDatabase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_backup_schedule.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_backup_schedule.js new file mode 100644 index 000000000000..71b5a00c9222 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_backup_schedule.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, backupSchedule) { + // [START firestore_v1_generated_FirestoreAdmin_CreateBackupSchedule_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent database. + * Format `projects/{project}/databases/{database}` + */ + // const parent = 'abc123' + /** + * Required. The backup schedule to create. + */ + // const backupSchedule = {} + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callCreateBackupSchedule() { + // Construct request + const request = { + parent, + backupSchedule, + }; + + // Run request + const response = await adminClient.createBackupSchedule(request); + console.log(response); + } + + callCreateBackupSchedule(); + // [END firestore_v1_generated_FirestoreAdmin_CreateBackupSchedule_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_database.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_database.js new file mode 100644 index 000000000000..26d885b09f40 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_database.js @@ -0,0 +1,78 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, database, databaseId) { + // [START firestore_v1_generated_FirestoreAdmin_CreateDatabase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A parent name of the form + * `projects/{project_id}` + */ + // const parent = 'abc123' + /** + * Required. The Database to create. + */ + // const database = {} + /** + * Required. The ID to use for the database, which will become the final + * component of the database's resource name. + * This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ + * with first character a letter and the last a letter or a number. Must not + * be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + * "(default)" database ID is also valid if the database is Standard edition. + */ + // const databaseId = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callCreateDatabase() { + // Construct request + const request = { + parent, + database, + databaseId, + }; + + // Run request + const [operation] = await adminClient.createDatabase(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateDatabase(); + // [END firestore_v1_generated_FirestoreAdmin_CreateDatabase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_index.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_index.js new file mode 100644 index 000000000000..735acac27a72 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_index.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, index) { + // [START firestore_v1_generated_FirestoreAdmin_CreateIndex_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + */ + // const parent = 'abc123' + /** + * Required. The composite index to create. + */ + // const index = {} + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callCreateIndex() { + // Construct request + const request = { + parent, + index, + }; + + // Run request + const [operation] = await adminClient.createIndex(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateIndex(); + // [END firestore_v1_generated_FirestoreAdmin_CreateIndex_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_user_creds.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_user_creds.js new file mode 100644 index 000000000000..7ab730f9c4f7 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.create_user_creds.js @@ -0,0 +1,76 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, userCreds, userCredsId) { + // [START firestore_v1_generated_FirestoreAdmin_CreateUserCreds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}` + */ + // const parent = 'abc123' + /** + * Required. The user creds to create. + */ + // const userCreds = {} + /** + * Required. The ID to use for the user creds, which will become the final + * component of the user creds's resource name. + * This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ + * with first character a letter and the last a letter or a number. Must not + * be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + */ + // const userCredsId = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callCreateUserCreds() { + // Construct request + const request = { + parent, + userCreds, + userCredsId, + }; + + // Run request + const response = await adminClient.createUserCreds(request); + console.log(response); + } + + callCreateUserCreds(); + // [END firestore_v1_generated_FirestoreAdmin_CreateUserCreds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_backup.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_backup.js new file mode 100644 index 000000000000..ede6d42f48e5 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_backup.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_DeleteBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the backup to delete. + * format is `projects/{project}/locations/{location}/backups/{backup}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteBackup(request); + console.log(response); + } + + callDeleteBackup(); + // [END firestore_v1_generated_FirestoreAdmin_DeleteBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_backup_schedule.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_backup_schedule.js new file mode 100644 index 000000000000..03c1b639b0e7 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_backup_schedule.js @@ -0,0 +1,63 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_DeleteBackupSchedule_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the backup schedule. + * Format + * `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callDeleteBackupSchedule() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteBackupSchedule(request); + console.log(response); + } + + callDeleteBackupSchedule(); + // [END firestore_v1_generated_FirestoreAdmin_DeleteBackupSchedule_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_database.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_database.js new file mode 100644 index 000000000000..a319c304abbf --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_database.js @@ -0,0 +1,69 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_DeleteDatabase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}` + */ + // const name = 'abc123' + /** + * The current etag of the Database. + * If an etag is provided and does not match the current etag of the database, + * deletion will be blocked and a FAILED_PRECONDITION error will be returned. + */ + // const etag = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callDeleteDatabase() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await adminClient.deleteDatabase(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteDatabase(); + // [END firestore_v1_generated_FirestoreAdmin_DeleteDatabase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_index.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_index.js new file mode 100644 index 000000000000..db8fb4ef8d57 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_index.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_DeleteIndex_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callDeleteIndex() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteIndex(request); + console.log(response); + } + + callDeleteIndex(); + // [END firestore_v1_generated_FirestoreAdmin_DeleteIndex_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_user_creds.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_user_creds.js new file mode 100644 index 000000000000..50b7a4f0ba90 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.delete_user_creds.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_DeleteUserCreds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callDeleteUserCreds() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteUserCreds(request); + console.log(response); + } + + callDeleteUserCreds(); + // [END firestore_v1_generated_FirestoreAdmin_DeleteUserCreds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.disable_user_creds.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.disable_user_creds.js new file mode 100644 index 000000000000..cb84a90403b3 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.disable_user_creds.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_DisableUserCreds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callDisableUserCreds() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.disableUserCreds(request); + console.log(response); + } + + callDisableUserCreds(); + // [END firestore_v1_generated_FirestoreAdmin_DisableUserCreds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.enable_user_creds.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.enable_user_creds.js new file mode 100644 index 000000000000..ebab94b604cd --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.enable_user_creds.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_EnableUserCreds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callEnableUserCreds() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.enableUserCreds(request); + console.log(response); + } + + callEnableUserCreds(); + // [END firestore_v1_generated_FirestoreAdmin_EnableUserCreds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.export_documents.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.export_documents.js new file mode 100644 index 000000000000..f414d87e4d7e --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.export_documents.js @@ -0,0 +1,97 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_ExportDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Database to export. Should be of the form: + * `projects/{project_id}/databases/{database_id}`. + */ + // const name = 'abc123' + /** + * IDs of the collection groups to export. Unspecified means all + * collection groups. Each collection group in this list must be unique. + */ + // const collectionIds = ['abc','def'] + /** + * The output URI. Currently only supports Google Cloud Storage URIs of the + * form: `gs://BUCKET_NAME/NAMESPACE_PATH`, where `BUCKET_NAME` is the name + * of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional + * Google Cloud Storage namespace path. When + * choosing a name, be sure to consider Google Cloud Storage naming + * guidelines: https://cloud.google.com/storage/docs/naming. + * If the URI is a bucket (without a namespace path), a prefix will be + * generated based on the start time. + */ + // const outputUriPrefix = 'abc123' + /** + * An empty list represents all namespaces. This is the preferred + * usage for databases that don't use namespaces. + * An empty string element represents the default namespace. This should be + * used if the database has data in non-default namespaces, but doesn't want + * to include them. Each namespace in this list must be unique. + */ + // const namespaceIds = ['abc','def'] + /** + * The timestamp that corresponds to the version of the database to be + * exported. The timestamp must be in the past, rounded to the minute and not + * older than + * earliestVersionTime google.firestore.admin.v1.Database.earliest_version_time. + * If specified, then the exported documents will represent a consistent view + * of the database at the provided time. Otherwise, there are no guarantees + * about the consistency of the exported documents. + */ + // const snapshotTime = {} + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callExportDocuments() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await adminClient.exportDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportDocuments(); + // [END firestore_v1_generated_FirestoreAdmin_ExportDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_backup.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_backup.js new file mode 100644 index 000000000000..511c1b81ac15 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_backup.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_GetBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the backup to fetch. + * Format is `projects/{project}/locations/{location}/backups/{backup}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END firestore_v1_generated_FirestoreAdmin_GetBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_backup_schedule.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_backup_schedule.js new file mode 100644 index 000000000000..05a2739020d6 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_backup_schedule.js @@ -0,0 +1,63 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_GetBackupSchedule_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the backup schedule. + * Format + * `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callGetBackupSchedule() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getBackupSchedule(request); + console.log(response); + } + + callGetBackupSchedule(); + // [END firestore_v1_generated_FirestoreAdmin_GetBackupSchedule_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_database.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_database.js new file mode 100644 index 000000000000..70f703fb7a93 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_database.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_GetDatabase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callGetDatabase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getDatabase(request); + console.log(response); + } + + callGetDatabase(); + // [END firestore_v1_generated_FirestoreAdmin_GetDatabase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_field.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_field.js new file mode 100644 index 000000000000..69417693fa97 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_field.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_GetField_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callGetField() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getField(request); + console.log(response); + } + + callGetField(); + // [END firestore_v1_generated_FirestoreAdmin_GetField_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_index.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_index.js new file mode 100644 index 000000000000..67b9f13c3d65 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_index.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_GetIndex_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callGetIndex() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getIndex(request); + console.log(response); + } + + callGetIndex(); + // [END firestore_v1_generated_FirestoreAdmin_GetIndex_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_user_creds.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_user_creds.js new file mode 100644 index 000000000000..7a3298229da4 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.get_user_creds.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_GetUserCreds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callGetUserCreds() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getUserCreds(request); + console.log(response); + } + + callGetUserCreds(); + // [END firestore_v1_generated_FirestoreAdmin_GetUserCreds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.import_documents.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.import_documents.js new file mode 100644 index 000000000000..3e652510e364 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.import_documents.js @@ -0,0 +1,85 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_ImportDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Database to import into. Should be of the form: + * `projects/{project_id}/databases/{database_id}`. + */ + // const name = 'abc123' + /** + * IDs of the collection groups to import. Unspecified means all collection + * groups that were included in the export. Each collection group in this list + * must be unique. + */ + // const collectionIds = ['abc','def'] + /** + * Location of the exported files. + * This must match the output_uri_prefix of an ExportDocumentsResponse from + * an export that has completed successfully. + * See: + * google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix. + */ + // const inputUriPrefix = 'abc123' + /** + * An empty list represents all namespaces. This is the preferred + * usage for databases that don't use namespaces. + * An empty string element represents the default namespace. This should be + * used if the database has data in non-default namespaces, but doesn't want + * to include them. Each namespace in this list must be unique. + */ + // const namespaceIds = ['abc','def'] + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callImportDocuments() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await adminClient.importDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportDocuments(); + // [END firestore_v1_generated_FirestoreAdmin_ImportDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_backup_schedules.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_backup_schedules.js new file mode 100644 index 000000000000..3771a5df4471 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_backup_schedules.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_FirestoreAdmin_ListBackupSchedules_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent database. + * Format is `projects/{project}/databases/{database}`. + */ + // const parent = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callListBackupSchedules() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await adminClient.listBackupSchedules(request); + console.log(response); + } + + callListBackupSchedules(); + // [END firestore_v1_generated_FirestoreAdmin_ListBackupSchedules_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_backups.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_backups.js new file mode 100644 index 000000000000..e904adeb08a7 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_backups.js @@ -0,0 +1,77 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_FirestoreAdmin_ListBackups_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The location to list backups from. + * Format is `projects/{project}/locations/{location}`. + * Use `{location} = '-'` to list backups from all locations for the given + * project. This allows listing backups from a single location or from all + * locations. + */ + // const parent = 'abc123' + /** + * An expression that filters the list of returned backups. + * A filter expression consists of a field name, a comparison operator, and a + * value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the Backup google.firestore.admin.v1.Backup are + * eligible for filtering: + * * `database_uid` (supports `=` only) + */ + // const filter = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await adminClient.listBackups(request); + console.log(response); + } + + callListBackups(); + // [END firestore_v1_generated_FirestoreAdmin_ListBackups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_databases.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_databases.js new file mode 100644 index 000000000000..6134f5825646 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_databases.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_FirestoreAdmin_ListDatabases_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A parent name of the form + * `projects/{project_id}` + */ + // const parent = 'abc123' + /** + * If true, also returns deleted resources. + */ + // const showDeleted = true + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callListDatabases() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await adminClient.listDatabases(request); + console.log(response); + } + + callListDatabases(); + // [END firestore_v1_generated_FirestoreAdmin_ListDatabases_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_fields.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_fields.js new file mode 100644 index 000000000000..759d3fed2bbe --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_fields.js @@ -0,0 +1,84 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_FirestoreAdmin_ListFields_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + */ + // const parent = 'abc123' + /** + * The filter to apply to list results. Currently, + * FirestoreAdmin.ListFields google.firestore.admin.v1.FirestoreAdmin.ListFields + * only supports listing fields that have been explicitly overridden. To issue + * this query, call + * FirestoreAdmin.ListFields google.firestore.admin.v1.FirestoreAdmin.ListFields + * with a filter that includes `indexConfig.usesAncestorConfig:false` or + * `ttlConfig:*`. + */ + // const filter = 'abc123' + /** + * The number of results to return. + */ + // const pageSize = 1234 + /** + * A page token, returned from a previous call to + * FirestoreAdmin.ListFields google.firestore.admin.v1.FirestoreAdmin.ListFields, + * that may be used to get the next page of results. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callListFields() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = adminClient.listFieldsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFields(); + // [END firestore_v1_generated_FirestoreAdmin_ListFields_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_indexes.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_indexes.js new file mode 100644 index 000000000000..84542e5e7c44 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_indexes.js @@ -0,0 +1,78 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_FirestoreAdmin_ListIndexes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + */ + // const parent = 'abc123' + /** + * The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * The number of results to return. + */ + // const pageSize = 1234 + /** + * A page token, returned from a previous call to + * FirestoreAdmin.ListIndexes google.firestore.admin.v1.FirestoreAdmin.ListIndexes, + * that may be used to get the next page of results. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callListIndexes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = adminClient.listIndexesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListIndexes(); + // [END firestore_v1_generated_FirestoreAdmin_ListIndexes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_user_creds.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_user_creds.js new file mode 100644 index 000000000000..7694959f86d2 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.list_user_creds.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1_generated_FirestoreAdmin_ListUserCreds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A parent database name of the form + * `projects/{project_id}/databases/{database_id}` + */ + // const parent = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callListUserCreds() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await adminClient.listUserCreds(request); + console.log(response); + } + + callListUserCreds(); + // [END firestore_v1_generated_FirestoreAdmin_ListUserCreds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.reset_user_password.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.reset_user_password.js new file mode 100644 index 000000000000..836aec687596 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.reset_user_password.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1_generated_FirestoreAdmin_ResetUserPassword_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + */ + // const name = 'abc123' + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callResetUserPassword() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.resetUserPassword(request); + console.log(response); + } + + callResetUserPassword(); + // [END firestore_v1_generated_FirestoreAdmin_ResetUserPassword_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.restore_database.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.restore_database.js new file mode 100644 index 000000000000..7969900cc1c1 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.restore_database.js @@ -0,0 +1,97 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, databaseId, backup, tags) { + // [START firestore_v1_generated_FirestoreAdmin_RestoreDatabase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to restore the database in. Format is + * `projects/{project_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID to use for the database, which will become the final + * component of the database's resource name. This database ID must not be + * associated with an existing database. + * This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ + * with first character a letter and the last a letter or a number. Must not + * be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + * "(default)" database ID is also valid if the database is Standard edition. + */ + // const databaseId = 'abc123' + /** + * Required. Backup to restore from. Must be from the same project as the + * parent. + * The restored database will be created in the same location as the source + * backup. + * Format is: `projects/{project_id}/locations/{location}/backups/{backup}` + */ + // const backup = 'abc123' + /** + * Optional. Encryption configuration for the restored database. + * If this field is not specified, the restored database will use + * the same encryption configuration as the backup, namely + * use_source_encryption google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption. + */ + // const encryptionConfig = {} + /** + * Optional. Immutable. Tags to be bound to the restored database. + * The tags should be provided in the format of + * `tagKeys/{tag_key_id} -> tagValues/{tag_value_id}`. + */ + // const tags = [1,2,3,4] + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callRestoreDatabase() { + // Construct request + const request = { + parent, + databaseId, + backup, + tags, + }; + + // Run request + const [operation] = await adminClient.restoreDatabase(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreDatabase(); + // [END firestore_v1_generated_FirestoreAdmin_RestoreDatabase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.update_backup_schedule.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.update_backup_schedule.js new file mode 100644 index 000000000000..c51754afd681 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.update_backup_schedule.js @@ -0,0 +1,65 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(backupSchedule) { + // [START firestore_v1_generated_FirestoreAdmin_UpdateBackupSchedule_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup schedule to update. + */ + // const backupSchedule = {} + /** + * The list of fields to be updated. + */ + // const updateMask = {} + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callUpdateBackupSchedule() { + // Construct request + const request = { + backupSchedule, + }; + + // Run request + const response = await adminClient.updateBackupSchedule(request); + console.log(response); + } + + callUpdateBackupSchedule(); + // [END firestore_v1_generated_FirestoreAdmin_UpdateBackupSchedule_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.update_database.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.update_database.js new file mode 100644 index 000000000000..04f81c51bd91 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.update_database.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database to update. + */ + // const database = {} + /** + * The list of fields to be updated. + */ + // const updateMask = {} + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callUpdateDatabase() { + // Construct request + const request = { + database, + }; + + // Run request + const [operation] = await adminClient.updateDatabase(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateDatabase(); + // [END firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.update_field.js b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.update_field.js new file mode 100644 index 000000000000..e8dadd8ed588 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1/firestore_admin.update_field.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(field) { + // [START firestore_v1_generated_FirestoreAdmin_UpdateField_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The field to be updated. + */ + // const field = {} + /** + * A mask, relative to the field. If specified, only configuration specified + * by this field_mask will be updated in the field. + */ + // const updateMask = {} + + // Imports the Admin library + const {FirestoreAdminClient} = require('@google-cloud/firestore-api').v1; + + // Instantiates a client + const adminClient = new FirestoreAdminClient(); + + async function callUpdateField() { + // Construct request + const request = { + field, + }; + + // Run request + const [operation] = await adminClient.updateField(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateField(); + // [END firestore_v1_generated_FirestoreAdmin_UpdateField_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.batch_get_documents.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.batch_get_documents.js new file mode 100644 index 000000000000..d49043fc74fb --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.batch_get_documents.js @@ -0,0 +1,93 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1beta1_generated_Firestore_BatchGetDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * The names of the documents to retrieve. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * The request will fail if any of the document is not a child resource of the + * given `database`. Duplicate names will be elided. + */ + // const documents = ['abc','def'] + /** + * The fields to return. If not set, returns all fields. + * If a document has a field that is not present in this mask, that field will + * not be returned in the response. + */ + // const mask = {} + /** + * Reads documents in a transaction. + */ + // const transaction = Buffer.from('string') + /** + * Starts a new transaction and reads the documents. + * Defaults to a read-only transaction. + * The new transaction ID will be returned as the first response in the + * stream. + */ + // const newTransaction = {} + /** + * Reads documents as they were at the given time. + * This may not be older than 270 seconds. + */ + // const readTime = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callBatchGetDocuments() { + // Construct request + const request = { + database, + }; + + // Run request + const stream = await firestoreClient.batchGetDocuments(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callBatchGetDocuments(); + // [END firestore_v1beta1_generated_Firestore_BatchGetDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.batch_write.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.batch_write.js new file mode 100644 index 000000000000..0d8dec79b8a1 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.batch_write.js @@ -0,0 +1,73 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1beta1_generated_Firestore_BatchWrite_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * The writes to apply. + * Method does not apply writes atomically and does not guarantee ordering. + * Each write succeeds or fails independently. You cannot write to the same + * document more than once per request. + */ + // const writes = [1,2,3,4] + /** + * Labels associated with this batch write. + */ + // const labels = [1,2,3,4] + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callBatchWrite() { + // Construct request + const request = { + database, + }; + + // Run request + const response = await firestoreClient.batchWrite(request); + console.log(response); + } + + callBatchWrite(); + // [END firestore_v1beta1_generated_Firestore_BatchWrite_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.begin_transaction.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.begin_transaction.js new file mode 100644 index 000000000000..ea1a04abbb46 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.begin_transaction.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1beta1_generated_Firestore_BeginTransaction_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * The options for the transaction. + * Defaults to a read-write transaction. + */ + // const options = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callBeginTransaction() { + // Construct request + const request = { + database, + }; + + // Run request + const response = await firestoreClient.beginTransaction(request); + console.log(response); + } + + callBeginTransaction(); + // [END firestore_v1beta1_generated_Firestore_BeginTransaction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.commit.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.commit.js new file mode 100644 index 000000000000..06278a65ed2a --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.commit.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1beta1_generated_Firestore_Commit_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * The writes to apply. + * Always executed atomically and in order. + */ + // const writes = [1,2,3,4] + /** + * If set, applies all writes in this transaction, and commits it. + */ + // const transaction = Buffer.from('string') + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callCommit() { + // Construct request + const request = { + database, + }; + + // Run request + const response = await firestoreClient.commit(request); + console.log(response); + } + + callCommit(); + // [END firestore_v1beta1_generated_Firestore_Commit_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.create_document.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.create_document.js new file mode 100644 index 000000000000..5e73cb1466ed --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.create_document.js @@ -0,0 +1,84 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, collectionId, document) { + // [START firestore_v1beta1_generated_Firestore_CreateDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource. For example: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}` + */ + // const parent = 'abc123' + /** + * Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`. + */ + // const collectionId = 'abc123' + /** + * The client-assigned document ID to use for this document. + * Optional. If not specified, an ID will be assigned by the service. + */ + // const documentId = 'abc123' + /** + * Required. The document to create. `name` must not be set. + */ + // const document = {} + /** + * The fields to return. If not set, returns all fields. + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + */ + // const mask = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callCreateDocument() { + // Construct request + const request = { + parent, + collectionId, + document, + }; + + // Run request + const response = await firestoreClient.createDocument(request); + console.log(response); + } + + callCreateDocument(); + // [END firestore_v1beta1_generated_Firestore_CreateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.delete_document.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.delete_document.js new file mode 100644 index 000000000000..6af70bf722a0 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.delete_document.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1beta1_generated_Firestore_DeleteDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Document to delete. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + */ + // const name = 'abc123' + /** + * An optional precondition on the document. + * The request will fail if this is set and not met by the target document. + */ + // const currentDocument = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callDeleteDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await firestoreClient.deleteDocument(request); + console.log(response); + } + + callDeleteDocument(); + // [END firestore_v1beta1_generated_Firestore_DeleteDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.get_document.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.get_document.js new file mode 100644 index 000000000000..59066c2511df --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.get_document.js @@ -0,0 +1,77 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START firestore_v1beta1_generated_Firestore_GetDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Document to get. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + */ + // const name = 'abc123' + /** + * The fields to return. If not set, returns all fields. + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + */ + // const mask = {} + /** + * Reads the document in a transaction. + */ + // const transaction = Buffer.from('string') + /** + * Reads the version of the document at the given time. + * This may not be older than 270 seconds. + */ + // const readTime = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callGetDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await firestoreClient.getDocument(request); + console.log(response); + } + + callGetDocument(); + // [END firestore_v1beta1_generated_Firestore_GetDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.list_collection_ids.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.list_collection_ids.js new file mode 100644 index 000000000000..26bbc70a91fa --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.list_collection_ids.js @@ -0,0 +1,75 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1beta1_generated_Firestore_ListCollectionIds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent document. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + */ + // const parent = 'abc123' + /** + * The maximum number of results to return. + */ + // const pageSize = 1234 + /** + * A page token. Must be a value from + * ListCollectionIdsResponse google.firestore.v1beta1.ListCollectionIdsResponse. + */ + // const pageToken = 'abc123' + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callListCollectionIds() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = firestoreClient.listCollectionIdsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCollectionIds(); + // [END firestore_v1beta1_generated_Firestore_ListCollectionIds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.list_documents.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.list_documents.js new file mode 100644 index 000000000000..0003d39996ad --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.list_documents.js @@ -0,0 +1,110 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, collectionId) { + // [START firestore_v1beta1_generated_Firestore_ListDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + */ + // const parent = 'abc123' + /** + * Required. The collection ID, relative to `parent`, to list. For example: `chatrooms` + * or `messages`. + */ + // const collectionId = 'abc123' + /** + * The maximum number of documents to return. + */ + // const pageSize = 1234 + /** + * The `next_page_token` value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * The order to sort results by. For example: `priority desc, name`. + */ + // const orderBy = 'abc123' + /** + * The fields to return. If not set, returns all fields. + * If a document has a field that is not present in this mask, that field + * will not be returned in the response. + */ + // const mask = {} + /** + * Reads documents in a transaction. + */ + // const transaction = Buffer.from('string') + /** + * Reads documents as they were at the given time. + * This may not be older than 270 seconds. + */ + // const readTime = {} + /** + * If the list should show missing documents. A missing document is a + * document that does not exist but has sub-documents. These documents will + * be returned with a key but will not have fields, Document.create_time google.firestore.v1beta1.Document.create_time, + * or Document.update_time google.firestore.v1beta1.Document.update_time set. + * Requests with `show_missing` may not specify `where` or + * `order_by`. + */ + // const showMissing = true + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callListDocuments() { + // Construct request + const request = { + parent, + collectionId, + }; + + // Run request + const iterable = firestoreClient.listDocumentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDocuments(); + // [END firestore_v1beta1_generated_Firestore_ListDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.listen.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.listen.js new file mode 100644 index 000000000000..e737b189a984 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.listen.js @@ -0,0 +1,78 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1beta1_generated_Firestore_Listen_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * A target to add to this stream. + */ + // const addTarget = {} + /** + * The ID of a target to remove from this stream. + */ + // const removeTarget = 1234 + /** + * Labels associated with this target change. + */ + // const labels = [1,2,3,4] + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callListen() { + // Construct request + const request = { + database, + }; + + // Run request + const stream = await firestoreClient.listen(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callListen(); + // [END firestore_v1beta1_generated_Firestore_Listen_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.partition_query.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.partition_query.js new file mode 100644 index 000000000000..bac795dd8c5c --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.partition_query.js @@ -0,0 +1,105 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1beta1_generated_Firestore_PartitionQuery_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents`. + * Document resource names are not supported; only database resource names + * can be specified. + */ + // const parent = 'abc123' + /** + * A structured query. + * Query must specify collection with all descendants and be ordered by name + * ascending. Other filters, order bys, limits, offsets, and start/end + * cursors are not supported. + */ + // const structuredQuery = {} + /** + * The desired maximum number of partition points. + * The partitions may be returned across multiple pages of results. + * The number must be positive. The actual number of partitions + * returned may be fewer. + * For example, this may be set to one fewer than the number of parallel + * queries to be run, or in running a data pipeline job, one fewer than the + * number of workers or compute instances available. + */ + // const partitionCount = 1234 + /** + * The `next_page_token` value returned from a previous call to + * PartitionQuery that may be used to get an additional set of results. + * There are no ordering guarantees between sets of results. Thus, using + * multiple sets of results will require merging the different result sets. + * For example, two subsequent calls using a page_token may return: + * * cursor B, cursor M, cursor Q + * * cursor A, cursor U, cursor W + * To obtain a complete result set ordered with respect to the results of the + * query supplied to PartitionQuery, the results sets should be merged: + * cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + */ + // const pageToken = 'abc123' + /** + * The maximum number of partitions to return in this call, subject to + * `partition_count`. + * For example, if `partition_count` = 10 and `page_size` = 8, the first call + * to PartitionQuery will return up to 8 partitions and a `next_page_token` + * if more results exist. A second call to PartitionQuery will return up to + * 2 partitions, to complete the total of 10 specified in `partition_count`. + */ + // const pageSize = 1234 + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callPartitionQuery() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = firestoreClient.partitionQueryAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callPartitionQuery(); + // [END firestore_v1beta1_generated_Firestore_PartitionQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.rollback.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.rollback.js new file mode 100644 index 000000000000..6ed28e5f52ad --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.rollback.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database, transaction) { + // [START firestore_v1beta1_generated_Firestore_Rollback_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + */ + // const database = 'abc123' + /** + * Required. The transaction to roll back. + */ + // const transaction = Buffer.from('string') + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callRollback() { + // Construct request + const request = { + database, + transaction, + }; + + // Run request + const response = await firestoreClient.rollback(request); + console.log(response); + } + + callRollback(); + // [END firestore_v1beta1_generated_Firestore_Rollback_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.run_query.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.run_query.js new file mode 100644 index 000000000000..e63aae2b97ae --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.run_query.js @@ -0,0 +1,88 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START firestore_v1beta1_generated_Firestore_RunQuery_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + */ + // const parent = 'abc123' + /** + * A structured query. + */ + // const structuredQuery = {} + /** + * Reads documents in a transaction. + */ + // const transaction = Buffer.from('string') + /** + * Starts a new transaction and reads the documents. + * Defaults to a read-only transaction. + * The new transaction ID will be returned as the first response in the + * stream. + */ + // const newTransaction = {} + /** + * Reads documents as they were at the given time. + * This may not be older than 270 seconds. + */ + // const readTime = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callRunQuery() { + // Construct request + const request = { + parent, + }; + + // Run request + const stream = await firestoreClient.runQuery(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callRunQuery(); + // [END firestore_v1beta1_generated_Firestore_RunQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.update_document.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.update_document.js new file mode 100644 index 000000000000..64b5a6baabf0 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.update_document.js @@ -0,0 +1,82 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(document) { + // [START firestore_v1beta1_generated_Firestore_UpdateDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The updated document. + * Creates the document if it does not already exist. + */ + // const document = {} + /** + * The fields to update. + * None of the field paths in the mask may contain a reserved name. + * If the document exists on the server and has fields not referenced in the + * mask, they are left unchanged. + * Fields referenced in the mask, but not present in the input document, are + * deleted from the document on the server. + */ + // const updateMask = {} + /** + * The fields to return. If not set, returns all fields. + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + */ + // const mask = {} + /** + * An optional precondition on the document. + * The request will fail if this is set and not met by the target document. + */ + // const currentDocument = {} + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callUpdateDocument() { + // Construct request + const request = { + document, + }; + + // Run request + const response = await firestoreClient.updateDocument(request); + console.log(response); + } + + callUpdateDocument(); + // [END firestore_v1beta1_generated_Firestore_UpdateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.write.js b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.write.js new file mode 100644 index 000000000000..700fbe0e0514 --- /dev/null +++ b/packages/google-cloud-firestore-api/samples/generated/v1beta1/firestore.write.js @@ -0,0 +1,98 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(database) { + // [START firestore_v1beta1_generated_Firestore_Write_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * This is only required in the first message. + */ + // const database = 'abc123' + /** + * The ID of the write stream to resume. + * This may only be set in the first message. When left empty, a new write + * stream will be created. + */ + // const streamId = 'abc123' + /** + * The writes to apply. + * Always executed atomically and in order. + * This must be empty on the first request. + * This may be empty on the last request. + * This must not be empty on all other requests. + */ + // const writes = [1,2,3,4] + /** + * A stream token that was previously sent by the server. + * The client should set this field to the token from the most recent + * WriteResponse google.firestore.v1beta1.WriteResponse it has received. This acknowledges that the client has + * received responses up to this token. After sending this token, earlier + * tokens may not be used anymore. + * The server may close the stream if there are too many unacknowledged + * responses. + * Leave this field unset when creating a new stream. To resume a stream at + * a specific point, set this field and the `stream_id` field. + * Leave this field unset when creating a new stream. + */ + // const streamToken = Buffer.from('string') + /** + * Labels associated with this write request. + */ + // const labels = [1,2,3,4] + + // Imports the Firestore library + const {FirestoreClient} = require('@google-cloud/firestore-api').v1beta1; + + // Instantiates a client + const firestoreClient = new FirestoreClient(); + + async function callWrite() { + // Construct request + const request = { + database, + }; + + // Run request + const stream = await firestoreClient.write(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callWrite(); + // [END firestore_v1beta1_generated_Firestore_Write_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-firestore-api/src/index.ts b/packages/google-cloud-firestore-api/src/index.ts new file mode 100644 index 000000000000..68bfc01a8f81 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/index.ts @@ -0,0 +1,28 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +import * as v1beta1 from './v1beta1'; + +const FirestoreAdminClient = v1.FirestoreAdminClient; +type FirestoreAdminClient = v1.FirestoreAdminClient; + +export {v1, v1beta1, FirestoreAdminClient}; +export default {v1, v1beta1, FirestoreAdminClient}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-firestore-api/src/v1/firestore_admin_client.ts b/packages/google-cloud-firestore-api/src/v1/firestore_admin_client.ts new file mode 100644 index 000000000000..9ca955da47e0 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1/firestore_admin_client.ts @@ -0,0 +1,6512 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/firestore_admin_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './firestore_admin_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Cloud Firestore Admin API. + * + * This API provides several administrative services for Cloud Firestore. + * + * Project, Database, Namespace, Collection, Collection Group, and Document are + * used as defined in the Google Cloud Firestore API. + * + * Operation: An Operation represents work being performed in the background. + * + * The index service manages Cloud Firestore indexes. + * + * Index creation is performed asynchronously. + * An Operation resource is created for each such asynchronous operation. + * The state of the operation (including any errors encountered) + * may be queried via the Operation resource. + * + * The Operations collection provides a record of actions performed for the + * specified Project (including any Operations in progress). Operations are not + * created directly but through calls on other collections or resources. + * + * An Operation that is done may be deleted so that it is no longer listed as + * part of the Operation collection. Operations are garbage collected after + * 30 days. By default, ListOperations will only return in progress and failed + * operations. To list completed operation, issue a ListOperations request with + * the filter `done: true`. + * + * Operations are created by service `FirestoreAdmin`, but are accessed via + * service `google.longrunning.Operations`. + * @class + * @memberof v1 + */ +export class FirestoreAdminClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('firestore-api'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + operationsClient: gax.OperationsClient; + firestoreAdminStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of FirestoreAdminClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new FirestoreAdminClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FirestoreAdminClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'firestore.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backups/{backup}', + ), + backupSchedulePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/databases/{database}/backupSchedules/{backup_schedule}', + ), + collectionGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/databases/{database}/collectionGroups/{collection}', + ), + databasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/databases/{database}', + ), + fieldPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}', + ), + indexPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}', + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + userCredsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/databases/{database}/userCreds/{user_creds}', + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listIndexes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'indexes', + ), + listFields: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'fields', + ), + }; + + const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/databases/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/databases/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/databases/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/databases/*}/operations', + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createIndexResponse = protoFilesRoot.lookup( + '.google.firestore.admin.v1.Index', + ) as gax.protobuf.Type; + const createIndexMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.IndexOperationMetadata', + ) as gax.protobuf.Type; + const updateFieldResponse = protoFilesRoot.lookup( + '.google.firestore.admin.v1.Field', + ) as gax.protobuf.Type; + const updateFieldMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.FieldOperationMetadata', + ) as gax.protobuf.Type; + const exportDocumentsResponse = protoFilesRoot.lookup( + '.google.firestore.admin.v1.ExportDocumentsResponse', + ) as gax.protobuf.Type; + const exportDocumentsMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.ExportDocumentsMetadata', + ) as gax.protobuf.Type; + const importDocumentsResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty', + ) as gax.protobuf.Type; + const importDocumentsMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.ImportDocumentsMetadata', + ) as gax.protobuf.Type; + const bulkDeleteDocumentsResponse = protoFilesRoot.lookup( + '.google.firestore.admin.v1.BulkDeleteDocumentsResponse', + ) as gax.protobuf.Type; + const bulkDeleteDocumentsMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.BulkDeleteDocumentsMetadata', + ) as gax.protobuf.Type; + const createDatabaseResponse = protoFilesRoot.lookup( + '.google.firestore.admin.v1.Database', + ) as gax.protobuf.Type; + const createDatabaseMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.CreateDatabaseMetadata', + ) as gax.protobuf.Type; + const updateDatabaseResponse = protoFilesRoot.lookup( + '.google.firestore.admin.v1.Database', + ) as gax.protobuf.Type; + const updateDatabaseMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.UpdateDatabaseMetadata', + ) as gax.protobuf.Type; + const deleteDatabaseResponse = protoFilesRoot.lookup( + '.google.firestore.admin.v1.Database', + ) as gax.protobuf.Type; + const deleteDatabaseMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.DeleteDatabaseMetadata', + ) as gax.protobuf.Type; + const restoreDatabaseResponse = protoFilesRoot.lookup( + '.google.firestore.admin.v1.Database', + ) as gax.protobuf.Type; + const restoreDatabaseMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.RestoreDatabaseMetadata', + ) as gax.protobuf.Type; + const cloneDatabaseResponse = protoFilesRoot.lookup( + '.google.firestore.admin.v1.Database', + ) as gax.protobuf.Type; + const cloneDatabaseMetadata = protoFilesRoot.lookup( + '.google.firestore.admin.v1.CloneDatabaseMetadata', + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createIndex: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createIndexResponse.decode.bind(createIndexResponse), + createIndexMetadata.decode.bind(createIndexMetadata), + ), + updateField: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFieldResponse.decode.bind(updateFieldResponse), + updateFieldMetadata.decode.bind(updateFieldMetadata), + ), + exportDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportDocumentsResponse.decode.bind(exportDocumentsResponse), + exportDocumentsMetadata.decode.bind(exportDocumentsMetadata), + ), + importDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importDocumentsResponse.decode.bind(importDocumentsResponse), + importDocumentsMetadata.decode.bind(importDocumentsMetadata), + ), + bulkDeleteDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + bulkDeleteDocumentsResponse.decode.bind(bulkDeleteDocumentsResponse), + bulkDeleteDocumentsMetadata.decode.bind(bulkDeleteDocumentsMetadata), + ), + createDatabase: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createDatabaseResponse.decode.bind(createDatabaseResponse), + createDatabaseMetadata.decode.bind(createDatabaseMetadata), + ), + updateDatabase: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateDatabaseResponse.decode.bind(updateDatabaseResponse), + updateDatabaseMetadata.decode.bind(updateDatabaseMetadata), + ), + deleteDatabase: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteDatabaseResponse.decode.bind(deleteDatabaseResponse), + deleteDatabaseMetadata.decode.bind(deleteDatabaseMetadata), + ), + restoreDatabase: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreDatabaseResponse.decode.bind(restoreDatabaseResponse), + restoreDatabaseMetadata.decode.bind(restoreDatabaseMetadata), + ), + cloneDatabase: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + cloneDatabaseResponse.decode.bind(cloneDatabaseResponse), + cloneDatabaseMetadata.decode.bind(cloneDatabaseMetadata), + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.firestore.admin.v1.FirestoreAdmin', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.firestoreAdminStub) { + return this.firestoreAdminStub; + } + + // Put together the "service stub" for + // google.firestore.admin.v1.FirestoreAdmin. + this.firestoreAdminStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.firestore.admin.v1.FirestoreAdmin', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.firestore.admin.v1.FirestoreAdmin, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const firestoreAdminStubMethods = [ + 'createIndex', + 'listIndexes', + 'getIndex', + 'deleteIndex', + 'getField', + 'updateField', + 'listFields', + 'exportDocuments', + 'importDocuments', + 'bulkDeleteDocuments', + 'createDatabase', + 'getDatabase', + 'listDatabases', + 'updateDatabase', + 'deleteDatabase', + 'createUserCreds', + 'getUserCreds', + 'listUserCreds', + 'enableUserCreds', + 'disableUserCreds', + 'resetUserPassword', + 'deleteUserCreds', + 'getBackup', + 'listBackups', + 'deleteBackup', + 'restoreDatabase', + 'createBackupSchedule', + 'getBackupSchedule', + 'listBackupSchedules', + 'updateBackupSchedule', + 'deleteBackupSchedule', + 'cloneDatabase', + ]; + for (const methodName of firestoreAdminStubMethods) { + const callPromise = this.firestoreAdminStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.firestoreAdminStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'firestore.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'firestore.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/datastore', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Gets a composite index. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.Index|Index}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.get_index.js + * region_tag:firestore_v1_generated_FirestoreAdmin_GetIndex_async + */ + getIndex( + request?: protos.google.firestore.admin.v1.IGetIndexRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IGetIndexRequest | undefined, + {} | undefined, + ] + >; + getIndex( + request: protos.google.firestore.admin.v1.IGetIndexRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + >, + ): void; + getIndex( + request: protos.google.firestore.admin.v1.IGetIndexRequest, + callback: Callback< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + >, + ): void; + getIndex( + request?: protos.google.firestore.admin.v1.IGetIndexRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IGetIndexRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getIndex request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getIndex response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getIndex(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IGetIndexRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getIndex response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes a composite index. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.delete_index.js + * region_tag:firestore_v1_generated_FirestoreAdmin_DeleteIndex_async + */ + deleteIndex( + request?: protos.google.firestore.admin.v1.IDeleteIndexRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteIndexRequest | undefined, + {} | undefined, + ] + >; + deleteIndex( + request: protos.google.firestore.admin.v1.IDeleteIndexRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteIndexRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteIndex( + request: protos.google.firestore.admin.v1.IDeleteIndexRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteIndexRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteIndex( + request?: protos.google.firestore.admin.v1.IDeleteIndexRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteIndexRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteIndexRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteIndexRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteIndex request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteIndexRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteIndex response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteIndex(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteIndexRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteIndex response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Gets the metadata and configuration for a Field. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.Field|Field}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.get_field.js + * region_tag:firestore_v1_generated_FirestoreAdmin_GetField_async + */ + getField( + request?: protos.google.firestore.admin.v1.IGetFieldRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IGetFieldRequest | undefined, + {} | undefined, + ] + >; + getField( + request: protos.google.firestore.admin.v1.IGetFieldRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IGetFieldRequest | null | undefined, + {} | null | undefined + >, + ): void; + getField( + request: protos.google.firestore.admin.v1.IGetFieldRequest, + callback: Callback< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IGetFieldRequest | null | undefined, + {} | null | undefined + >, + ): void; + getField( + request?: protos.google.firestore.admin.v1.IGetFieldRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IGetFieldRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IGetFieldRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IGetFieldRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getField request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IGetFieldRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getField response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getField(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IGetFieldRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getField response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Gets information about a database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.Database|Database}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.get_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_GetDatabase_async + */ + getDatabase( + request?: protos.google.firestore.admin.v1.IGetDatabaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IGetDatabaseRequest | undefined, + {} | undefined, + ] + >; + getDatabase( + request: protos.google.firestore.admin.v1.IGetDatabaseRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IGetDatabaseRequest | null | undefined, + {} | null | undefined + >, + ): void; + getDatabase( + request: protos.google.firestore.admin.v1.IGetDatabaseRequest, + callback: Callback< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IGetDatabaseRequest | null | undefined, + {} | null | undefined + >, + ): void; + getDatabase( + request?: protos.google.firestore.admin.v1.IGetDatabaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IDatabase, + | protos.google.firestore.admin.v1.IGetDatabaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IGetDatabaseRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IGetDatabaseRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getDatabase request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IDatabase, + | protos.google.firestore.admin.v1.IGetDatabaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getDatabase response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getDatabase(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IGetDatabaseRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getDatabase response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * List all the databases in the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}` + * @param {boolean} request.showDeleted + * If true, also returns deleted resources. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.ListDatabasesResponse|ListDatabasesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.list_databases.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ListDatabases_async + */ + listDatabases( + request?: protos.google.firestore.admin.v1.IListDatabasesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IListDatabasesResponse, + protos.google.firestore.admin.v1.IListDatabasesRequest | undefined, + {} | undefined, + ] + >; + listDatabases( + request: protos.google.firestore.admin.v1.IListDatabasesRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IListDatabasesResponse, + protos.google.firestore.admin.v1.IListDatabasesRequest | null | undefined, + {} | null | undefined + >, + ): void; + listDatabases( + request: protos.google.firestore.admin.v1.IListDatabasesRequest, + callback: Callback< + protos.google.firestore.admin.v1.IListDatabasesResponse, + protos.google.firestore.admin.v1.IListDatabasesRequest | null | undefined, + {} | null | undefined + >, + ): void; + listDatabases( + request?: protos.google.firestore.admin.v1.IListDatabasesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IListDatabasesResponse, + | protos.google.firestore.admin.v1.IListDatabasesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IListDatabasesResponse, + protos.google.firestore.admin.v1.IListDatabasesRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IListDatabasesResponse, + protos.google.firestore.admin.v1.IListDatabasesRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listDatabases request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IListDatabasesResponse, + | protos.google.firestore.admin.v1.IListDatabasesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listDatabases response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listDatabases(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IListDatabasesResponse, + protos.google.firestore.admin.v1.IListDatabasesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('listDatabases response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Create a user creds. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}` + * @param {google.firestore.admin.v1.UserCreds} request.userCreds + * Required. The user creds to create. + * @param {string} request.userCredsId + * Required. The ID to use for the user creds, which will become the final + * component of the user creds's resource name. + * + * This value should be 4-63 characters. Valid characters are /{@link protos.0-9|a-z}-/ + * with first character a letter and the last a letter or a number. Must not + * be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.UserCreds|UserCreds}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.create_user_creds.js + * region_tag:firestore_v1_generated_FirestoreAdmin_CreateUserCreds_async + */ + createUserCreds( + request?: protos.google.firestore.admin.v1.ICreateUserCredsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.ICreateUserCredsRequest | undefined, + {} | undefined, + ] + >; + createUserCreds( + request: protos.google.firestore.admin.v1.ICreateUserCredsRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.ICreateUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + createUserCreds( + request: protos.google.firestore.admin.v1.ICreateUserCredsRequest, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.ICreateUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + createUserCreds( + request?: protos.google.firestore.admin.v1.ICreateUserCredsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.ICreateUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.ICreateUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.ICreateUserCredsRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createUserCreds request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.ICreateUserCredsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createUserCreds response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createUserCreds(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.ICreateUserCredsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createUserCreds response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Gets a user creds resource. Note that the returned resource does not + * contain the secret value itself. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.UserCreds|UserCreds}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.get_user_creds.js + * region_tag:firestore_v1_generated_FirestoreAdmin_GetUserCreds_async + */ + getUserCreds( + request?: protos.google.firestore.admin.v1.IGetUserCredsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IGetUserCredsRequest | undefined, + {} | undefined, + ] + >; + getUserCreds( + request: protos.google.firestore.admin.v1.IGetUserCredsRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IGetUserCredsRequest | null | undefined, + {} | null | undefined + >, + ): void; + getUserCreds( + request: protos.google.firestore.admin.v1.IGetUserCredsRequest, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IGetUserCredsRequest | null | undefined, + {} | null | undefined + >, + ): void; + getUserCreds( + request?: protos.google.firestore.admin.v1.IGetUserCredsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IGetUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IGetUserCredsRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IGetUserCredsRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getUserCreds request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IGetUserCredsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getUserCreds response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getUserCreds(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IGetUserCredsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getUserCreds response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * List all user creds in the database. Note that the returned resource + * does not contain the secret value itself. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent database name of the form + * `projects/{project_id}/databases/{database_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.ListUserCredsResponse|ListUserCredsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.list_user_creds.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ListUserCreds_async + */ + listUserCreds( + request?: protos.google.firestore.admin.v1.IListUserCredsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IListUserCredsResponse, + protos.google.firestore.admin.v1.IListUserCredsRequest | undefined, + {} | undefined, + ] + >; + listUserCreds( + request: protos.google.firestore.admin.v1.IListUserCredsRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IListUserCredsResponse, + protos.google.firestore.admin.v1.IListUserCredsRequest | null | undefined, + {} | null | undefined + >, + ): void; + listUserCreds( + request: protos.google.firestore.admin.v1.IListUserCredsRequest, + callback: Callback< + protos.google.firestore.admin.v1.IListUserCredsResponse, + protos.google.firestore.admin.v1.IListUserCredsRequest | null | undefined, + {} | null | undefined + >, + ): void; + listUserCreds( + request?: protos.google.firestore.admin.v1.IListUserCredsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IListUserCredsResponse, + | protos.google.firestore.admin.v1.IListUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IListUserCredsResponse, + protos.google.firestore.admin.v1.IListUserCredsRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IListUserCredsResponse, + protos.google.firestore.admin.v1.IListUserCredsRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listUserCreds request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IListUserCredsResponse, + | protos.google.firestore.admin.v1.IListUserCredsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listUserCreds response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listUserCreds(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IListUserCredsResponse, + protos.google.firestore.admin.v1.IListUserCredsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('listUserCreds response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Enables a user creds. No-op if the user creds are already enabled. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.UserCreds|UserCreds}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.enable_user_creds.js + * region_tag:firestore_v1_generated_FirestoreAdmin_EnableUserCreds_async + */ + enableUserCreds( + request?: protos.google.firestore.admin.v1.IEnableUserCredsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IEnableUserCredsRequest | undefined, + {} | undefined, + ] + >; + enableUserCreds( + request: protos.google.firestore.admin.v1.IEnableUserCredsRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IEnableUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + enableUserCreds( + request: protos.google.firestore.admin.v1.IEnableUserCredsRequest, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IEnableUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + enableUserCreds( + request?: protos.google.firestore.admin.v1.IEnableUserCredsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IEnableUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IEnableUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IEnableUserCredsRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('enableUserCreds request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IEnableUserCredsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('enableUserCreds response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .enableUserCreds(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IEnableUserCredsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('enableUserCreds response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Disables a user creds. No-op if the user creds are already disabled. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.UserCreds|UserCreds}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.disable_user_creds.js + * region_tag:firestore_v1_generated_FirestoreAdmin_DisableUserCreds_async + */ + disableUserCreds( + request?: protos.google.firestore.admin.v1.IDisableUserCredsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IDisableUserCredsRequest | undefined, + {} | undefined, + ] + >; + disableUserCreds( + request: protos.google.firestore.admin.v1.IDisableUserCredsRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IDisableUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + disableUserCreds( + request: protos.google.firestore.admin.v1.IDisableUserCredsRequest, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IDisableUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + disableUserCreds( + request?: protos.google.firestore.admin.v1.IDisableUserCredsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IDisableUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IDisableUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IDisableUserCredsRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('disableUserCreds request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IDisableUserCredsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('disableUserCreds response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .disableUserCreds(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IDisableUserCredsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('disableUserCreds response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Resets the password of a user creds. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.UserCreds|UserCreds}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.reset_user_password.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ResetUserPassword_async + */ + resetUserPassword( + request?: protos.google.firestore.admin.v1.IResetUserPasswordRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IResetUserPasswordRequest | undefined, + {} | undefined, + ] + >; + resetUserPassword( + request: protos.google.firestore.admin.v1.IResetUserPasswordRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IResetUserPasswordRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetUserPassword( + request: protos.google.firestore.admin.v1.IResetUserPasswordRequest, + callback: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IResetUserPasswordRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetUserPassword( + request?: protos.google.firestore.admin.v1.IResetUserPasswordRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IResetUserPasswordRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IResetUserPasswordRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IUserCreds, + protos.google.firestore.admin.v1.IResetUserPasswordRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('resetUserPassword request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IUserCreds, + | protos.google.firestore.admin.v1.IResetUserPasswordRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('resetUserPassword response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .resetUserPassword(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IUserCreds, + ( + | protos.google.firestore.admin.v1.IResetUserPasswordRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resetUserPassword response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes a user creds. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.delete_user_creds.js + * region_tag:firestore_v1_generated_FirestoreAdmin_DeleteUserCreds_async + */ + deleteUserCreds( + request?: protos.google.firestore.admin.v1.IDeleteUserCredsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteUserCredsRequest | undefined, + {} | undefined, + ] + >; + deleteUserCreds( + request: protos.google.firestore.admin.v1.IDeleteUserCredsRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + deleteUserCreds( + request: protos.google.firestore.admin.v1.IDeleteUserCredsRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + deleteUserCreds( + request?: protos.google.firestore.admin.v1.IDeleteUserCredsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteUserCredsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteUserCredsRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteUserCreds request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteUserCredsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteUserCreds response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteUserCreds(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteUserCredsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteUserCreds response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Gets information about a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the backup to fetch. + * + * Format is `projects/{project}/locations/{location}/backups/{backup}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.Backup|Backup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.get_backup.js + * region_tag:firestore_v1_generated_FirestoreAdmin_GetBackup_async + */ + getBackup( + request?: protos.google.firestore.admin.v1.IGetBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IBackup, + protos.google.firestore.admin.v1.IGetBackupRequest | undefined, + {} | undefined, + ] + >; + getBackup( + request: protos.google.firestore.admin.v1.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IBackup, + protos.google.firestore.admin.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + getBackup( + request: protos.google.firestore.admin.v1.IGetBackupRequest, + callback: Callback< + protos.google.firestore.admin.v1.IBackup, + protos.google.firestore.admin.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + getBackup( + request?: protos.google.firestore.admin.v1.IGetBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IBackup, + protos.google.firestore.admin.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IBackup, + protos.google.firestore.admin.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IBackup, + protos.google.firestore.admin.v1.IGetBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IBackup, + protos.google.firestore.admin.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IBackup, + protos.google.firestore.admin.v1.IGetBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all the backups. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location to list backups from. + * + * Format is `projects/{project}/locations/{location}`. + * Use `{location} = '-'` to list backups from all locations for the given + * project. This allows listing backups from a single location or from all + * locations. + * @param {string} request.filter + * An expression that filters the list of returned backups. + * + * A filter expression consists of a field name, a comparison operator, and a + * value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * + * The following fields in the {@link protos.google.firestore.admin.v1.Backup|Backup} are + * eligible for filtering: + * + * * `database_uid` (supports `=` only) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.ListBackupsResponse|ListBackupsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.list_backups.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ListBackups_async + */ + listBackups( + request?: protos.google.firestore.admin.v1.IListBackupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IListBackupsResponse, + protos.google.firestore.admin.v1.IListBackupsRequest | undefined, + {} | undefined, + ] + >; + listBackups( + request: protos.google.firestore.admin.v1.IListBackupsRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IListBackupsResponse, + protos.google.firestore.admin.v1.IListBackupsRequest | null | undefined, + {} | null | undefined + >, + ): void; + listBackups( + request: protos.google.firestore.admin.v1.IListBackupsRequest, + callback: Callback< + protos.google.firestore.admin.v1.IListBackupsResponse, + protos.google.firestore.admin.v1.IListBackupsRequest | null | undefined, + {} | null | undefined + >, + ): void; + listBackups( + request?: protos.google.firestore.admin.v1.IListBackupsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IListBackupsResponse, + | protos.google.firestore.admin.v1.IListBackupsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IListBackupsResponse, + protos.google.firestore.admin.v1.IListBackupsRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IListBackupsResponse, + protos.google.firestore.admin.v1.IListBackupsRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listBackups request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IListBackupsResponse, + | protos.google.firestore.admin.v1.IListBackupsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listBackups response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listBackups(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IListBackupsResponse, + protos.google.firestore.admin.v1.IListBackupsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('listBackups response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the backup to delete. + * + * format is `projects/{project}/locations/{location}/backups/{backup}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.delete_backup.js + * region_tag:firestore_v1_generated_FirestoreAdmin_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.firestore.admin.v1.IDeleteBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteBackupRequest | undefined, + {} | undefined, + ] + >; + deleteBackup( + request: protos.google.firestore.admin.v1.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteBackup( + request: protos.google.firestore.admin.v1.IDeleteBackupRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteBackup( + request?: protos.google.firestore.admin.v1.IDeleteBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a backup schedule on a database. + * At most two backup schedules can be configured on a database, one daily + * backup schedule and one weekly backup schedule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent database. + * + * Format `projects/{project}/databases/{database}` + * @param {google.firestore.admin.v1.BackupSchedule} request.backupSchedule + * Required. The backup schedule to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.BackupSchedule|BackupSchedule}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.create_backup_schedule.js + * region_tag:firestore_v1_generated_FirestoreAdmin_CreateBackupSchedule_async + */ + createBackupSchedule( + request?: protos.google.firestore.admin.v1.ICreateBackupScheduleRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IBackupSchedule, + protos.google.firestore.admin.v1.ICreateBackupScheduleRequest | undefined, + {} | undefined, + ] + >; + createBackupSchedule( + request: protos.google.firestore.admin.v1.ICreateBackupScheduleRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.ICreateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + createBackupSchedule( + request: protos.google.firestore.admin.v1.ICreateBackupScheduleRequest, + callback: Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.ICreateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + createBackupSchedule( + request?: protos.google.firestore.admin.v1.ICreateBackupScheduleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.ICreateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.ICreateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IBackupSchedule, + protos.google.firestore.admin.v1.ICreateBackupScheduleRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createBackupSchedule request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.ICreateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createBackupSchedule response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createBackupSchedule(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IBackupSchedule, + ( + | protos.google.firestore.admin.v1.ICreateBackupScheduleRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createBackupSchedule response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Gets information about a backup schedule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup schedule. + * + * Format + * `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.BackupSchedule|BackupSchedule}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.get_backup_schedule.js + * region_tag:firestore_v1_generated_FirestoreAdmin_GetBackupSchedule_async + */ + getBackupSchedule( + request?: protos.google.firestore.admin.v1.IGetBackupScheduleRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IBackupSchedule, + protos.google.firestore.admin.v1.IGetBackupScheduleRequest | undefined, + {} | undefined, + ] + >; + getBackupSchedule( + request: protos.google.firestore.admin.v1.IGetBackupScheduleRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IGetBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getBackupSchedule( + request: protos.google.firestore.admin.v1.IGetBackupScheduleRequest, + callback: Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IGetBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getBackupSchedule( + request?: protos.google.firestore.admin.v1.IGetBackupScheduleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IGetBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IGetBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IBackupSchedule, + protos.google.firestore.admin.v1.IGetBackupScheduleRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getBackupSchedule request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IGetBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getBackupSchedule response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getBackupSchedule(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IBackupSchedule, + ( + | protos.google.firestore.admin.v1.IGetBackupScheduleRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getBackupSchedule response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * List backup schedules. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent database. + * + * Format is `projects/{project}/databases/{database}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.ListBackupSchedulesResponse|ListBackupSchedulesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.list_backup_schedules.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ListBackupSchedules_async + */ + listBackupSchedules( + request?: protos.google.firestore.admin.v1.IListBackupSchedulesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IListBackupSchedulesResponse, + protos.google.firestore.admin.v1.IListBackupSchedulesRequest | undefined, + {} | undefined, + ] + >; + listBackupSchedules( + request: protos.google.firestore.admin.v1.IListBackupSchedulesRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IListBackupSchedulesResponse, + | protos.google.firestore.admin.v1.IListBackupSchedulesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listBackupSchedules( + request: protos.google.firestore.admin.v1.IListBackupSchedulesRequest, + callback: Callback< + protos.google.firestore.admin.v1.IListBackupSchedulesResponse, + | protos.google.firestore.admin.v1.IListBackupSchedulesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listBackupSchedules( + request?: protos.google.firestore.admin.v1.IListBackupSchedulesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IListBackupSchedulesResponse, + | protos.google.firestore.admin.v1.IListBackupSchedulesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IListBackupSchedulesResponse, + | protos.google.firestore.admin.v1.IListBackupSchedulesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IListBackupSchedulesResponse, + protos.google.firestore.admin.v1.IListBackupSchedulesRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listBackupSchedules request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IListBackupSchedulesResponse, + | protos.google.firestore.admin.v1.IListBackupSchedulesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listBackupSchedules response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listBackupSchedules(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IListBackupSchedulesResponse, + ( + | protos.google.firestore.admin.v1.IListBackupSchedulesRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listBackupSchedules response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates a backup schedule. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.firestore.admin.v1.BackupSchedule} request.backupSchedule + * Required. The backup schedule to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.admin.v1.BackupSchedule|BackupSchedule}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.update_backup_schedule.js + * region_tag:firestore_v1_generated_FirestoreAdmin_UpdateBackupSchedule_async + */ + updateBackupSchedule( + request?: protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IBackupSchedule, + protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest | undefined, + {} | undefined, + ] + >; + updateBackupSchedule( + request: protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + updateBackupSchedule( + request: protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest, + callback: Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + updateBackupSchedule( + request?: protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IBackupSchedule, + protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'backup_schedule.name': request.backupSchedule!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateBackupSchedule request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.admin.v1.IBackupSchedule, + | protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateBackupSchedule response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateBackupSchedule(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.admin.v1.IBackupSchedule, + ( + | protos.google.firestore.admin.v1.IUpdateBackupScheduleRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateBackupSchedule response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes a backup schedule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup schedule. + * + * Format + * `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.delete_backup_schedule.js + * region_tag:firestore_v1_generated_FirestoreAdmin_DeleteBackupSchedule_async + */ + deleteBackupSchedule( + request?: protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest | undefined, + {} | undefined, + ] + >; + deleteBackupSchedule( + request: protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + deleteBackupSchedule( + request: protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + deleteBackupSchedule( + request?: protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteBackupSchedule request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteBackupSchedule response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteBackupSchedule(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.firestore.admin.v1.IDeleteBackupScheduleRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteBackupSchedule response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Creates a composite index. This returns a + * {@link protos.google.longrunning.Operation|google.longrunning.Operation} which may be + * used to track the status of the creation. The metadata for the operation + * will be the type + * {@link protos.google.firestore.admin.v1.IndexOperationMetadata|IndexOperationMetadata}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + * @param {google.firestore.admin.v1.Index} request.index + * Required. The composite index to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.create_index.js + * region_tag:firestore_v1_generated_FirestoreAdmin_CreateIndex_async + */ + createIndex( + request?: protos.google.firestore.admin.v1.ICreateIndexRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createIndex( + request: protos.google.firestore.admin.v1.ICreateIndexRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createIndex( + request: protos.google.firestore.admin.v1.ICreateIndexRequest, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createIndex( + request?: protos.google.firestore.admin.v1.ICreateIndexRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createIndex response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createIndex request %j', request); + return this.innerApiCalls + .createIndex(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createIndex response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createIndex()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.create_index.js + * region_tag:firestore_v1_generated_FirestoreAdmin_CreateIndex_async + */ + async checkCreateIndexProgress( + name: string, + ): Promise< + LROperation< + protos.google.firestore.admin.v1.Index, + protos.google.firestore.admin.v1.IndexOperationMetadata + > + > { + this._log.info('createIndex long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createIndex, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.firestore.admin.v1.Index, + protos.google.firestore.admin.v1.IndexOperationMetadata + >; + } + /** + * Updates a field configuration. Currently, field updates apply only to + * single field index configuration. However, calls to + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.UpdateField|FirestoreAdmin.UpdateField} + * should provide a field mask to avoid changing any configuration that the + * caller isn't aware of. The field mask should be specified as: `{ paths: + * "index_config" }`. + * + * This call returns a + * {@link protos.google.longrunning.Operation|google.longrunning.Operation} which may be + * used to track the status of the field update. The metadata for the + * operation will be the type + * {@link protos.google.firestore.admin.v1.FieldOperationMetadata|FieldOperationMetadata}. + * + * To configure the default field settings for the database, use + * the special `Field` with resource name: + * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.firestore.admin.v1.Field} request.field + * Required. The field to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * A mask, relative to the field. If specified, only configuration specified + * by this field_mask will be updated in the field. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.update_field.js + * region_tag:firestore_v1_generated_FirestoreAdmin_UpdateField_async + */ + updateField( + request?: protos.google.firestore.admin.v1.IUpdateFieldRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateField( + request: protos.google.firestore.admin.v1.IUpdateFieldRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateField( + request: protos.google.firestore.admin.v1.IUpdateFieldRequest, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateField( + request?: protos.google.firestore.admin.v1.IUpdateFieldRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'field.name': request.field!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('updateField response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('updateField request %j', request); + return this.innerApiCalls + .updateField(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateField response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `updateField()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.update_field.js + * region_tag:firestore_v1_generated_FirestoreAdmin_UpdateField_async + */ + async checkUpdateFieldProgress( + name: string, + ): Promise< + LROperation< + protos.google.firestore.admin.v1.Field, + protos.google.firestore.admin.v1.FieldOperationMetadata + > + > { + this._log.info('updateField long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateField, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.firestore.admin.v1.Field, + protos.google.firestore.admin.v1.FieldOperationMetadata + >; + } + /** + * Exports a copy of all or a subset of documents from Google Cloud Firestore + * to another storage system, such as Google Cloud Storage. Recent updates to + * documents may not be reflected in the export. The export occurs in the + * background and its progress can be monitored and managed via the + * Operation resource that is created. The output of an export may only be + * used once the associated operation is done. If an export operation is + * cancelled before completion it may leave partial data behind in Google + * Cloud Storage. + * + * For more details on export behavior and output format, refer to: + * https://cloud.google.com/firestore/docs/manage-data/export-import + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Database to export. Should be of the form: + * `projects/{project_id}/databases/{database_id}`. + * @param {string[]} request.collectionIds + * IDs of the collection groups to export. Unspecified means all + * collection groups. Each collection group in this list must be unique. + * @param {string} request.outputUriPrefix + * The output URI. Currently only supports Google Cloud Storage URIs of the + * form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name + * of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional + * Google Cloud Storage namespace path. When + * choosing a name, be sure to consider Google Cloud Storage naming + * guidelines: https://cloud.google.com/storage/docs/naming. + * If the URI is a bucket (without a namespace path), a prefix will be + * generated based on the start time. + * @param {string[]} request.namespaceIds + * An empty list represents all namespaces. This is the preferred + * usage for databases that don't use namespaces. + * + * An empty string element represents the default namespace. This should be + * used if the database has data in non-default namespaces, but doesn't want + * to include them. Each namespace in this list must be unique. + * @param {google.protobuf.Timestamp} request.snapshotTime + * The timestamp that corresponds to the version of the database to be + * exported. The timestamp must be in the past, rounded to the minute and not + * older than + * {@link protos.google.firestore.admin.v1.Database.earliest_version_time|earliestVersionTime}. + * If specified, then the exported documents will represent a consistent view + * of the database at the provided time. Otherwise, there are no guarantees + * about the consistency of the exported documents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.export_documents.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ExportDocuments_async + */ + exportDocuments( + request?: protos.google.firestore.admin.v1.IExportDocumentsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + exportDocuments( + request: protos.google.firestore.admin.v1.IExportDocumentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + exportDocuments( + request: protos.google.firestore.admin.v1.IExportDocumentsRequest, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + exportDocuments( + request?: protos.google.firestore.admin.v1.IExportDocumentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('exportDocuments response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('exportDocuments request %j', request); + return this.innerApiCalls + .exportDocuments(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('exportDocuments response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `exportDocuments()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.export_documents.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ExportDocuments_async + */ + async checkExportDocumentsProgress( + name: string, + ): Promise< + LROperation< + protos.google.firestore.admin.v1.ExportDocumentsResponse, + protos.google.firestore.admin.v1.ExportDocumentsMetadata + > + > { + this._log.info('exportDocuments long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.exportDocuments, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.firestore.admin.v1.ExportDocumentsResponse, + protos.google.firestore.admin.v1.ExportDocumentsMetadata + >; + } + /** + * Imports documents into Google Cloud Firestore. Existing documents with the + * same name are overwritten. The import occurs in the background and its + * progress can be monitored and managed via the Operation resource that is + * created. If an ImportDocuments operation is cancelled, it is possible + * that a subset of the data has already been imported to Cloud Firestore. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Database to import into. Should be of the form: + * `projects/{project_id}/databases/{database_id}`. + * @param {string[]} request.collectionIds + * IDs of the collection groups to import. Unspecified means all collection + * groups that were included in the export. Each collection group in this list + * must be unique. + * @param {string} request.inputUriPrefix + * Location of the exported files. + * This must match the output_uri_prefix of an ExportDocumentsResponse from + * an export that has completed successfully. + * See: + * {@link protos.google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix|google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix}. + * @param {string[]} request.namespaceIds + * An empty list represents all namespaces. This is the preferred + * usage for databases that don't use namespaces. + * + * An empty string element represents the default namespace. This should be + * used if the database has data in non-default namespaces, but doesn't want + * to include them. Each namespace in this list must be unique. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.import_documents.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ImportDocuments_async + */ + importDocuments( + request?: protos.google.firestore.admin.v1.IImportDocumentsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + importDocuments( + request: protos.google.firestore.admin.v1.IImportDocumentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + importDocuments( + request: protos.google.firestore.admin.v1.IImportDocumentsRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + importDocuments( + request?: protos.google.firestore.admin.v1.IImportDocumentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('importDocuments response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('importDocuments request %j', request); + return this.innerApiCalls + .importDocuments(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('importDocuments response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `importDocuments()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.import_documents.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ImportDocuments_async + */ + async checkImportDocumentsProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.firestore.admin.v1.ImportDocumentsMetadata + > + > { + this._log.info('importDocuments long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.importDocuments, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.firestore.admin.v1.ImportDocumentsMetadata + >; + } + /** + * Bulk deletes a subset of documents from Google Cloud Firestore. + * Documents created or updated after the underlying system starts to process + * the request will not be deleted. The bulk delete occurs in the background + * and its progress can be monitored and managed via the Operation resource + * that is created. + * + * For more details on bulk delete behavior, refer to: + * https://cloud.google.com/firestore/docs/manage-data/bulk-delete + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Database to operate. Should be of the form: + * `projects/{project_id}/databases/{database_id}`. + * @param {string[]} [request.collectionIds] + * Optional. IDs of the collection groups to delete. Unspecified means all + * collection groups. + * + * Each collection group in this list must be unique. + * @param {string[]} [request.namespaceIds] + * Optional. Namespaces to delete. + * + * An empty list means all namespaces. This is the recommended + * usage for databases that don't use namespaces. + * + * An empty string element represents the default namespace. This should be + * used if the database has data in non-default namespaces, but doesn't want + * to delete from them. + * + * Each namespace in this list must be unique. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.bulk_delete_documents.js + * region_tag:firestore_v1_generated_FirestoreAdmin_BulkDeleteDocuments_async + */ + bulkDeleteDocuments( + request?: protos.google.firestore.admin.v1.IBulkDeleteDocumentsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + bulkDeleteDocuments( + request: protos.google.firestore.admin.v1.IBulkDeleteDocumentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + bulkDeleteDocuments( + request: protos.google.firestore.admin.v1.IBulkDeleteDocumentsRequest, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + bulkDeleteDocuments( + request?: protos.google.firestore.admin.v1.IBulkDeleteDocumentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('bulkDeleteDocuments response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('bulkDeleteDocuments request %j', request); + return this.innerApiCalls + .bulkDeleteDocuments(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('bulkDeleteDocuments response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `bulkDeleteDocuments()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.bulk_delete_documents.js + * region_tag:firestore_v1_generated_FirestoreAdmin_BulkDeleteDocuments_async + */ + async checkBulkDeleteDocumentsProgress( + name: string, + ): Promise< + LROperation< + protos.google.firestore.admin.v1.BulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.BulkDeleteDocumentsMetadata + > + > { + this._log.info('bulkDeleteDocuments long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.bulkDeleteDocuments, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.firestore.admin.v1.BulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.BulkDeleteDocumentsMetadata + >; + } + /** + * Create a database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}` + * @param {google.firestore.admin.v1.Database} request.database + * Required. The Database to create. + * @param {string} request.databaseId + * Required. The ID to use for the database, which will become the final + * component of the database's resource name. + * + * This value should be 4-63 characters. Valid characters are /{@link protos.0-9|a-z}-/ + * with first character a letter and the last a letter or a number. Must not + * be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + * + * "(default)" database ID is also valid if the database is Standard edition. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.create_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_CreateDatabase_async + */ + createDatabase( + request?: protos.google.firestore.admin.v1.ICreateDatabaseRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createDatabase( + request: protos.google.firestore.admin.v1.ICreateDatabaseRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createDatabase( + request: protos.google.firestore.admin.v1.ICreateDatabaseRequest, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createDatabase( + request?: protos.google.firestore.admin.v1.ICreateDatabaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createDatabase response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createDatabase request %j', request); + return this.innerApiCalls + .createDatabase(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createDatabase response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createDatabase()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.create_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_CreateDatabase_async + */ + async checkCreateDatabaseProgress( + name: string, + ): Promise< + LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.CreateDatabaseMetadata + > + > { + this._log.info('createDatabase long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createDatabase, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.CreateDatabaseMetadata + >; + } + /** + * Updates a database. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.firestore.admin.v1.Database} request.database + * Required. The database to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.update_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async + */ + updateDatabase( + request?: protos.google.firestore.admin.v1.IUpdateDatabaseRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateDatabase( + request: protos.google.firestore.admin.v1.IUpdateDatabaseRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateDatabase( + request: protos.google.firestore.admin.v1.IUpdateDatabaseRequest, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateDatabase( + request?: protos.google.firestore.admin.v1.IUpdateDatabaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'database.name': request.database!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('updateDatabase response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('updateDatabase request %j', request); + return this.innerApiCalls + .updateDatabase(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateDatabase response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `updateDatabase()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.update_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async + */ + async checkUpdateDatabaseProgress( + name: string, + ): Promise< + LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.UpdateDatabaseMetadata + > + > { + this._log.info('updateDatabase long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateDatabase, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.UpdateDatabaseMetadata + >; + } + /** + * Deletes a database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the form + * `projects/{project_id}/databases/{database_id}` + * @param {string} request.etag + * The current etag of the Database. + * If an etag is provided and does not match the current etag of the database, + * deletion will be blocked and a FAILED_PRECONDITION error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.delete_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_DeleteDatabase_async + */ + deleteDatabase( + request?: protos.google.firestore.admin.v1.IDeleteDatabaseRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteDatabase( + request: protos.google.firestore.admin.v1.IDeleteDatabaseRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteDatabase( + request: protos.google.firestore.admin.v1.IDeleteDatabaseRequest, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteDatabase( + request?: protos.google.firestore.admin.v1.IDeleteDatabaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('deleteDatabase response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteDatabase request %j', request); + return this.innerApiCalls + .deleteDatabase(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteDatabase response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `deleteDatabase()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.delete_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_DeleteDatabase_async + */ + async checkDeleteDatabaseProgress( + name: string, + ): Promise< + LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.DeleteDatabaseMetadata + > + > { + this._log.info('deleteDatabase long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteDatabase, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.DeleteDatabaseMetadata + >; + } + /** + * Creates a new database by restoring from an existing backup. + * + * The new database must be in the same cloud region or multi-region location + * as the existing backup. This behaves similar to + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.CreateDatabase|FirestoreAdmin.CreateDatabase} + * except instead of creating a new empty database, a new database is created + * with the database type, index configuration, and documents from an existing + * backup. + * + * The {@link protos.google.longrunning.Operation|long-running operation} can be used to + * track the progress of the restore, with the Operation's + * {@link protos.google.longrunning.Operation.metadata|metadata} field type being the + * {@link protos.google.firestore.admin.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata}. + * The {@link protos.google.longrunning.Operation.response|response} type is the + * {@link protos.google.firestore.admin.v1.Database|Database} if the restore was + * successful. The new database is not readable or writeable until the LRO has + * completed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to restore the database in. Format is + * `projects/{project_id}`. + * @param {string} request.databaseId + * Required. The ID to use for the database, which will become the final + * component of the database's resource name. This database ID must not be + * associated with an existing database. + * + * This value should be 4-63 characters. Valid characters are /{@link protos.0-9|a-z}-/ + * with first character a letter and the last a letter or a number. Must not + * be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + * + * "(default)" database ID is also valid if the database is Standard edition. + * @param {string} request.backup + * Required. Backup to restore from. Must be from the same project as the + * parent. + * + * The restored database will be created in the same location as the source + * backup. + * + * Format is: `projects/{project_id}/locations/{location}/backups/{backup}` + * @param {google.firestore.admin.v1.Database.EncryptionConfig} [request.encryptionConfig] + * Optional. Encryption configuration for the restored database. + * + * If this field is not specified, the restored database will use + * the same encryption configuration as the backup, namely + * {@link protos.google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption|use_source_encryption}. + * @param {number[]} request.tags + * Optional. Immutable. Tags to be bound to the restored database. + * + * The tags should be provided in the format of + * `tagKeys/{tag_key_id} -> tagValues/{tag_value_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.restore_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_RestoreDatabase_async + */ + restoreDatabase( + request?: protos.google.firestore.admin.v1.IRestoreDatabaseRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + restoreDatabase( + request: protos.google.firestore.admin.v1.IRestoreDatabaseRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + restoreDatabase( + request: protos.google.firestore.admin.v1.IRestoreDatabaseRequest, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + restoreDatabase( + request?: protos.google.firestore.admin.v1.IRestoreDatabaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('restoreDatabase response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('restoreDatabase request %j', request); + return this.innerApiCalls + .restoreDatabase(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('restoreDatabase response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `restoreDatabase()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.restore_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_RestoreDatabase_async + */ + async checkRestoreDatabaseProgress( + name: string, + ): Promise< + LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.RestoreDatabaseMetadata + > + > { + this._log.info('restoreDatabase long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.restoreDatabase, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.RestoreDatabaseMetadata + >; + } + /** + * Creates a new database by cloning an existing one. + * + * The new database must be in the same cloud region or multi-region location + * as the existing database. This behaves similar to + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.CreateDatabase|FirestoreAdmin.CreateDatabase} + * except instead of creating a new empty database, a new database is created + * with the database type, index configuration, and documents from an existing + * database. + * + * The {@link protos.google.longrunning.Operation|long-running operation} can be used to + * track the progress of the clone, with the Operation's + * {@link protos.google.longrunning.Operation.metadata|metadata} field type being the + * {@link protos.google.firestore.admin.v1.CloneDatabaseMetadata|CloneDatabaseMetadata}. + * The {@link protos.google.longrunning.Operation.response|response} type is the + * {@link protos.google.firestore.admin.v1.Database|Database} if the clone was + * successful. The new database is not readable or writeable until the LRO has + * completed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to clone the database in. Format is + * `projects/{project_id}`. + * @param {string} request.databaseId + * Required. The ID to use for the database, which will become the final + * component of the database's resource name. This database ID must not be + * associated with an existing database. + * + * This value should be 4-63 characters. Valid characters are /{@link protos.0-9|a-z}-/ + * with first character a letter and the last a letter or a number. Must not + * be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. + * + * "(default)" database ID is also valid if the database is Standard edition. + * @param {google.firestore.admin.v1.PitrSnapshot} request.pitrSnapshot + * Required. Specification of the PITR data to clone from. The source database + * must exist. + * + * The cloned database will be created in the same location as the source + * database. + * @param {google.firestore.admin.v1.Database.EncryptionConfig} [request.encryptionConfig] + * Optional. Encryption configuration for the cloned database. + * + * If this field is not specified, the cloned database will use + * the same encryption configuration as the source database, namely + * {@link protos.google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption|use_source_encryption}. + * @param {number[]} request.tags + * Optional. Immutable. Tags to be bound to the cloned database. + * + * The tags should be provided in the format of + * `tagKeys/{tag_key_id} -> tagValues/{tag_value_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.clone_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_CloneDatabase_async + */ + cloneDatabase( + request?: protos.google.firestore.admin.v1.ICloneDatabaseRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + cloneDatabase( + request: protos.google.firestore.admin.v1.ICloneDatabaseRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + cloneDatabase( + request: protos.google.firestore.admin.v1.ICloneDatabaseRequest, + callback: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + cloneDatabase( + request?: protos.google.firestore.admin.v1.ICloneDatabaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.pitrSnapshot?.database; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue + .toString() + .match(RegExp('projects/(?[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['project_id'] ?? fieldValue; + Object.assign(routingParameter, { project_id: parameterValue }); + } + } + } + { + const fieldValue = request.pitrSnapshot?.database; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue + .toString() + .match( + RegExp('projects/[^/]+/databases/(?[^/]+)(?:/.*)?'), + ); + if (match) { + const parameterValue = match.groups?.['database_id'] ?? fieldValue; + Object.assign(routingParameter, { database_id: parameterValue }); + } + } + } + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams(routingParameter); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('cloneDatabase response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('cloneDatabase request %j', request); + return this.innerApiCalls + .cloneDatabase(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('cloneDatabase response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `cloneDatabase()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.clone_database.js + * region_tag:firestore_v1_generated_FirestoreAdmin_CloneDatabase_async + */ + async checkCloneDatabaseProgress( + name: string, + ): Promise< + LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.CloneDatabaseMetadata + > + > { + this._log.info('cloneDatabase long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.cloneDatabase, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.firestore.admin.v1.Database, + protos.google.firestore.admin.v1.CloneDatabaseMetadata + >; + } + /** + * Lists composite indexes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + * @param {string} request.filter + * The filter to apply to list results. + * @param {number} request.pageSize + * The number of results to return. + * @param {string} request.pageToken + * A page token, returned from a previous call to + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListIndexes|FirestoreAdmin.ListIndexes}, + * that may be used to get the next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.firestore.admin.v1.Index|Index}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listIndexesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listIndexes( + request?: protos.google.firestore.admin.v1.IListIndexesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IIndex[], + protos.google.firestore.admin.v1.IListIndexesRequest | null, + protos.google.firestore.admin.v1.IListIndexesResponse, + ] + >; + listIndexes( + request: protos.google.firestore.admin.v1.IListIndexesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.firestore.admin.v1.IListIndexesRequest, + protos.google.firestore.admin.v1.IListIndexesResponse | null | undefined, + protos.google.firestore.admin.v1.IIndex + >, + ): void; + listIndexes( + request: protos.google.firestore.admin.v1.IListIndexesRequest, + callback: PaginationCallback< + protos.google.firestore.admin.v1.IListIndexesRequest, + protos.google.firestore.admin.v1.IListIndexesResponse | null | undefined, + protos.google.firestore.admin.v1.IIndex + >, + ): void; + listIndexes( + request?: protos.google.firestore.admin.v1.IListIndexesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.firestore.admin.v1.IListIndexesRequest, + | protos.google.firestore.admin.v1.IListIndexesResponse + | null + | undefined, + protos.google.firestore.admin.v1.IIndex + >, + callback?: PaginationCallback< + protos.google.firestore.admin.v1.IListIndexesRequest, + protos.google.firestore.admin.v1.IListIndexesResponse | null | undefined, + protos.google.firestore.admin.v1.IIndex + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IIndex[], + protos.google.firestore.admin.v1.IListIndexesRequest | null, + protos.google.firestore.admin.v1.IListIndexesResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.firestore.admin.v1.IListIndexesRequest, + | protos.google.firestore.admin.v1.IListIndexesResponse + | null + | undefined, + protos.google.firestore.admin.v1.IIndex + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listIndexes values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listIndexes request %j', request); + return this.innerApiCalls + .listIndexes(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.firestore.admin.v1.IIndex[], + protos.google.firestore.admin.v1.IListIndexesRequest | null, + protos.google.firestore.admin.v1.IListIndexesResponse, + ]) => { + this._log.info('listIndexes values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listIndexes`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + * @param {string} request.filter + * The filter to apply to list results. + * @param {number} request.pageSize + * The number of results to return. + * @param {string} request.pageToken + * A page token, returned from a previous call to + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListIndexes|FirestoreAdmin.ListIndexes}, + * that may be used to get the next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.firestore.admin.v1.Index|Index} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listIndexesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listIndexesStream( + request?: protos.google.firestore.admin.v1.IListIndexesRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listIndexes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listIndexes stream %j', request); + return this.descriptors.page.listIndexes.createStream( + this.innerApiCalls.listIndexes as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listIndexes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + * @param {string} request.filter + * The filter to apply to list results. + * @param {number} request.pageSize + * The number of results to return. + * @param {string} request.pageToken + * A page token, returned from a previous call to + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListIndexes|FirestoreAdmin.ListIndexes}, + * that may be used to get the next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.firestore.admin.v1.Index|Index}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.list_indexes.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ListIndexes_async + */ + listIndexesAsync( + request?: protos.google.firestore.admin.v1.IListIndexesRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listIndexes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listIndexes iterate %j', request); + return this.descriptors.page.listIndexes.asyncIterate( + this.innerApiCalls['listIndexes'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + /** + * Lists the field configuration and metadata for this database. + * + * Currently, + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} + * only supports listing fields that have been explicitly overridden. To issue + * this query, call + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} + * with the filter set to `indexConfig.usesAncestorConfig:false` or + * `ttlConfig:*`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + * @param {string} request.filter + * The filter to apply to list results. Currently, + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} + * only supports listing fields that have been explicitly overridden. To issue + * this query, call + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} + * with a filter that includes `indexConfig.usesAncestorConfig:false` or + * `ttlConfig:*`. + * @param {number} request.pageSize + * The number of results to return. + * @param {string} request.pageToken + * A page token, returned from a previous call to + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields}, + * that may be used to get the next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.firestore.admin.v1.Field|Field}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFieldsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFields( + request?: protos.google.firestore.admin.v1.IListFieldsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.admin.v1.IField[], + protos.google.firestore.admin.v1.IListFieldsRequest | null, + protos.google.firestore.admin.v1.IListFieldsResponse, + ] + >; + listFields( + request: protos.google.firestore.admin.v1.IListFieldsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.firestore.admin.v1.IListFieldsRequest, + protos.google.firestore.admin.v1.IListFieldsResponse | null | undefined, + protos.google.firestore.admin.v1.IField + >, + ): void; + listFields( + request: protos.google.firestore.admin.v1.IListFieldsRequest, + callback: PaginationCallback< + protos.google.firestore.admin.v1.IListFieldsRequest, + protos.google.firestore.admin.v1.IListFieldsResponse | null | undefined, + protos.google.firestore.admin.v1.IField + >, + ): void; + listFields( + request?: protos.google.firestore.admin.v1.IListFieldsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.firestore.admin.v1.IListFieldsRequest, + | protos.google.firestore.admin.v1.IListFieldsResponse + | null + | undefined, + protos.google.firestore.admin.v1.IField + >, + callback?: PaginationCallback< + protos.google.firestore.admin.v1.IListFieldsRequest, + protos.google.firestore.admin.v1.IListFieldsResponse | null | undefined, + protos.google.firestore.admin.v1.IField + >, + ): Promise< + [ + protos.google.firestore.admin.v1.IField[], + protos.google.firestore.admin.v1.IListFieldsRequest | null, + protos.google.firestore.admin.v1.IListFieldsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.firestore.admin.v1.IListFieldsRequest, + | protos.google.firestore.admin.v1.IListFieldsResponse + | null + | undefined, + protos.google.firestore.admin.v1.IField + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listFields values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listFields request %j', request); + return this.innerApiCalls + .listFields(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.firestore.admin.v1.IField[], + protos.google.firestore.admin.v1.IListFieldsRequest | null, + protos.google.firestore.admin.v1.IListFieldsResponse, + ]) => { + this._log.info('listFields values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listFields`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + * @param {string} request.filter + * The filter to apply to list results. Currently, + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} + * only supports listing fields that have been explicitly overridden. To issue + * this query, call + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} + * with a filter that includes `indexConfig.usesAncestorConfig:false` or + * `ttlConfig:*`. + * @param {number} request.pageSize + * The number of results to return. + * @param {string} request.pageToken + * A page token, returned from a previous call to + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields}, + * that may be used to get the next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.firestore.admin.v1.Field|Field} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFieldsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listFieldsStream( + request?: protos.google.firestore.admin.v1.IListFieldsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFields']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listFields stream %j', request); + return this.descriptors.page.listFields.createStream( + this.innerApiCalls.listFields as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listFields`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. A parent name of the form + * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + * @param {string} request.filter + * The filter to apply to list results. Currently, + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} + * only supports listing fields that have been explicitly overridden. To issue + * this query, call + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} + * with a filter that includes `indexConfig.usesAncestorConfig:false` or + * `ttlConfig:*`. + * @param {number} request.pageSize + * The number of results to return. + * @param {string} request.pageToken + * A page token, returned from a previous call to + * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields}, + * that may be used to get the next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.firestore.admin.v1.Field|Field}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore_admin.list_fields.js + * region_tag:firestore_v1_generated_FirestoreAdmin_ListFields_async + */ + listFieldsAsync( + request?: protos.google.firestore.admin.v1.IListFieldsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFields']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listFields iterate %j', request); + return this.descriptors.page.listFields.asyncIterate( + this.innerApiCalls['listFields'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + ): Promise<[protos.google.longrunning.Operation]> { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions, + ): AsyncIterable { + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.cancelOperation(request, options, callback); + } + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, location: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified backupSchedule resource name string. + * + * @param {string} project + * @param {string} database + * @param {string} backup_schedule + * @returns {string} Resource name string. + */ + backupSchedulePath( + project: string, + database: string, + backupSchedule: string, + ) { + return this.pathTemplates.backupSchedulePathTemplate.render({ + project: project, + database: database, + backup_schedule: backupSchedule, + }); + } + + /** + * Parse the project from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName, + ).project; + } + + /** + * Parse the database from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the database. + */ + matchDatabaseFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName, + ).database; + } + + /** + * Parse the backup_schedule from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the backup_schedule. + */ + matchBackupScheduleFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName, + ).backup_schedule; + } + + /** + * Return a fully-qualified collectionGroup resource name string. + * + * @param {string} project + * @param {string} database + * @param {string} collection + * @returns {string} Resource name string. + */ + collectionGroupPath(project: string, database: string, collection: string) { + return this.pathTemplates.collectionGroupPathTemplate.render({ + project: project, + database: database, + collection: collection, + }); + } + + /** + * Parse the project from CollectionGroup resource. + * + * @param {string} collectionGroupName + * A fully-qualified path representing CollectionGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCollectionGroupName(collectionGroupName: string) { + return this.pathTemplates.collectionGroupPathTemplate.match( + collectionGroupName, + ).project; + } + + /** + * Parse the database from CollectionGroup resource. + * + * @param {string} collectionGroupName + * A fully-qualified path representing CollectionGroup resource. + * @returns {string} A string representing the database. + */ + matchDatabaseFromCollectionGroupName(collectionGroupName: string) { + return this.pathTemplates.collectionGroupPathTemplate.match( + collectionGroupName, + ).database; + } + + /** + * Parse the collection from CollectionGroup resource. + * + * @param {string} collectionGroupName + * A fully-qualified path representing CollectionGroup resource. + * @returns {string} A string representing the collection. + */ + matchCollectionFromCollectionGroupName(collectionGroupName: string) { + return this.pathTemplates.collectionGroupPathTemplate.match( + collectionGroupName, + ).collection; + } + + /** + * Return a fully-qualified database resource name string. + * + * @param {string} project + * @param {string} database + * @returns {string} Resource name string. + */ + databasePath(project: string, database: string) { + return this.pathTemplates.databasePathTemplate.render({ + project: project, + database: database, + }); + } + + /** + * Parse the project from Database resource. + * + * @param {string} databaseName + * A fully-qualified path representing Database resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDatabaseName(databaseName: string) { + return this.pathTemplates.databasePathTemplate.match(databaseName).project; + } + + /** + * Parse the database from Database resource. + * + * @param {string} databaseName + * A fully-qualified path representing Database resource. + * @returns {string} A string representing the database. + */ + matchDatabaseFromDatabaseName(databaseName: string) { + return this.pathTemplates.databasePathTemplate.match(databaseName).database; + } + + /** + * Return a fully-qualified field resource name string. + * + * @param {string} project + * @param {string} database + * @param {string} collection + * @param {string} field + * @returns {string} Resource name string. + */ + fieldPath( + project: string, + database: string, + collection: string, + field: string, + ) { + return this.pathTemplates.fieldPathTemplate.render({ + project: project, + database: database, + collection: collection, + field: field, + }); + } + + /** + * Parse the project from Field resource. + * + * @param {string} fieldName + * A fully-qualified path representing Field resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFieldName(fieldName: string) { + return this.pathTemplates.fieldPathTemplate.match(fieldName).project; + } + + /** + * Parse the database from Field resource. + * + * @param {string} fieldName + * A fully-qualified path representing Field resource. + * @returns {string} A string representing the database. + */ + matchDatabaseFromFieldName(fieldName: string) { + return this.pathTemplates.fieldPathTemplate.match(fieldName).database; + } + + /** + * Parse the collection from Field resource. + * + * @param {string} fieldName + * A fully-qualified path representing Field resource. + * @returns {string} A string representing the collection. + */ + matchCollectionFromFieldName(fieldName: string) { + return this.pathTemplates.fieldPathTemplate.match(fieldName).collection; + } + + /** + * Parse the field from Field resource. + * + * @param {string} fieldName + * A fully-qualified path representing Field resource. + * @returns {string} A string representing the field. + */ + matchFieldFromFieldName(fieldName: string) { + return this.pathTemplates.fieldPathTemplate.match(fieldName).field; + } + + /** + * Return a fully-qualified index resource name string. + * + * @param {string} project + * @param {string} database + * @param {string} collection + * @param {string} index + * @returns {string} Resource name string. + */ + indexPath( + project: string, + database: string, + collection: string, + index: string, + ) { + return this.pathTemplates.indexPathTemplate.render({ + project: project, + database: database, + collection: collection, + index: index, + }); + } + + /** + * Parse the project from Index resource. + * + * @param {string} indexName + * A fully-qualified path representing Index resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIndexName(indexName: string) { + return this.pathTemplates.indexPathTemplate.match(indexName).project; + } + + /** + * Parse the database from Index resource. + * + * @param {string} indexName + * A fully-qualified path representing Index resource. + * @returns {string} A string representing the database. + */ + matchDatabaseFromIndexName(indexName: string) { + return this.pathTemplates.indexPathTemplate.match(indexName).database; + } + + /** + * Parse the collection from Index resource. + * + * @param {string} indexName + * A fully-qualified path representing Index resource. + * @returns {string} A string representing the collection. + */ + matchCollectionFromIndexName(indexName: string) { + return this.pathTemplates.indexPathTemplate.match(indexName).collection; + } + + /** + * Parse the index from Index resource. + * + * @param {string} indexName + * A fully-qualified path representing Index resource. + * @returns {string} A string representing the index. + */ + matchIndexFromIndexName(indexName: string) { + return this.pathTemplates.indexPathTemplate.match(indexName).index; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified userCreds resource name string. + * + * @param {string} project + * @param {string} database + * @param {string} user_creds + * @returns {string} Resource name string. + */ + userCredsPath(project: string, database: string, userCreds: string) { + return this.pathTemplates.userCredsPathTemplate.render({ + project: project, + database: database, + user_creds: userCreds, + }); + } + + /** + * Parse the project from UserCreds resource. + * + * @param {string} userCredsName + * A fully-qualified path representing UserCreds resource. + * @returns {string} A string representing the project. + */ + matchProjectFromUserCredsName(userCredsName: string) { + return this.pathTemplates.userCredsPathTemplate.match(userCredsName) + .project; + } + + /** + * Parse the database from UserCreds resource. + * + * @param {string} userCredsName + * A fully-qualified path representing UserCreds resource. + * @returns {string} A string representing the database. + */ + matchDatabaseFromUserCredsName(userCredsName: string) { + return this.pathTemplates.userCredsPathTemplate.match(userCredsName) + .database; + } + + /** + * Parse the user_creds from UserCreds resource. + * + * @param {string} userCredsName + * A fully-qualified path representing UserCreds resource. + * @returns {string} A string representing the user_creds. + */ + matchUserCredsFromUserCredsName(userCredsName: string) { + return this.pathTemplates.userCredsPathTemplate.match(userCredsName) + .user_creds; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.firestoreAdminStub && !this._terminated) { + return this.firestoreAdminStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + void this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-firestore-api/src/v1/firestore_admin_client_config.json b/packages/google-cloud-firestore-api/src/v1/firestore_admin_client_config.json new file mode 100644 index 000000000000..101263bf1244 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1/firestore_admin_client_config.json @@ -0,0 +1,172 @@ +{ + "interfaces": { + "google.firestore.admin.v1.FirestoreAdmin": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateIndex": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListIndexes": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetIndex": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "DeleteIndex": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "GetField": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "UpdateField": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFields": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "ExportDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ImportDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BulkDeleteDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateDatabase": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDatabase": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListDatabases": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDatabase": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDatabase": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateUserCreds": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetUserCreds": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListUserCreds": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "EnableUserCreds": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DisableUserCreds": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetUserPassword": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteUserCreds": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBackup": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreDatabase": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBackupSchedule": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBackupSchedule": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackupSchedules": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBackupSchedule": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackupSchedule": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CloneDatabase": { + "timeout_millis": 120000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-firestore-api/src/v1/firestore_admin_proto_list.json b/packages/google-cloud-firestore-api/src/v1/firestore_admin_proto_list.json new file mode 100644 index 000000000000..8b50432407cb --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1/firestore_admin_proto_list.json @@ -0,0 +1,13 @@ +[ + "../../protos/google/firestore/admin/v1/backup.proto", + "../../protos/google/firestore/admin/v1/database.proto", + "../../protos/google/firestore/admin/v1/field.proto", + "../../protos/google/firestore/admin/v1/firestore_admin.proto", + "../../protos/google/firestore/admin/v1/index.proto", + "../../protos/google/firestore/admin/v1/location.proto", + "../../protos/google/firestore/admin/v1/operation.proto", + "../../protos/google/firestore/admin/v1/realtime_updates.proto", + "../../protos/google/firestore/admin/v1/schedule.proto", + "../../protos/google/firestore/admin/v1/snapshot.proto", + "../../protos/google/firestore/admin/v1/user_creds.proto" +] diff --git a/packages/google-cloud-firestore-api/src/v1/firestore_client.ts b/packages/google-cloud-firestore-api/src/v1/firestore_client.ts new file mode 100644 index 000000000000..e95d275c3b58 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1/firestore_client.ts @@ -0,0 +1,2920 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform, PassThrough } from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/firestore_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './firestore_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Cloud Firestore service. + * + * Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL + * document database that simplifies storing, syncing, and querying data for + * your mobile, web, and IoT apps at global scale. Its client libraries provide + * live synchronization and offline support, while its security features and + * integrations with Firebase and Google Cloud Platform accelerate building + * truly serverless apps. + * @class + * @memberof v1 + */ +export class FirestoreClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('firestore-api'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + firestoreStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of FirestoreClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new FirestoreClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FirestoreClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'firestore.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listDocuments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'documents', + ), + partitionQuery: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'partitions', + ), + listCollectionIds: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'collectionIds', + ), + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + batchGetDocuments: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.SERVER_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + runQuery: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.SERVER_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + executePipeline: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.SERVER_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + runAggregationQuery: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.SERVER_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + write: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + listen: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.firestore.v1.Firestore', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.firestoreStub) { + return this.firestoreStub; + } + + // Put together the "service stub" for + // google.firestore.v1.Firestore. + this.firestoreStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.firestore.v1.Firestore', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.firestore.v1.Firestore, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const firestoreStubMethods = [ + 'getDocument', + 'listDocuments', + 'updateDocument', + 'deleteDocument', + 'batchGetDocuments', + 'beginTransaction', + 'commit', + 'rollback', + 'runQuery', + 'executePipeline', + 'runAggregationQuery', + 'partitionQuery', + 'write', + 'listen', + 'listCollectionIds', + 'batchWrite', + 'createDocument', + ]; + for (const methodName of firestoreStubMethods) { + const callPromise = this.firestoreStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough({ objectMode: true }); + setImmediate(() => { + stream.emit( + 'error', + new this._gaxModule.GoogleError( + 'The client has already been closed.', + ), + ); + }); + return stream; + } + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.firestoreStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'firestore.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'firestore.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/datastore', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Gets a single document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Document to get. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * @param {google.firestore.v1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {Buffer} request.transaction + * Reads the document in a transaction. + * @param {google.protobuf.Timestamp} request.readTime + * Reads the version of the document at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1.Document|Document}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.get_document.js + * region_tag:firestore_v1_generated_Firestore_GetDocument_async + */ + getDocument( + request?: protos.google.firestore.v1.IGetDocumentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IGetDocumentRequest | undefined, + {} | undefined, + ] + >; + getDocument( + request: protos.google.firestore.v1.IGetDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IGetDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + getDocument( + request: protos.google.firestore.v1.IGetDocumentRequest, + callback: Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IGetDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + getDocument( + request?: protos.google.firestore.v1.IGetDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IGetDocumentRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IGetDocumentRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IGetDocumentRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getDocument request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IGetDocumentRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getDocument response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getDocument(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IGetDocumentRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getDocument response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates or inserts a document. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.firestore.v1.Document} request.document + * Required. The updated document. + * Creates the document if it does not already exist. + * @param {google.firestore.v1.DocumentMask} request.updateMask + * The fields to update. + * None of the field paths in the mask may contain a reserved name. + * + * If the document exists on the server and has fields not referenced in the + * mask, they are left unchanged. + * Fields referenced in the mask, but not present in the input document, are + * deleted from the document on the server. + * @param {google.firestore.v1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {google.firestore.v1.Precondition} request.currentDocument + * An optional precondition on the document. + * The request will fail if this is set and not met by the target document. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1.Document|Document}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.update_document.js + * region_tag:firestore_v1_generated_Firestore_UpdateDocument_async + */ + updateDocument( + request?: protos.google.firestore.v1.IUpdateDocumentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IUpdateDocumentRequest | undefined, + {} | undefined, + ] + >; + updateDocument( + request: protos.google.firestore.v1.IUpdateDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IUpdateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + updateDocument( + request: protos.google.firestore.v1.IUpdateDocumentRequest, + callback: Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IUpdateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + updateDocument( + request?: protos.google.firestore.v1.IUpdateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IUpdateDocumentRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IUpdateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IUpdateDocumentRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'document.name': request.document!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateDocument request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IUpdateDocumentRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateDocument response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateDocument(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.IUpdateDocumentRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateDocument response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes a document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Document to delete. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * @param {google.firestore.v1.Precondition} request.currentDocument + * An optional precondition on the document. + * The request will fail if this is set and not met by the target document. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.delete_document.js + * region_tag:firestore_v1_generated_Firestore_DeleteDocument_async + */ + deleteDocument( + request?: protos.google.firestore.v1.IDeleteDocumentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IDeleteDocumentRequest | undefined, + {} | undefined, + ] + >; + deleteDocument( + request: protos.google.firestore.v1.IDeleteDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IDeleteDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteDocument( + request: protos.google.firestore.v1.IDeleteDocumentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IDeleteDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteDocument( + request?: protos.google.firestore.v1.IDeleteDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IDeleteDocumentRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IDeleteDocumentRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IDeleteDocumentRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteDocument request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IDeleteDocumentRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteDocument response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteDocument(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IDeleteDocumentRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteDocument response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Starts a new transaction. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {google.firestore.v1.TransactionOptions} request.options + * The options for the transaction. + * Defaults to a read-write transaction. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1.BeginTransactionResponse|BeginTransactionResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.begin_transaction.js + * region_tag:firestore_v1_generated_Firestore_BeginTransaction_async + */ + beginTransaction( + request?: protos.google.firestore.v1.IBeginTransactionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1.IBeginTransactionResponse, + protos.google.firestore.v1.IBeginTransactionRequest | undefined, + {} | undefined, + ] + >; + beginTransaction( + request: protos.google.firestore.v1.IBeginTransactionRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1.IBeginTransactionResponse, + protos.google.firestore.v1.IBeginTransactionRequest | null | undefined, + {} | null | undefined + >, + ): void; + beginTransaction( + request: protos.google.firestore.v1.IBeginTransactionRequest, + callback: Callback< + protos.google.firestore.v1.IBeginTransactionResponse, + protos.google.firestore.v1.IBeginTransactionRequest | null | undefined, + {} | null | undefined + >, + ): void; + beginTransaction( + request?: protos.google.firestore.v1.IBeginTransactionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1.IBeginTransactionResponse, + | protos.google.firestore.v1.IBeginTransactionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1.IBeginTransactionResponse, + protos.google.firestore.v1.IBeginTransactionRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1.IBeginTransactionResponse, + protos.google.firestore.v1.IBeginTransactionRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('beginTransaction request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1.IBeginTransactionResponse, + | protos.google.firestore.v1.IBeginTransactionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('beginTransaction response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .beginTransaction(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1.IBeginTransactionResponse, + protos.google.firestore.v1.IBeginTransactionRequest | undefined, + {} | undefined, + ]) => { + this._log.info('beginTransaction response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Commits a transaction, while optionally updating documents. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {number[]} request.writes + * The writes to apply. + * + * Always executed atomically and in order. + * @param {Buffer} request.transaction + * If set, applies all writes in this transaction, and commits it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1.CommitResponse|CommitResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.commit.js + * region_tag:firestore_v1_generated_Firestore_Commit_async + */ + commit( + request?: protos.google.firestore.v1.ICommitRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1.ICommitResponse, + protos.google.firestore.v1.ICommitRequest | undefined, + {} | undefined, + ] + >; + commit( + request: protos.google.firestore.v1.ICommitRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1.ICommitResponse, + protos.google.firestore.v1.ICommitRequest | null | undefined, + {} | null | undefined + >, + ): void; + commit( + request: protos.google.firestore.v1.ICommitRequest, + callback: Callback< + protos.google.firestore.v1.ICommitResponse, + protos.google.firestore.v1.ICommitRequest | null | undefined, + {} | null | undefined + >, + ): void; + commit( + request?: protos.google.firestore.v1.ICommitRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1.ICommitResponse, + protos.google.firestore.v1.ICommitRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1.ICommitResponse, + protos.google.firestore.v1.ICommitRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1.ICommitResponse, + protos.google.firestore.v1.ICommitRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('commit request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1.ICommitResponse, + protos.google.firestore.v1.ICommitRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('commit response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .commit(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1.ICommitResponse, + protos.google.firestore.v1.ICommitRequest | undefined, + {} | undefined, + ]) => { + this._log.info('commit response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Rolls back a transaction. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {Buffer} request.transaction + * Required. The transaction to roll back. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.rollback.js + * region_tag:firestore_v1_generated_Firestore_Rollback_async + */ + rollback( + request?: protos.google.firestore.v1.IRollbackRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IRollbackRequest | undefined, + {} | undefined, + ] + >; + rollback( + request: protos.google.firestore.v1.IRollbackRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IRollbackRequest | null | undefined, + {} | null | undefined + >, + ): void; + rollback( + request: protos.google.firestore.v1.IRollbackRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IRollbackRequest | null | undefined, + {} | null | undefined + >, + ): void; + rollback( + request?: protos.google.firestore.v1.IRollbackRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IRollbackRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IRollbackRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IRollbackRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rollback request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IRollbackRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rollback response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rollback(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1.IRollbackRequest | undefined, + {} | undefined, + ]) => { + this._log.info('rollback response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Applies a batch of write operations. + * + * The BatchWrite method does not apply the write operations atomically + * and can apply them out of order. Method does not allow more than one write + * per document. Each write succeeds or fails independently. See the + * {@link protos.google.firestore.v1.BatchWriteResponse|BatchWriteResponse} for the + * success status of each write. + * + * If you require an atomically applied set of writes, use + * {@link protos.google.firestore.v1.Firestore.Commit|Commit} instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {number[]} request.writes + * The writes to apply. + * + * Method does not apply writes atomically and does not guarantee ordering. + * Each write succeeds or fails independently. You cannot write to the same + * document more than once per request. + * @param {number[]} request.labels + * Labels associated with this batch write. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1.BatchWriteResponse|BatchWriteResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.batch_write.js + * region_tag:firestore_v1_generated_Firestore_BatchWrite_async + */ + batchWrite( + request?: protos.google.firestore.v1.IBatchWriteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1.IBatchWriteResponse, + protos.google.firestore.v1.IBatchWriteRequest | undefined, + {} | undefined, + ] + >; + batchWrite( + request: protos.google.firestore.v1.IBatchWriteRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1.IBatchWriteResponse, + protos.google.firestore.v1.IBatchWriteRequest | null | undefined, + {} | null | undefined + >, + ): void; + batchWrite( + request: protos.google.firestore.v1.IBatchWriteRequest, + callback: Callback< + protos.google.firestore.v1.IBatchWriteResponse, + protos.google.firestore.v1.IBatchWriteRequest | null | undefined, + {} | null | undefined + >, + ): void; + batchWrite( + request?: protos.google.firestore.v1.IBatchWriteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1.IBatchWriteResponse, + protos.google.firestore.v1.IBatchWriteRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1.IBatchWriteResponse, + protos.google.firestore.v1.IBatchWriteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1.IBatchWriteResponse, + protos.google.firestore.v1.IBatchWriteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('batchWrite request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1.IBatchWriteResponse, + protos.google.firestore.v1.IBatchWriteRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('batchWrite response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .batchWrite(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1.IBatchWriteResponse, + protos.google.firestore.v1.IBatchWriteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('batchWrite response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a new document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. For example: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}` + * @param {string} request.collectionId + * Required. The collection ID, relative to `parent`, to list. For example: + * `chatrooms`. + * @param {string} request.documentId + * The client-assigned document ID to use for this document. + * + * Optional. If not specified, an ID will be assigned by the service. + * @param {google.firestore.v1.Document} request.document + * Required. The document to create. `name` must not be set. + * @param {google.firestore.v1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1.Document|Document}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.create_document.js + * region_tag:firestore_v1_generated_Firestore_CreateDocument_async + */ + createDocument( + request?: protos.google.firestore.v1.ICreateDocumentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.ICreateDocumentRequest | undefined, + {} | undefined, + ] + >; + createDocument( + request: protos.google.firestore.v1.ICreateDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.ICreateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + createDocument( + request: protos.google.firestore.v1.ICreateDocumentRequest, + callback: Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.ICreateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + createDocument( + request?: protos.google.firestore.v1.ICreateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.ICreateDocumentRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.ICreateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.ICreateDocumentRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + collection_id: request.collectionId?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createDocument request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.ICreateDocumentRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createDocument response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createDocument(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1.IDocument, + protos.google.firestore.v1.ICreateDocumentRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createDocument response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets multiple documents. + * + * Documents returned by this method are not guaranteed to be returned in the + * same order that they were requested. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {string[]} request.documents + * The names of the documents to retrieve. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * The request will fail if any of the document is not a child resource of the + * given `database`. Duplicate names will be elided. + * @param {google.firestore.v1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If a document has a field that is not present in this mask, that field will + * not be returned in the response. + * @param {Buffer} request.transaction + * Reads documents in a transaction. + * @param {google.firestore.v1.TransactionOptions} request.newTransaction + * Starts a new transaction and reads the documents. + * Defaults to a read-only transaction. + * The new transaction ID will be returned as the first response in the + * stream. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits {@link protos.google.firestore.v1.BatchGetDocumentsResponse|BatchGetDocumentsResponse} on 'data' event. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.batch_get_documents.js + * region_tag:firestore_v1_generated_Firestore_BatchGetDocuments_async + */ + batchGetDocuments( + request?: protos.google.firestore.v1.IBatchGetDocumentsRequest, + options?: CallOptions, + ): gax.CancellableStream { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('batchGetDocuments stream %j', options); + return this.innerApiCalls.batchGetDocuments(request, options); + } + + /** + * Runs a query. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {google.firestore.v1.StructuredQuery} request.structuredQuery + * A structured query. + * @param {Buffer} request.transaction + * Run the query within an already active transaction. + * + * The value here is the opaque transaction ID to execute the query in. + * @param {google.firestore.v1.TransactionOptions} request.newTransaction + * Starts a new transaction and reads the documents. + * Defaults to a read-only transaction. + * The new transaction ID will be returned as the first response in the + * stream. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {google.firestore.v1.ExplainOptions} [request.explainOptions] + * Optional. Explain options for the query. If set, additional query + * statistics will be returned. If not, only query results will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits {@link protos.google.firestore.v1.RunQueryResponse|RunQueryResponse} on 'data' event. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.run_query.js + * region_tag:firestore_v1_generated_Firestore_RunQuery_async + */ + runQuery( + request?: protos.google.firestore.v1.IRunQueryRequest, + options?: CallOptions, + ): gax.CancellableStream { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('runQuery stream %j', options); + return this.innerApiCalls.runQuery(request, options); + } + + /** + * Executes a pipeline query. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. Database identifier, in the form + * `projects/{project}/databases/{database}`. + * @param {google.firestore.v1.StructuredPipeline} request.structuredPipeline + * A pipelined operation. + * @param {Buffer} request.transaction + * Run the query within an already active transaction. + * + * The value here is the opaque transaction ID to execute the query in. + * @param {google.firestore.v1.TransactionOptions} request.newTransaction + * Execute the pipeline in a new transaction. + * + * The identifier of the newly created transaction will be returned in the + * first response on the stream. This defaults to a read-only transaction. + * @param {google.protobuf.Timestamp} request.readTime + * Execute the pipeline in a snapshot transaction at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {boolean} [request.autoCommitTransaction] + * Optional. Automatically commits the transaction after the pipeline has been + * executed. Only permitted in combination with `transaction` or + * `new_transaction`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits {@link protos.google.firestore.v1.ExecutePipelineResponse|ExecutePipelineResponse} on 'data' event. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.execute_pipeline.js + * region_tag:firestore_v1_generated_Firestore_ExecutePipeline_async + */ + executePipeline( + request?: protos.google.firestore.v1.IExecutePipelineRequest, + options?: CallOptions, + ): gax.CancellableStream { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.database; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue + .toString() + .match(RegExp('projects/(?[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['project_id'] ?? fieldValue; + Object.assign(routingParameter, { project_id: parameterValue }); + } + } + } + { + const fieldValue = request.database; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue + .toString() + .match( + RegExp('projects/[^/]+/databases/(?[^/]+)(?:/.*)?'), + ); + if (match) { + const parameterValue = match.groups?.['database_id'] ?? fieldValue; + Object.assign(routingParameter, { database_id: parameterValue }); + } + } + } + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams(routingParameter); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('executePipeline stream %j', options); + return this.innerApiCalls.executePipeline(request, options); + } + + /** + * Runs an aggregation query. + * + * Rather than producing {@link protos.google.firestore.v1.Document|Document} results like + * {@link protos.google.firestore.v1.Firestore.RunQuery|Firestore.RunQuery}, this API + * allows running an aggregation to produce a series of + * {@link protos.google.firestore.v1.AggregationResult|AggregationResult} server-side. + * + * High-Level Example: + * + * ``` + * -- Return the number of documents in table given a filter. + * SELECT COUNT(*) FROM ( SELECT * FROM k where a = true ); + * ``` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {google.firestore.v1.StructuredAggregationQuery} request.structuredAggregationQuery + * An aggregation query. + * @param {Buffer} request.transaction + * Run the aggregation within an already active transaction. + * + * The value here is the opaque transaction ID to execute the query in. + * @param {google.firestore.v1.TransactionOptions} request.newTransaction + * Starts a new transaction as part of the query, defaulting to read-only. + * + * The new transaction ID will be returned as the first response in the + * stream. + * @param {google.protobuf.Timestamp} request.readTime + * Executes the query at the given timestamp. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {google.firestore.v1.ExplainOptions} [request.explainOptions] + * Optional. Explain options for the query. If set, additional query + * statistics will be returned. If not, only query results will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits {@link protos.google.firestore.v1.RunAggregationQueryResponse|RunAggregationQueryResponse} on 'data' event. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.run_aggregation_query.js + * region_tag:firestore_v1_generated_Firestore_RunAggregationQuery_async + */ + runAggregationQuery( + request?: protos.google.firestore.v1.IRunAggregationQueryRequest, + options?: CallOptions, + ): gax.CancellableStream { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('runAggregationQuery stream %j', options); + return this.innerApiCalls.runAggregationQuery(request, options); + } + + /** + * Streams batches of document updates and deletes, in order. This method is + * only available via gRPC or WebChannel (not REST). + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.firestore.v1.WriteRequest|WriteRequest} for write() method, and + * will emit objects representing {@link protos.google.firestore.v1.WriteResponse|WriteResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.write.js + * region_tag:firestore_v1_generated_Firestore_Write_async + */ + write(options?: CallOptions): gax.CancellableStream { + this.initialize().catch((err) => { + throw err; + }); + this._log.info('write stream %j', options); + return this.innerApiCalls.write(null, options); + } + + /** + * Listens to changes. This method is only available via gRPC or WebChannel + * (not REST). + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.firestore.v1.ListenRequest|ListenRequest} for write() method, and + * will emit objects representing {@link protos.google.firestore.v1.ListenResponse|ListenResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.listen.js + * region_tag:firestore_v1_generated_Firestore_Listen_async + */ + listen(options?: CallOptions): gax.CancellableStream { + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listen stream %j', options); + return this.innerApiCalls.listen(null, options); + } + + /** + * Lists documents. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {string} [request.collectionId] + * Optional. The collection ID, relative to `parent`, to list. + * + * For example: `chatrooms` or `messages`. + * + * This is optional, and when not provided, Firestore will list documents + * from all collections under the provided `parent`. + * @param {number} [request.pageSize] + * Optional. The maximum number of documents to return in a single response. + * + * Firestore may return fewer than this value. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListDocuments` response. + * + * Provide this to retrieve the subsequent page. When paginating, all other + * parameters (with the exception of `page_size`) must match the values set + * in the request that generated the page token. + * @param {string} [request.orderBy] + * Optional. The optional ordering of the documents to return. + * + * For example: `priority desc, __name__ desc`. + * + * This mirrors the {@link protos.google.firestore.v1.StructuredQuery.order_by|`ORDER BY`} + * used in Firestore queries but in a string representation. When absent, + * documents are ordered based on `__name__ ASC`. + * @param {google.firestore.v1.DocumentMask} [request.mask] + * Optional. The fields to return. If not set, returns all fields. + * + * If a document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {Buffer} request.transaction + * Perform the read as part of an already active transaction. + * @param {google.protobuf.Timestamp} request.readTime + * Perform the read at the provided time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {boolean} request.showMissing + * If the list should show missing documents. + * + * A document is missing if it does not exist, but there are sub-documents + * nested underneath it. When true, such missing documents will be returned + * with a key but will not have fields, + * {@link protos.google.firestore.v1.Document.create_time|`create_time`}, or + * {@link protos.google.firestore.v1.Document.update_time|`update_time`} set. + * + * Requests with `show_missing` may not specify `where` or `order_by`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.firestore.v1.Document|Document}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDocumentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDocuments( + request?: protos.google.firestore.v1.IListDocumentsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1.IDocument[], + protos.google.firestore.v1.IListDocumentsRequest | null, + protos.google.firestore.v1.IListDocumentsResponse, + ] + >; + listDocuments( + request: protos.google.firestore.v1.IListDocumentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.firestore.v1.IListDocumentsRequest, + protos.google.firestore.v1.IListDocumentsResponse | null | undefined, + protos.google.firestore.v1.IDocument + >, + ): void; + listDocuments( + request: protos.google.firestore.v1.IListDocumentsRequest, + callback: PaginationCallback< + protos.google.firestore.v1.IListDocumentsRequest, + protos.google.firestore.v1.IListDocumentsResponse | null | undefined, + protos.google.firestore.v1.IDocument + >, + ): void; + listDocuments( + request?: protos.google.firestore.v1.IListDocumentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.firestore.v1.IListDocumentsRequest, + protos.google.firestore.v1.IListDocumentsResponse | null | undefined, + protos.google.firestore.v1.IDocument + >, + callback?: PaginationCallback< + protos.google.firestore.v1.IListDocumentsRequest, + protos.google.firestore.v1.IListDocumentsResponse | null | undefined, + protos.google.firestore.v1.IDocument + >, + ): Promise< + [ + protos.google.firestore.v1.IDocument[], + protos.google.firestore.v1.IListDocumentsRequest | null, + protos.google.firestore.v1.IListDocumentsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + collection_id: request.collectionId?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.firestore.v1.IListDocumentsRequest, + protos.google.firestore.v1.IListDocumentsResponse | null | undefined, + protos.google.firestore.v1.IDocument + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listDocuments values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listDocuments request %j', request); + return this.innerApiCalls + .listDocuments(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.firestore.v1.IDocument[], + protos.google.firestore.v1.IListDocumentsRequest | null, + protos.google.firestore.v1.IListDocumentsResponse, + ]) => { + this._log.info('listDocuments values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listDocuments`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {string} [request.collectionId] + * Optional. The collection ID, relative to `parent`, to list. + * + * For example: `chatrooms` or `messages`. + * + * This is optional, and when not provided, Firestore will list documents + * from all collections under the provided `parent`. + * @param {number} [request.pageSize] + * Optional. The maximum number of documents to return in a single response. + * + * Firestore may return fewer than this value. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListDocuments` response. + * + * Provide this to retrieve the subsequent page. When paginating, all other + * parameters (with the exception of `page_size`) must match the values set + * in the request that generated the page token. + * @param {string} [request.orderBy] + * Optional. The optional ordering of the documents to return. + * + * For example: `priority desc, __name__ desc`. + * + * This mirrors the {@link protos.google.firestore.v1.StructuredQuery.order_by|`ORDER BY`} + * used in Firestore queries but in a string representation. When absent, + * documents are ordered based on `__name__ ASC`. + * @param {google.firestore.v1.DocumentMask} [request.mask] + * Optional. The fields to return. If not set, returns all fields. + * + * If a document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {Buffer} request.transaction + * Perform the read as part of an already active transaction. + * @param {google.protobuf.Timestamp} request.readTime + * Perform the read at the provided time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {boolean} request.showMissing + * If the list should show missing documents. + * + * A document is missing if it does not exist, but there are sub-documents + * nested underneath it. When true, such missing documents will be returned + * with a key but will not have fields, + * {@link protos.google.firestore.v1.Document.create_time|`create_time`}, or + * {@link protos.google.firestore.v1.Document.update_time|`update_time`} set. + * + * Requests with `show_missing` may not specify `where` or `order_by`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.firestore.v1.Document|Document} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDocumentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDocumentsStream( + request?: protos.google.firestore.v1.IListDocumentsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + collection_id: request.collectionId?.toString() ?? '', + }); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listDocuments stream %j', request); + return this.descriptors.page.listDocuments.createStream( + this.innerApiCalls.listDocuments as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listDocuments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {string} [request.collectionId] + * Optional. The collection ID, relative to `parent`, to list. + * + * For example: `chatrooms` or `messages`. + * + * This is optional, and when not provided, Firestore will list documents + * from all collections under the provided `parent`. + * @param {number} [request.pageSize] + * Optional. The maximum number of documents to return in a single response. + * + * Firestore may return fewer than this value. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListDocuments` response. + * + * Provide this to retrieve the subsequent page. When paginating, all other + * parameters (with the exception of `page_size`) must match the values set + * in the request that generated the page token. + * @param {string} [request.orderBy] + * Optional. The optional ordering of the documents to return. + * + * For example: `priority desc, __name__ desc`. + * + * This mirrors the {@link protos.google.firestore.v1.StructuredQuery.order_by|`ORDER BY`} + * used in Firestore queries but in a string representation. When absent, + * documents are ordered based on `__name__ ASC`. + * @param {google.firestore.v1.DocumentMask} [request.mask] + * Optional. The fields to return. If not set, returns all fields. + * + * If a document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {Buffer} request.transaction + * Perform the read as part of an already active transaction. + * @param {google.protobuf.Timestamp} request.readTime + * Perform the read at the provided time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {boolean} request.showMissing + * If the list should show missing documents. + * + * A document is missing if it does not exist, but there are sub-documents + * nested underneath it. When true, such missing documents will be returned + * with a key but will not have fields, + * {@link protos.google.firestore.v1.Document.create_time|`create_time`}, or + * {@link protos.google.firestore.v1.Document.update_time|`update_time`} set. + * + * Requests with `show_missing` may not specify `where` or `order_by`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.firestore.v1.Document|Document}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.list_documents.js + * region_tag:firestore_v1_generated_Firestore_ListDocuments_async + */ + listDocumentsAsync( + request?: protos.google.firestore.v1.IListDocumentsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + collection_id: request.collectionId?.toString() ?? '', + }); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listDocuments iterate %j', request); + return this.descriptors.page.listDocuments.asyncIterate( + this.innerApiCalls['listDocuments'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + /** + * Partitions a query by returning partition cursors that can be used to run + * the query in parallel. The returned partition cursors are split points that + * can be used by RunQuery as starting/end points for the query results. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents`. + * Document resource names are not supported; only database resource names + * can be specified. + * @param {google.firestore.v1.StructuredQuery} request.structuredQuery + * A structured query. + * Query must specify collection with all descendants and be ordered by name + * ascending. Other filters, order bys, limits, offsets, and start/end + * cursors are not supported. + * @param {number} request.partitionCount + * The desired maximum number of partition points. + * The partitions may be returned across multiple pages of results. + * The number must be positive. The actual number of partitions + * returned may be fewer. + * + * For example, this may be set to one fewer than the number of parallel + * queries to be run, or in running a data pipeline job, one fewer than the + * number of workers or compute instances available. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous call to + * PartitionQuery that may be used to get an additional set of results. + * There are no ordering guarantees between sets of results. Thus, using + * multiple sets of results will require merging the different result sets. + * + * For example, two subsequent calls using a page_token may return: + * + * * cursor B, cursor M, cursor Q + * * cursor A, cursor U, cursor W + * + * To obtain a complete result set ordered with respect to the results of the + * query supplied to PartitionQuery, the results sets should be merged: + * cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + * @param {number} request.pageSize + * The maximum number of partitions to return in this call, subject to + * `partition_count`. + * + * For example, if `partition_count` = 10 and `page_size` = 8, the first call + * to PartitionQuery will return up to 8 partitions and a `next_page_token` + * if more results exist. A second call to PartitionQuery will return up to + * 2 partitions, to complete the total of 10 specified in `partition_count`. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.firestore.v1.Cursor|Cursor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `partitionQueryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + partitionQuery( + request?: protos.google.firestore.v1.IPartitionQueryRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1.ICursor[], + protos.google.firestore.v1.IPartitionQueryRequest | null, + protos.google.firestore.v1.IPartitionQueryResponse, + ] + >; + partitionQuery( + request: protos.google.firestore.v1.IPartitionQueryRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.firestore.v1.IPartitionQueryRequest, + protos.google.firestore.v1.IPartitionQueryResponse | null | undefined, + protos.google.firestore.v1.ICursor + >, + ): void; + partitionQuery( + request: protos.google.firestore.v1.IPartitionQueryRequest, + callback: PaginationCallback< + protos.google.firestore.v1.IPartitionQueryRequest, + protos.google.firestore.v1.IPartitionQueryResponse | null | undefined, + protos.google.firestore.v1.ICursor + >, + ): void; + partitionQuery( + request?: protos.google.firestore.v1.IPartitionQueryRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.firestore.v1.IPartitionQueryRequest, + protos.google.firestore.v1.IPartitionQueryResponse | null | undefined, + protos.google.firestore.v1.ICursor + >, + callback?: PaginationCallback< + protos.google.firestore.v1.IPartitionQueryRequest, + protos.google.firestore.v1.IPartitionQueryResponse | null | undefined, + protos.google.firestore.v1.ICursor + >, + ): Promise< + [ + protos.google.firestore.v1.ICursor[], + protos.google.firestore.v1.IPartitionQueryRequest | null, + protos.google.firestore.v1.IPartitionQueryResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.firestore.v1.IPartitionQueryRequest, + protos.google.firestore.v1.IPartitionQueryResponse | null | undefined, + protos.google.firestore.v1.ICursor + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('partitionQuery values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('partitionQuery request %j', request); + return this.innerApiCalls + .partitionQuery(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.firestore.v1.ICursor[], + protos.google.firestore.v1.IPartitionQueryRequest | null, + protos.google.firestore.v1.IPartitionQueryResponse, + ]) => { + this._log.info('partitionQuery values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `partitionQuery`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents`. + * Document resource names are not supported; only database resource names + * can be specified. + * @param {google.firestore.v1.StructuredQuery} request.structuredQuery + * A structured query. + * Query must specify collection with all descendants and be ordered by name + * ascending. Other filters, order bys, limits, offsets, and start/end + * cursors are not supported. + * @param {number} request.partitionCount + * The desired maximum number of partition points. + * The partitions may be returned across multiple pages of results. + * The number must be positive. The actual number of partitions + * returned may be fewer. + * + * For example, this may be set to one fewer than the number of parallel + * queries to be run, or in running a data pipeline job, one fewer than the + * number of workers or compute instances available. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous call to + * PartitionQuery that may be used to get an additional set of results. + * There are no ordering guarantees between sets of results. Thus, using + * multiple sets of results will require merging the different result sets. + * + * For example, two subsequent calls using a page_token may return: + * + * * cursor B, cursor M, cursor Q + * * cursor A, cursor U, cursor W + * + * To obtain a complete result set ordered with respect to the results of the + * query supplied to PartitionQuery, the results sets should be merged: + * cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + * @param {number} request.pageSize + * The maximum number of partitions to return in this call, subject to + * `partition_count`. + * + * For example, if `partition_count` = 10 and `page_size` = 8, the first call + * to PartitionQuery will return up to 8 partitions and a `next_page_token` + * if more results exist. A second call to PartitionQuery will return up to + * 2 partitions, to complete the total of 10 specified in `partition_count`. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.firestore.v1.Cursor|Cursor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `partitionQueryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + partitionQueryStream( + request?: protos.google.firestore.v1.IPartitionQueryRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['partitionQuery']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('partitionQuery stream %j', request); + return this.descriptors.page.partitionQuery.createStream( + this.innerApiCalls.partitionQuery as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `partitionQuery`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents`. + * Document resource names are not supported; only database resource names + * can be specified. + * @param {google.firestore.v1.StructuredQuery} request.structuredQuery + * A structured query. + * Query must specify collection with all descendants and be ordered by name + * ascending. Other filters, order bys, limits, offsets, and start/end + * cursors are not supported. + * @param {number} request.partitionCount + * The desired maximum number of partition points. + * The partitions may be returned across multiple pages of results. + * The number must be positive. The actual number of partitions + * returned may be fewer. + * + * For example, this may be set to one fewer than the number of parallel + * queries to be run, or in running a data pipeline job, one fewer than the + * number of workers or compute instances available. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous call to + * PartitionQuery that may be used to get an additional set of results. + * There are no ordering guarantees between sets of results. Thus, using + * multiple sets of results will require merging the different result sets. + * + * For example, two subsequent calls using a page_token may return: + * + * * cursor B, cursor M, cursor Q + * * cursor A, cursor U, cursor W + * + * To obtain a complete result set ordered with respect to the results of the + * query supplied to PartitionQuery, the results sets should be merged: + * cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + * @param {number} request.pageSize + * The maximum number of partitions to return in this call, subject to + * `partition_count`. + * + * For example, if `partition_count` = 10 and `page_size` = 8, the first call + * to PartitionQuery will return up to 8 partitions and a `next_page_token` + * if more results exist. A second call to PartitionQuery will return up to + * 2 partitions, to complete the total of 10 specified in `partition_count`. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.firestore.v1.Cursor|Cursor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.partition_query.js + * region_tag:firestore_v1_generated_Firestore_PartitionQuery_async + */ + partitionQueryAsync( + request?: protos.google.firestore.v1.IPartitionQueryRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['partitionQuery']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('partitionQuery iterate %j', request); + return this.descriptors.page.partitionQuery.asyncIterate( + this.innerApiCalls['partitionQuery'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + /** + * Lists all the collection IDs underneath a document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent document. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * + * Use `projects/{project_id}/databases/{database_id}/documents` to list + * top-level collections. + * @param {number} request.pageSize + * The maximum number of results to return. + * @param {string} request.pageToken + * A page token. Must be a value from + * {@link protos.google.firestore.v1.ListCollectionIdsResponse|ListCollectionIdsResponse}. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of string. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCollectionIdsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCollectionIds( + request?: protos.google.firestore.v1.IListCollectionIdsRequest, + options?: CallOptions, + ): Promise< + [ + string[], + protos.google.firestore.v1.IListCollectionIdsRequest | null, + protos.google.firestore.v1.IListCollectionIdsResponse, + ] + >; + listCollectionIds( + request: protos.google.firestore.v1.IListCollectionIdsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.firestore.v1.IListCollectionIdsRequest, + protos.google.firestore.v1.IListCollectionIdsResponse | null | undefined, + string + >, + ): void; + listCollectionIds( + request: protos.google.firestore.v1.IListCollectionIdsRequest, + callback: PaginationCallback< + protos.google.firestore.v1.IListCollectionIdsRequest, + protos.google.firestore.v1.IListCollectionIdsResponse | null | undefined, + string + >, + ): void; + listCollectionIds( + request?: protos.google.firestore.v1.IListCollectionIdsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.firestore.v1.IListCollectionIdsRequest, + | protos.google.firestore.v1.IListCollectionIdsResponse + | null + | undefined, + string + >, + callback?: PaginationCallback< + protos.google.firestore.v1.IListCollectionIdsRequest, + protos.google.firestore.v1.IListCollectionIdsResponse | null | undefined, + string + >, + ): Promise< + [ + string[], + protos.google.firestore.v1.IListCollectionIdsRequest | null, + protos.google.firestore.v1.IListCollectionIdsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.firestore.v1.IListCollectionIdsRequest, + | protos.google.firestore.v1.IListCollectionIdsResponse + | null + | undefined, + string + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listCollectionIds values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listCollectionIds request %j', request); + return this.innerApiCalls + .listCollectionIds(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + string[], + protos.google.firestore.v1.IListCollectionIdsRequest | null, + protos.google.firestore.v1.IListCollectionIdsResponse, + ]) => { + this._log.info('listCollectionIds values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listCollectionIds`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent document. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * + * Use `projects/{project_id}/databases/{database_id}/documents` to list + * top-level collections. + * @param {number} request.pageSize + * The maximum number of results to return. + * @param {string} request.pageToken + * A page token. Must be a value from + * {@link protos.google.firestore.v1.ListCollectionIdsResponse|ListCollectionIdsResponse}. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing string on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCollectionIdsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCollectionIdsStream( + request?: protos.google.firestore.v1.IListCollectionIdsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCollectionIds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listCollectionIds stream %j', request); + return this.descriptors.page.listCollectionIds.createStream( + this.innerApiCalls.listCollectionIds as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listCollectionIds`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent document. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * + * Use `projects/{project_id}/databases/{database_id}/documents` to list + * top-level collections. + * @param {number} request.pageSize + * The maximum number of results to return. + * @param {string} request.pageToken + * A page token. Must be a value from + * {@link protos.google.firestore.v1.ListCollectionIdsResponse|ListCollectionIdsResponse}. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * string. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/firestore.list_collection_ids.js + * region_tag:firestore_v1_generated_Firestore_ListCollectionIds_async + */ + listCollectionIdsAsync( + request?: protos.google.firestore.v1.IListCollectionIdsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCollectionIds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listCollectionIds iterate %j', request); + return this.descriptors.page.listCollectionIds.asyncIterate( + this.innerApiCalls['listCollectionIds'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.firestoreStub && !this._terminated) { + return this.firestoreStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-firestore-api/src/v1/firestore_client_config.json b/packages/google-cloud-firestore-api/src/v1/firestore_client_config.json new file mode 100644 index 000000000000..83dbf6b33921 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1/firestore_client_config.json @@ -0,0 +1,135 @@ +{ + "interfaces": { + "google.firestore.v1.Firestore": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "deadline_exceeded_resource_exhausted_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "RESOURCE_EXHAUSTED", + "INTERNAL", + "UNAVAILABLE" + ], + "resource_exhausted_unavailable": [ + "RESOURCE_EXHAUSTED", + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "UNAVAILABLE" + ], + "internal_unavailable": [ + "INTERNAL", + "UNAVAILABLE" + ], + "resource_exhausted_aborted_unavailable": [ + "RESOURCE_EXHAUSTED", + "ABORTED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetDocument": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_resource_exhausted_internal_unavailable", + "retry_params_name": "default" + }, + "ListDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_resource_exhausted_internal_unavailable", + "retry_params_name": "default" + }, + "UpdateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "resource_exhausted_unavailable", + "retry_params_name": "default" + }, + "DeleteDocument": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_resource_exhausted_internal_unavailable", + "retry_params_name": "default" + }, + "BatchGetDocuments": { + "timeout_millis": 300000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "BeginTransaction": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_resource_exhausted_internal_unavailable", + "retry_params_name": "default" + }, + "Commit": { + "timeout_millis": 60000, + "retry_codes_name": "resource_exhausted_unavailable", + "retry_params_name": "default" + }, + "Rollback": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_resource_exhausted_internal_unavailable", + "retry_params_name": "default" + }, + "RunQuery": { + "timeout_millis": 300000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "ExecutePipeline": { + "timeout_millis": 300000, + "retry_codes_name": "internal_unavailable", + "retry_params_name": "default" + }, + "RunAggregationQuery": { + "timeout_millis": 300000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "PartitionQuery": { + "timeout_millis": 300000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "Write": { + "timeout_millis": 86400000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Listen": { + "timeout_millis": 86400000, + "retry_codes_name": "deadline_exceeded_resource_exhausted_internal_unavailable", + "retry_params_name": "default" + }, + "ListCollectionIds": { + "timeout_millis": 60000, + "retry_codes_name": "deadline_exceeded_resource_exhausted_internal_unavailable", + "retry_params_name": "default" + }, + "BatchWrite": { + "timeout_millis": 60000, + "retry_codes_name": "resource_exhausted_aborted_unavailable", + "retry_params_name": "default" + }, + "CreateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "resource_exhausted_unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-firestore-api/src/v1/firestore_proto_list.json b/packages/google-cloud-firestore-api/src/v1/firestore_proto_list.json new file mode 100644 index 000000000000..6b67f4f49545 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1/firestore_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/firestore/v1/aggregation_result.proto", + "../../protos/google/firestore/v1/bloom_filter.proto", + "../../protos/google/firestore/v1/common.proto", + "../../protos/google/firestore/v1/document.proto", + "../../protos/google/firestore/v1/explain_stats.proto", + "../../protos/google/firestore/v1/firestore.proto", + "../../protos/google/firestore/v1/pipeline.proto", + "../../protos/google/firestore/v1/query.proto", + "../../protos/google/firestore/v1/query_profile.proto", + "../../protos/google/firestore/v1/write.proto" +] diff --git a/packages/google-cloud-firestore-api/src/v1/gapic_metadata.json b/packages/google-cloud-firestore-api/src/v1/gapic_metadata.json new file mode 100644 index 000000000000..8b2dd370a765 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1/gapic_metadata.json @@ -0,0 +1,351 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.firestore.admin.v1", + "libraryPackage": "@google-cloud/firestore-api", + "services": { + "FirestoreAdmin": { + "clients": { + "grpc": { + "libraryClient": "FirestoreAdminClient", + "rpcs": { + "GetIndex": { + "methods": [ + "getIndex" + ] + }, + "DeleteIndex": { + "methods": [ + "deleteIndex" + ] + }, + "GetField": { + "methods": [ + "getField" + ] + }, + "GetDatabase": { + "methods": [ + "getDatabase" + ] + }, + "ListDatabases": { + "methods": [ + "listDatabases" + ] + }, + "CreateUserCreds": { + "methods": [ + "createUserCreds" + ] + }, + "GetUserCreds": { + "methods": [ + "getUserCreds" + ] + }, + "ListUserCreds": { + "methods": [ + "listUserCreds" + ] + }, + "EnableUserCreds": { + "methods": [ + "enableUserCreds" + ] + }, + "DisableUserCreds": { + "methods": [ + "disableUserCreds" + ] + }, + "ResetUserPassword": { + "methods": [ + "resetUserPassword" + ] + }, + "DeleteUserCreds": { + "methods": [ + "deleteUserCreds" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "CreateBackupSchedule": { + "methods": [ + "createBackupSchedule" + ] + }, + "GetBackupSchedule": { + "methods": [ + "getBackupSchedule" + ] + }, + "ListBackupSchedules": { + "methods": [ + "listBackupSchedules" + ] + }, + "UpdateBackupSchedule": { + "methods": [ + "updateBackupSchedule" + ] + }, + "DeleteBackupSchedule": { + "methods": [ + "deleteBackupSchedule" + ] + }, + "CreateIndex": { + "methods": [ + "createIndex" + ] + }, + "UpdateField": { + "methods": [ + "updateField" + ] + }, + "ExportDocuments": { + "methods": [ + "exportDocuments" + ] + }, + "ImportDocuments": { + "methods": [ + "importDocuments" + ] + }, + "BulkDeleteDocuments": { + "methods": [ + "bulkDeleteDocuments" + ] + }, + "CreateDatabase": { + "methods": [ + "createDatabase" + ] + }, + "UpdateDatabase": { + "methods": [ + "updateDatabase" + ] + }, + "DeleteDatabase": { + "methods": [ + "deleteDatabase" + ] + }, + "RestoreDatabase": { + "methods": [ + "restoreDatabase" + ] + }, + "CloneDatabase": { + "methods": [ + "cloneDatabase" + ] + }, + "ListIndexes": { + "methods": [ + "listIndexes", + "listIndexesStream", + "listIndexesAsync" + ] + }, + "ListFields": { + "methods": [ + "listFields", + "listFieldsStream", + "listFieldsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FirestoreAdminClient", + "rpcs": { + "GetIndex": { + "methods": [ + "getIndex" + ] + }, + "DeleteIndex": { + "methods": [ + "deleteIndex" + ] + }, + "GetField": { + "methods": [ + "getField" + ] + }, + "GetDatabase": { + "methods": [ + "getDatabase" + ] + }, + "ListDatabases": { + "methods": [ + "listDatabases" + ] + }, + "CreateUserCreds": { + "methods": [ + "createUserCreds" + ] + }, + "GetUserCreds": { + "methods": [ + "getUserCreds" + ] + }, + "ListUserCreds": { + "methods": [ + "listUserCreds" + ] + }, + "EnableUserCreds": { + "methods": [ + "enableUserCreds" + ] + }, + "DisableUserCreds": { + "methods": [ + "disableUserCreds" + ] + }, + "ResetUserPassword": { + "methods": [ + "resetUserPassword" + ] + }, + "DeleteUserCreds": { + "methods": [ + "deleteUserCreds" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "CreateBackupSchedule": { + "methods": [ + "createBackupSchedule" + ] + }, + "GetBackupSchedule": { + "methods": [ + "getBackupSchedule" + ] + }, + "ListBackupSchedules": { + "methods": [ + "listBackupSchedules" + ] + }, + "UpdateBackupSchedule": { + "methods": [ + "updateBackupSchedule" + ] + }, + "DeleteBackupSchedule": { + "methods": [ + "deleteBackupSchedule" + ] + }, + "CreateIndex": { + "methods": [ + "createIndex" + ] + }, + "UpdateField": { + "methods": [ + "updateField" + ] + }, + "ExportDocuments": { + "methods": [ + "exportDocuments" + ] + }, + "ImportDocuments": { + "methods": [ + "importDocuments" + ] + }, + "BulkDeleteDocuments": { + "methods": [ + "bulkDeleteDocuments" + ] + }, + "CreateDatabase": { + "methods": [ + "createDatabase" + ] + }, + "UpdateDatabase": { + "methods": [ + "updateDatabase" + ] + }, + "DeleteDatabase": { + "methods": [ + "deleteDatabase" + ] + }, + "RestoreDatabase": { + "methods": [ + "restoreDatabase" + ] + }, + "CloneDatabase": { + "methods": [ + "cloneDatabase" + ] + }, + "ListIndexes": { + "methods": [ + "listIndexes", + "listIndexesStream", + "listIndexesAsync" + ] + }, + "ListFields": { + "methods": [ + "listFields", + "listFieldsStream", + "listFieldsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-firestore-api/src/v1/index.ts b/packages/google-cloud-firestore-api/src/v1/index.ts new file mode 100644 index 000000000000..8081adecbcde --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export { FirestoreAdminClient } from './firestore_admin_client'; diff --git a/packages/google-cloud-firestore-api/src/v1beta1/firestore_client.ts b/packages/google-cloud-firestore-api/src/v1beta1/firestore_client.ts new file mode 100644 index 000000000000..f8544fb3593b --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1beta1/firestore_client.ts @@ -0,0 +1,2580 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform, PassThrough } from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/firestore_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './firestore_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Cloud Firestore service. + * + * Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL + * document database that simplifies storing, syncing, and querying data for + * your mobile, web, and IoT apps at global scale. Its client libraries provide + * live synchronization and offline support, while its security features and + * integrations with Firebase and Google Cloud Platform (GCP) accelerate + * building truly serverless apps. + * @class + * @memberof v1beta1 + */ +export class FirestoreClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('firestore-api'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + firestoreStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of FirestoreClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new FirestoreClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FirestoreClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'firestore.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listDocuments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'documents', + ), + partitionQuery: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'partitions', + ), + listCollectionIds: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'collectionIds', + ), + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + batchGetDocuments: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.SERVER_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + runQuery: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.SERVER_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + write: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + listen: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.firestore.v1beta1.Firestore', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.firestoreStub) { + return this.firestoreStub; + } + + // Put together the "service stub" for + // google.firestore.v1beta1.Firestore. + this.firestoreStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.firestore.v1beta1.Firestore', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.firestore.v1beta1.Firestore, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const firestoreStubMethods = [ + 'getDocument', + 'listDocuments', + 'updateDocument', + 'deleteDocument', + 'batchGetDocuments', + 'beginTransaction', + 'commit', + 'rollback', + 'runQuery', + 'partitionQuery', + 'write', + 'listen', + 'listCollectionIds', + 'batchWrite', + 'createDocument', + ]; + for (const methodName of firestoreStubMethods) { + const callPromise = this.firestoreStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough({ objectMode: true }); + setImmediate(() => { + stream.emit( + 'error', + new this._gaxModule.GoogleError( + 'The client has already been closed.', + ), + ); + }); + return stream; + } + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.firestoreStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'firestore.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'firestore.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/datastore', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Gets a single document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Document to get. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * @param {google.firestore.v1beta1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {Buffer} request.transaction + * Reads the document in a transaction. + * @param {google.protobuf.Timestamp} request.readTime + * Reads the version of the document at the given time. + * This may not be older than 270 seconds. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1beta1.Document|Document}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.get_document.js + * region_tag:firestore_v1beta1_generated_Firestore_GetDocument_async + */ + getDocument( + request?: protos.google.firestore.v1beta1.IGetDocumentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IGetDocumentRequest | undefined, + {} | undefined, + ] + >; + getDocument( + request: protos.google.firestore.v1beta1.IGetDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IGetDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + getDocument( + request: protos.google.firestore.v1beta1.IGetDocumentRequest, + callback: Callback< + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IGetDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + getDocument( + request?: protos.google.firestore.v1beta1.IGetDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1beta1.IDocument, + | protos.google.firestore.v1beta1.IGetDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IGetDocumentRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IGetDocumentRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getDocument request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1beta1.IDocument, + | protos.google.firestore.v1beta1.IGetDocumentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getDocument response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getDocument(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IGetDocumentRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getDocument response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates or inserts a document. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.firestore.v1beta1.Document} request.document + * Required. The updated document. + * Creates the document if it does not already exist. + * @param {google.firestore.v1beta1.DocumentMask} request.updateMask + * The fields to update. + * None of the field paths in the mask may contain a reserved name. + * + * If the document exists on the server and has fields not referenced in the + * mask, they are left unchanged. + * Fields referenced in the mask, but not present in the input document, are + * deleted from the document on the server. + * @param {google.firestore.v1beta1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {google.firestore.v1beta1.Precondition} request.currentDocument + * An optional precondition on the document. + * The request will fail if this is set and not met by the target document. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1beta1.Document|Document}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.update_document.js + * region_tag:firestore_v1beta1_generated_Firestore_UpdateDocument_async + */ + updateDocument( + request?: protos.google.firestore.v1beta1.IUpdateDocumentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IUpdateDocumentRequest | undefined, + {} | undefined, + ] + >; + updateDocument( + request: protos.google.firestore.v1beta1.IUpdateDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IUpdateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + updateDocument( + request: protos.google.firestore.v1beta1.IUpdateDocumentRequest, + callback: Callback< + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IUpdateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + updateDocument( + request?: protos.google.firestore.v1beta1.IUpdateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1beta1.IDocument, + | protos.google.firestore.v1beta1.IUpdateDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IUpdateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IUpdateDocumentRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'document.name': request.document!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateDocument request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1beta1.IDocument, + | protos.google.firestore.v1beta1.IUpdateDocumentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateDocument response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateDocument(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.IUpdateDocumentRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateDocument response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes a document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Document to delete. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * @param {google.firestore.v1beta1.Precondition} request.currentDocument + * An optional precondition on the document. + * The request will fail if this is set and not met by the target document. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.delete_document.js + * region_tag:firestore_v1beta1_generated_Firestore_DeleteDocument_async + */ + deleteDocument( + request?: protos.google.firestore.v1beta1.IDeleteDocumentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IDeleteDocumentRequest | undefined, + {} | undefined, + ] + >; + deleteDocument( + request: protos.google.firestore.v1beta1.IDeleteDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IDeleteDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteDocument( + request: protos.google.firestore.v1beta1.IDeleteDocumentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IDeleteDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteDocument( + request?: protos.google.firestore.v1beta1.IDeleteDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.v1beta1.IDeleteDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IDeleteDocumentRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IDeleteDocumentRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteDocument request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.firestore.v1beta1.IDeleteDocumentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteDocument response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteDocument(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IDeleteDocumentRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteDocument response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Starts a new transaction. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {google.firestore.v1beta1.TransactionOptions} request.options + * The options for the transaction. + * Defaults to a read-write transaction. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1beta1.BeginTransactionResponse|BeginTransactionResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.begin_transaction.js + * region_tag:firestore_v1beta1_generated_Firestore_BeginTransaction_async + */ + beginTransaction( + request?: protos.google.firestore.v1beta1.IBeginTransactionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1beta1.IBeginTransactionResponse, + protos.google.firestore.v1beta1.IBeginTransactionRequest | undefined, + {} | undefined, + ] + >; + beginTransaction( + request: protos.google.firestore.v1beta1.IBeginTransactionRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1beta1.IBeginTransactionResponse, + | protos.google.firestore.v1beta1.IBeginTransactionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + beginTransaction( + request: protos.google.firestore.v1beta1.IBeginTransactionRequest, + callback: Callback< + protos.google.firestore.v1beta1.IBeginTransactionResponse, + | protos.google.firestore.v1beta1.IBeginTransactionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + beginTransaction( + request?: protos.google.firestore.v1beta1.IBeginTransactionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1beta1.IBeginTransactionResponse, + | protos.google.firestore.v1beta1.IBeginTransactionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1beta1.IBeginTransactionResponse, + | protos.google.firestore.v1beta1.IBeginTransactionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1beta1.IBeginTransactionResponse, + protos.google.firestore.v1beta1.IBeginTransactionRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('beginTransaction request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1beta1.IBeginTransactionResponse, + | protos.google.firestore.v1beta1.IBeginTransactionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('beginTransaction response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .beginTransaction(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1beta1.IBeginTransactionResponse, + protos.google.firestore.v1beta1.IBeginTransactionRequest | undefined, + {} | undefined, + ]) => { + this._log.info('beginTransaction response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Commits a transaction, while optionally updating documents. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {number[]} request.writes + * The writes to apply. + * + * Always executed atomically and in order. + * @param {Buffer} request.transaction + * If set, applies all writes in this transaction, and commits it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1beta1.CommitResponse|CommitResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.commit.js + * region_tag:firestore_v1beta1_generated_Firestore_Commit_async + */ + commit( + request?: protos.google.firestore.v1beta1.ICommitRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1beta1.ICommitResponse, + protos.google.firestore.v1beta1.ICommitRequest | undefined, + {} | undefined, + ] + >; + commit( + request: protos.google.firestore.v1beta1.ICommitRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1beta1.ICommitResponse, + protos.google.firestore.v1beta1.ICommitRequest | null | undefined, + {} | null | undefined + >, + ): void; + commit( + request: protos.google.firestore.v1beta1.ICommitRequest, + callback: Callback< + protos.google.firestore.v1beta1.ICommitResponse, + protos.google.firestore.v1beta1.ICommitRequest | null | undefined, + {} | null | undefined + >, + ): void; + commit( + request?: protos.google.firestore.v1beta1.ICommitRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1beta1.ICommitResponse, + protos.google.firestore.v1beta1.ICommitRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1beta1.ICommitResponse, + protos.google.firestore.v1beta1.ICommitRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1beta1.ICommitResponse, + protos.google.firestore.v1beta1.ICommitRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('commit request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1beta1.ICommitResponse, + protos.google.firestore.v1beta1.ICommitRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('commit response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .commit(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1beta1.ICommitResponse, + protos.google.firestore.v1beta1.ICommitRequest | undefined, + {} | undefined, + ]) => { + this._log.info('commit response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Rolls back a transaction. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {Buffer} request.transaction + * Required. The transaction to roll back. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.rollback.js + * region_tag:firestore_v1beta1_generated_Firestore_Rollback_async + */ + rollback( + request?: protos.google.firestore.v1beta1.IRollbackRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IRollbackRequest | undefined, + {} | undefined, + ] + >; + rollback( + request: protos.google.firestore.v1beta1.IRollbackRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IRollbackRequest | null | undefined, + {} | null | undefined + >, + ): void; + rollback( + request: protos.google.firestore.v1beta1.IRollbackRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IRollbackRequest | null | undefined, + {} | null | undefined + >, + ): void; + rollback( + request?: protos.google.firestore.v1beta1.IRollbackRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IRollbackRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IRollbackRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IRollbackRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rollback request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IRollbackRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rollback response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rollback(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.firestore.v1beta1.IRollbackRequest | undefined, + {} | undefined, + ]) => { + this._log.info('rollback response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Applies a batch of write operations. + * + * The BatchWrite method does not apply the write operations atomically + * and can apply them out of order. Method does not allow more than one write + * per document. Each write succeeds or fails independently. See the + * {@link protos.google.firestore.v1beta1.BatchWriteResponse|BatchWriteResponse} for the success status of each write. + * + * If you require an atomically applied set of writes, use + * {@link protos.google.firestore.v1beta1.Firestore.Commit|Commit} instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {number[]} request.writes + * The writes to apply. + * + * Method does not apply writes atomically and does not guarantee ordering. + * Each write succeeds or fails independently. You cannot write to the same + * document more than once per request. + * @param {number[]} request.labels + * Labels associated with this batch write. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1beta1.BatchWriteResponse|BatchWriteResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.batch_write.js + * region_tag:firestore_v1beta1_generated_Firestore_BatchWrite_async + */ + batchWrite( + request?: protos.google.firestore.v1beta1.IBatchWriteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1beta1.IBatchWriteResponse, + protos.google.firestore.v1beta1.IBatchWriteRequest | undefined, + {} | undefined, + ] + >; + batchWrite( + request: protos.google.firestore.v1beta1.IBatchWriteRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1beta1.IBatchWriteResponse, + protos.google.firestore.v1beta1.IBatchWriteRequest | null | undefined, + {} | null | undefined + >, + ): void; + batchWrite( + request: protos.google.firestore.v1beta1.IBatchWriteRequest, + callback: Callback< + protos.google.firestore.v1beta1.IBatchWriteResponse, + protos.google.firestore.v1beta1.IBatchWriteRequest | null | undefined, + {} | null | undefined + >, + ): void; + batchWrite( + request?: protos.google.firestore.v1beta1.IBatchWriteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1beta1.IBatchWriteResponse, + protos.google.firestore.v1beta1.IBatchWriteRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1beta1.IBatchWriteResponse, + protos.google.firestore.v1beta1.IBatchWriteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1beta1.IBatchWriteResponse, + protos.google.firestore.v1beta1.IBatchWriteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('batchWrite request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1beta1.IBatchWriteResponse, + protos.google.firestore.v1beta1.IBatchWriteRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('batchWrite response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .batchWrite(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1beta1.IBatchWriteResponse, + protos.google.firestore.v1beta1.IBatchWriteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('batchWrite response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a new document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. For example: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}` + * @param {string} request.collectionId + * Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`. + * @param {string} request.documentId + * The client-assigned document ID to use for this document. + * + * Optional. If not specified, an ID will be assigned by the service. + * @param {google.firestore.v1beta1.Document} request.document + * Required. The document to create. `name` must not be set. + * @param {google.firestore.v1beta1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If the document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.firestore.v1beta1.Document|Document}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.create_document.js + * region_tag:firestore_v1beta1_generated_Firestore_CreateDocument_async + */ + createDocument( + request?: protos.google.firestore.v1beta1.ICreateDocumentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.ICreateDocumentRequest | undefined, + {} | undefined, + ] + >; + createDocument( + request: protos.google.firestore.v1beta1.ICreateDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.ICreateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + createDocument( + request: protos.google.firestore.v1beta1.ICreateDocumentRequest, + callback: Callback< + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.ICreateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): void; + createDocument( + request?: protos.google.firestore.v1beta1.ICreateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.firestore.v1beta1.IDocument, + | protos.google.firestore.v1beta1.ICreateDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.ICreateDocumentRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.ICreateDocumentRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + collection_id: request.collectionId?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createDocument request %j', request); + const wrappedCallback: + | Callback< + protos.google.firestore.v1beta1.IDocument, + | protos.google.firestore.v1beta1.ICreateDocumentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createDocument response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createDocument(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.firestore.v1beta1.IDocument, + protos.google.firestore.v1beta1.ICreateDocumentRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createDocument response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets multiple documents. + * + * Documents returned by this method are not guaranteed to be returned in the + * same order that they were requested. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Required. The database name. In the format: + * `projects/{project_id}/databases/{database_id}`. + * @param {string[]} request.documents + * The names of the documents to retrieve. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * The request will fail if any of the document is not a child resource of the + * given `database`. Duplicate names will be elided. + * @param {google.firestore.v1beta1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If a document has a field that is not present in this mask, that field will + * not be returned in the response. + * @param {Buffer} request.transaction + * Reads documents in a transaction. + * @param {google.firestore.v1beta1.TransactionOptions} request.newTransaction + * Starts a new transaction and reads the documents. + * Defaults to a read-only transaction. + * The new transaction ID will be returned as the first response in the + * stream. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * This may not be older than 270 seconds. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits {@link protos.google.firestore.v1beta1.BatchGetDocumentsResponse|BatchGetDocumentsResponse} on 'data' event. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.batch_get_documents.js + * region_tag:firestore_v1beta1_generated_Firestore_BatchGetDocuments_async + */ + batchGetDocuments( + request?: protos.google.firestore.v1beta1.IBatchGetDocumentsRequest, + options?: CallOptions, + ): gax.CancellableStream { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('batchGetDocuments stream %j', options); + return this.innerApiCalls.batchGetDocuments(request, options); + } + + /** + * Runs a query. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {google.firestore.v1beta1.StructuredQuery} request.structuredQuery + * A structured query. + * @param {Buffer} request.transaction + * Reads documents in a transaction. + * @param {google.firestore.v1beta1.TransactionOptions} request.newTransaction + * Starts a new transaction and reads the documents. + * Defaults to a read-only transaction. + * The new transaction ID will be returned as the first response in the + * stream. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * This may not be older than 270 seconds. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits {@link protos.google.firestore.v1beta1.RunQueryResponse|RunQueryResponse} on 'data' event. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.run_query.js + * region_tag:firestore_v1beta1_generated_Firestore_RunQuery_async + */ + runQuery( + request?: protos.google.firestore.v1beta1.IRunQueryRequest, + options?: CallOptions, + ): gax.CancellableStream { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('runQuery stream %j', options); + return this.innerApiCalls.runQuery(request, options); + } + + /** + * Streams batches of document updates and deletes, in order. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.firestore.v1beta1.WriteRequest|WriteRequest} for write() method, and + * will emit objects representing {@link protos.google.firestore.v1beta1.WriteResponse|WriteResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.write.js + * region_tag:firestore_v1beta1_generated_Firestore_Write_async + */ + write(options?: CallOptions): gax.CancellableStream { + this.initialize().catch((err) => { + throw err; + }); + this._log.info('write stream %j', options); + return this.innerApiCalls.write(null, options); + } + + /** + * Listens to changes. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.firestore.v1beta1.ListenRequest|ListenRequest} for write() method, and + * will emit objects representing {@link protos.google.firestore.v1beta1.ListenResponse|ListenResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.listen.js + * region_tag:firestore_v1beta1_generated_Firestore_Listen_async + */ + listen(options?: CallOptions): gax.CancellableStream { + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listen stream %j', options); + return this.innerApiCalls.listen(null, options); + } + + /** + * Lists documents. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {string} request.collectionId + * Required. The collection ID, relative to `parent`, to list. For example: `chatrooms` + * or `messages`. + * @param {number} request.pageSize + * The maximum number of documents to return. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if any. + * @param {string} request.orderBy + * The order to sort results by. For example: `priority desc, name`. + * @param {google.firestore.v1beta1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If a document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {Buffer} request.transaction + * Reads documents in a transaction. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * This may not be older than 270 seconds. + * @param {boolean} request.showMissing + * If the list should show missing documents. A missing document is a + * document that does not exist but has sub-documents. These documents will + * be returned with a key but will not have fields, {@link protos.google.firestore.v1beta1.Document.create_time|Document.create_time}, + * or {@link protos.google.firestore.v1beta1.Document.update_time|Document.update_time} set. + * + * Requests with `show_missing` may not specify `where` or + * `order_by`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.firestore.v1beta1.Document|Document}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDocumentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDocuments( + request?: protos.google.firestore.v1beta1.IListDocumentsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1beta1.IDocument[], + protos.google.firestore.v1beta1.IListDocumentsRequest | null, + protos.google.firestore.v1beta1.IListDocumentsResponse, + ] + >; + listDocuments( + request: protos.google.firestore.v1beta1.IListDocumentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.firestore.v1beta1.IListDocumentsRequest, + protos.google.firestore.v1beta1.IListDocumentsResponse | null | undefined, + protos.google.firestore.v1beta1.IDocument + >, + ): void; + listDocuments( + request: protos.google.firestore.v1beta1.IListDocumentsRequest, + callback: PaginationCallback< + protos.google.firestore.v1beta1.IListDocumentsRequest, + protos.google.firestore.v1beta1.IListDocumentsResponse | null | undefined, + protos.google.firestore.v1beta1.IDocument + >, + ): void; + listDocuments( + request?: protos.google.firestore.v1beta1.IListDocumentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.firestore.v1beta1.IListDocumentsRequest, + | protos.google.firestore.v1beta1.IListDocumentsResponse + | null + | undefined, + protos.google.firestore.v1beta1.IDocument + >, + callback?: PaginationCallback< + protos.google.firestore.v1beta1.IListDocumentsRequest, + protos.google.firestore.v1beta1.IListDocumentsResponse | null | undefined, + protos.google.firestore.v1beta1.IDocument + >, + ): Promise< + [ + protos.google.firestore.v1beta1.IDocument[], + protos.google.firestore.v1beta1.IListDocumentsRequest | null, + protos.google.firestore.v1beta1.IListDocumentsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + collection_id: request.collectionId?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.firestore.v1beta1.IListDocumentsRequest, + | protos.google.firestore.v1beta1.IListDocumentsResponse + | null + | undefined, + protos.google.firestore.v1beta1.IDocument + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listDocuments values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listDocuments request %j', request); + return this.innerApiCalls + .listDocuments(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.firestore.v1beta1.IDocument[], + protos.google.firestore.v1beta1.IListDocumentsRequest | null, + protos.google.firestore.v1beta1.IListDocumentsResponse, + ]) => { + this._log.info('listDocuments values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listDocuments`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {string} request.collectionId + * Required. The collection ID, relative to `parent`, to list. For example: `chatrooms` + * or `messages`. + * @param {number} request.pageSize + * The maximum number of documents to return. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if any. + * @param {string} request.orderBy + * The order to sort results by. For example: `priority desc, name`. + * @param {google.firestore.v1beta1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If a document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {Buffer} request.transaction + * Reads documents in a transaction. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * This may not be older than 270 seconds. + * @param {boolean} request.showMissing + * If the list should show missing documents. A missing document is a + * document that does not exist but has sub-documents. These documents will + * be returned with a key but will not have fields, {@link protos.google.firestore.v1beta1.Document.create_time|Document.create_time}, + * or {@link protos.google.firestore.v1beta1.Document.update_time|Document.update_time} set. + * + * Requests with `show_missing` may not specify `where` or + * `order_by`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.firestore.v1beta1.Document|Document} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDocumentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listDocumentsStream( + request?: protos.google.firestore.v1beta1.IListDocumentsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + collection_id: request.collectionId?.toString() ?? '', + }); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listDocuments stream %j', request); + return this.descriptors.page.listDocuments.createStream( + this.innerApiCalls.listDocuments as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listDocuments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents` or + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents` or + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {string} request.collectionId + * Required. The collection ID, relative to `parent`, to list. For example: `chatrooms` + * or `messages`. + * @param {number} request.pageSize + * The maximum number of documents to return. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if any. + * @param {string} request.orderBy + * The order to sort results by. For example: `priority desc, name`. + * @param {google.firestore.v1beta1.DocumentMask} request.mask + * The fields to return. If not set, returns all fields. + * + * If a document has a field that is not present in this mask, that field + * will not be returned in the response. + * @param {Buffer} request.transaction + * Reads documents in a transaction. + * @param {google.protobuf.Timestamp} request.readTime + * Reads documents as they were at the given time. + * This may not be older than 270 seconds. + * @param {boolean} request.showMissing + * If the list should show missing documents. A missing document is a + * document that does not exist but has sub-documents. These documents will + * be returned with a key but will not have fields, {@link protos.google.firestore.v1beta1.Document.create_time|Document.create_time}, + * or {@link protos.google.firestore.v1beta1.Document.update_time|Document.update_time} set. + * + * Requests with `show_missing` may not specify `where` or + * `order_by`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.firestore.v1beta1.Document|Document}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.list_documents.js + * region_tag:firestore_v1beta1_generated_Firestore_ListDocuments_async + */ + listDocumentsAsync( + request?: protos.google.firestore.v1beta1.IListDocumentsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + collection_id: request.collectionId?.toString() ?? '', + }); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listDocuments iterate %j', request); + return this.descriptors.page.listDocuments.asyncIterate( + this.innerApiCalls['listDocuments'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + /** + * Partitions a query by returning partition cursors that can be used to run + * the query in parallel. The returned partition cursors are split points that + * can be used by RunQuery as starting/end points for the query results. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents`. + * Document resource names are not supported; only database resource names + * can be specified. + * @param {google.firestore.v1beta1.StructuredQuery} request.structuredQuery + * A structured query. + * Query must specify collection with all descendants and be ordered by name + * ascending. Other filters, order bys, limits, offsets, and start/end + * cursors are not supported. + * @param {number} request.partitionCount + * The desired maximum number of partition points. + * The partitions may be returned across multiple pages of results. + * The number must be positive. The actual number of partitions + * returned may be fewer. + * + * For example, this may be set to one fewer than the number of parallel + * queries to be run, or in running a data pipeline job, one fewer than the + * number of workers or compute instances available. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous call to + * PartitionQuery that may be used to get an additional set of results. + * There are no ordering guarantees between sets of results. Thus, using + * multiple sets of results will require merging the different result sets. + * + * For example, two subsequent calls using a page_token may return: + * + * * cursor B, cursor M, cursor Q + * * cursor A, cursor U, cursor W + * + * To obtain a complete result set ordered with respect to the results of the + * query supplied to PartitionQuery, the results sets should be merged: + * cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + * @param {number} request.pageSize + * The maximum number of partitions to return in this call, subject to + * `partition_count`. + * + * For example, if `partition_count` = 10 and `page_size` = 8, the first call + * to PartitionQuery will return up to 8 partitions and a `next_page_token` + * if more results exist. A second call to PartitionQuery will return up to + * 2 partitions, to complete the total of 10 specified in `partition_count`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.firestore.v1beta1.Cursor|Cursor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `partitionQueryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + partitionQuery( + request?: protos.google.firestore.v1beta1.IPartitionQueryRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.firestore.v1beta1.ICursor[], + protos.google.firestore.v1beta1.IPartitionQueryRequest | null, + protos.google.firestore.v1beta1.IPartitionQueryResponse, + ] + >; + partitionQuery( + request: protos.google.firestore.v1beta1.IPartitionQueryRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.firestore.v1beta1.IPartitionQueryRequest, + | protos.google.firestore.v1beta1.IPartitionQueryResponse + | null + | undefined, + protos.google.firestore.v1beta1.ICursor + >, + ): void; + partitionQuery( + request: protos.google.firestore.v1beta1.IPartitionQueryRequest, + callback: PaginationCallback< + protos.google.firestore.v1beta1.IPartitionQueryRequest, + | protos.google.firestore.v1beta1.IPartitionQueryResponse + | null + | undefined, + protos.google.firestore.v1beta1.ICursor + >, + ): void; + partitionQuery( + request?: protos.google.firestore.v1beta1.IPartitionQueryRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.firestore.v1beta1.IPartitionQueryRequest, + | protos.google.firestore.v1beta1.IPartitionQueryResponse + | null + | undefined, + protos.google.firestore.v1beta1.ICursor + >, + callback?: PaginationCallback< + protos.google.firestore.v1beta1.IPartitionQueryRequest, + | protos.google.firestore.v1beta1.IPartitionQueryResponse + | null + | undefined, + protos.google.firestore.v1beta1.ICursor + >, + ): Promise< + [ + protos.google.firestore.v1beta1.ICursor[], + protos.google.firestore.v1beta1.IPartitionQueryRequest | null, + protos.google.firestore.v1beta1.IPartitionQueryResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.firestore.v1beta1.IPartitionQueryRequest, + | protos.google.firestore.v1beta1.IPartitionQueryResponse + | null + | undefined, + protos.google.firestore.v1beta1.ICursor + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('partitionQuery values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('partitionQuery request %j', request); + return this.innerApiCalls + .partitionQuery(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.firestore.v1beta1.ICursor[], + protos.google.firestore.v1beta1.IPartitionQueryRequest | null, + protos.google.firestore.v1beta1.IPartitionQueryResponse, + ]) => { + this._log.info('partitionQuery values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `partitionQuery`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents`. + * Document resource names are not supported; only database resource names + * can be specified. + * @param {google.firestore.v1beta1.StructuredQuery} request.structuredQuery + * A structured query. + * Query must specify collection with all descendants and be ordered by name + * ascending. Other filters, order bys, limits, offsets, and start/end + * cursors are not supported. + * @param {number} request.partitionCount + * The desired maximum number of partition points. + * The partitions may be returned across multiple pages of results. + * The number must be positive. The actual number of partitions + * returned may be fewer. + * + * For example, this may be set to one fewer than the number of parallel + * queries to be run, or in running a data pipeline job, one fewer than the + * number of workers or compute instances available. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous call to + * PartitionQuery that may be used to get an additional set of results. + * There are no ordering guarantees between sets of results. Thus, using + * multiple sets of results will require merging the different result sets. + * + * For example, two subsequent calls using a page_token may return: + * + * * cursor B, cursor M, cursor Q + * * cursor A, cursor U, cursor W + * + * To obtain a complete result set ordered with respect to the results of the + * query supplied to PartitionQuery, the results sets should be merged: + * cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + * @param {number} request.pageSize + * The maximum number of partitions to return in this call, subject to + * `partition_count`. + * + * For example, if `partition_count` = 10 and `page_size` = 8, the first call + * to PartitionQuery will return up to 8 partitions and a `next_page_token` + * if more results exist. A second call to PartitionQuery will return up to + * 2 partitions, to complete the total of 10 specified in `partition_count`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.firestore.v1beta1.Cursor|Cursor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `partitionQueryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + partitionQueryStream( + request?: protos.google.firestore.v1beta1.IPartitionQueryRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['partitionQuery']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('partitionQuery stream %j', request); + return this.descriptors.page.partitionQuery.createStream( + this.innerApiCalls.partitionQuery as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `partitionQuery`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. In the format: + * `projects/{project_id}/databases/{database_id}/documents`. + * Document resource names are not supported; only database resource names + * can be specified. + * @param {google.firestore.v1beta1.StructuredQuery} request.structuredQuery + * A structured query. + * Query must specify collection with all descendants and be ordered by name + * ascending. Other filters, order bys, limits, offsets, and start/end + * cursors are not supported. + * @param {number} request.partitionCount + * The desired maximum number of partition points. + * The partitions may be returned across multiple pages of results. + * The number must be positive. The actual number of partitions + * returned may be fewer. + * + * For example, this may be set to one fewer than the number of parallel + * queries to be run, or in running a data pipeline job, one fewer than the + * number of workers or compute instances available. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous call to + * PartitionQuery that may be used to get an additional set of results. + * There are no ordering guarantees between sets of results. Thus, using + * multiple sets of results will require merging the different result sets. + * + * For example, two subsequent calls using a page_token may return: + * + * * cursor B, cursor M, cursor Q + * * cursor A, cursor U, cursor W + * + * To obtain a complete result set ordered with respect to the results of the + * query supplied to PartitionQuery, the results sets should be merged: + * cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W + * @param {number} request.pageSize + * The maximum number of partitions to return in this call, subject to + * `partition_count`. + * + * For example, if `partition_count` = 10 and `page_size` = 8, the first call + * to PartitionQuery will return up to 8 partitions and a `next_page_token` + * if more results exist. A second call to PartitionQuery will return up to + * 2 partitions, to complete the total of 10 specified in `partition_count`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.firestore.v1beta1.Cursor|Cursor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.partition_query.js + * region_tag:firestore_v1beta1_generated_Firestore_PartitionQuery_async + */ + partitionQueryAsync( + request?: protos.google.firestore.v1beta1.IPartitionQueryRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['partitionQuery']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('partitionQuery iterate %j', request); + return this.descriptors.page.partitionQuery.asyncIterate( + this.innerApiCalls['partitionQuery'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + /** + * Lists all the collection IDs underneath a document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent document. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {number} request.pageSize + * The maximum number of results to return. + * @param {string} request.pageToken + * A page token. Must be a value from + * {@link protos.google.firestore.v1beta1.ListCollectionIdsResponse|ListCollectionIdsResponse}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of string. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCollectionIdsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCollectionIds( + request?: protos.google.firestore.v1beta1.IListCollectionIdsRequest, + options?: CallOptions, + ): Promise< + [ + string[], + protos.google.firestore.v1beta1.IListCollectionIdsRequest | null, + protos.google.firestore.v1beta1.IListCollectionIdsResponse, + ] + >; + listCollectionIds( + request: protos.google.firestore.v1beta1.IListCollectionIdsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.firestore.v1beta1.IListCollectionIdsRequest, + | protos.google.firestore.v1beta1.IListCollectionIdsResponse + | null + | undefined, + string + >, + ): void; + listCollectionIds( + request: protos.google.firestore.v1beta1.IListCollectionIdsRequest, + callback: PaginationCallback< + protos.google.firestore.v1beta1.IListCollectionIdsRequest, + | protos.google.firestore.v1beta1.IListCollectionIdsResponse + | null + | undefined, + string + >, + ): void; + listCollectionIds( + request?: protos.google.firestore.v1beta1.IListCollectionIdsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.firestore.v1beta1.IListCollectionIdsRequest, + | protos.google.firestore.v1beta1.IListCollectionIdsResponse + | null + | undefined, + string + >, + callback?: PaginationCallback< + protos.google.firestore.v1beta1.IListCollectionIdsRequest, + | protos.google.firestore.v1beta1.IListCollectionIdsResponse + | null + | undefined, + string + >, + ): Promise< + [ + string[], + protos.google.firestore.v1beta1.IListCollectionIdsRequest | null, + protos.google.firestore.v1beta1.IListCollectionIdsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.firestore.v1beta1.IListCollectionIdsRequest, + | protos.google.firestore.v1beta1.IListCollectionIdsResponse + | null + | undefined, + string + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listCollectionIds values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listCollectionIds request %j', request); + return this.innerApiCalls + .listCollectionIds(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + string[], + protos.google.firestore.v1beta1.IListCollectionIdsRequest | null, + protos.google.firestore.v1beta1.IListCollectionIdsResponse, + ]) => { + this._log.info('listCollectionIds values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listCollectionIds`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent document. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {number} request.pageSize + * The maximum number of results to return. + * @param {string} request.pageToken + * A page token. Must be a value from + * {@link protos.google.firestore.v1beta1.ListCollectionIdsResponse|ListCollectionIdsResponse}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing string on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCollectionIdsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCollectionIdsStream( + request?: protos.google.firestore.v1beta1.IListCollectionIdsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCollectionIds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listCollectionIds stream %j', request); + return this.descriptors.page.listCollectionIds.createStream( + this.innerApiCalls.listCollectionIds as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listCollectionIds`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent document. In the format: + * `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + * For example: + * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + * @param {number} request.pageSize + * The maximum number of results to return. + * @param {string} request.pageToken + * A page token. Must be a value from + * {@link protos.google.firestore.v1beta1.ListCollectionIdsResponse|ListCollectionIdsResponse}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * string. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/firestore.list_collection_ids.js + * region_tag:firestore_v1beta1_generated_Firestore_ListCollectionIds_async + */ + listCollectionIdsAsync( + request?: protos.google.firestore.v1beta1.IListCollectionIdsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCollectionIds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listCollectionIds iterate %j', request); + return this.descriptors.page.listCollectionIds.asyncIterate( + this.innerApiCalls['listCollectionIds'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.firestoreStub && !this._terminated) { + return this.firestoreStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-firestore-api/src/v1beta1/firestore_client_config.json b/packages/google-cloud-firestore-api/src/v1beta1/firestore_client_config.json new file mode 100644 index 000000000000..b0366d662600 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1beta1/firestore_client_config.json @@ -0,0 +1,99 @@ +{ + "interfaces": { + "google.firestore.v1beta1.Firestore": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetDocument": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDocument": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "BatchGetDocuments": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "BeginTransaction": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "Commit": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Rollback": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RunQuery": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "PartitionQuery": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Write": { + "timeout_millis": 86400000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Listen": { + "timeout_millis": 86400000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListCollectionIds": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "BatchWrite": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-firestore-api/src/v1beta1/firestore_proto_list.json b/packages/google-cloud-firestore-api/src/v1beta1/firestore_proto_list.json new file mode 100644 index 000000000000..735b79559172 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1beta1/firestore_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/firestore/v1beta1/common.proto", + "../../protos/google/firestore/v1beta1/document.proto", + "../../protos/google/firestore/v1beta1/firestore.proto", + "../../protos/google/firestore/v1beta1/query.proto", + "../../protos/google/firestore/v1beta1/undeliverable_first_gen_event.proto", + "../../protos/google/firestore/v1beta1/write.proto" +] diff --git a/packages/google-cloud-firestore-api/src/v1beta1/gapic_metadata.json b/packages/google-cloud-firestore-api/src/v1beta1/gapic_metadata.json new file mode 100644 index 000000000000..2a3edce69462 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1beta1/gapic_metadata.json @@ -0,0 +1,165 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.firestore.v1beta1", + "libraryPackage": "@google-cloud/firestore-api", + "services": { + "Firestore": { + "clients": { + "grpc": { + "libraryClient": "FirestoreClient", + "rpcs": { + "GetDocument": { + "methods": [ + "getDocument" + ] + }, + "UpdateDocument": { + "methods": [ + "updateDocument" + ] + }, + "DeleteDocument": { + "methods": [ + "deleteDocument" + ] + }, + "BeginTransaction": { + "methods": [ + "beginTransaction" + ] + }, + "Commit": { + "methods": [ + "commit" + ] + }, + "Rollback": { + "methods": [ + "rollback" + ] + }, + "BatchWrite": { + "methods": [ + "batchWrite" + ] + }, + "CreateDocument": { + "methods": [ + "createDocument" + ] + }, + "BatchGetDocuments": { + "methods": [ + "batchGetDocuments" + ] + }, + "RunQuery": { + "methods": [ + "runQuery" + ] + }, + "Write": { + "methods": [ + "write" + ] + }, + "Listen": { + "methods": [ + "listen" + ] + }, + "ListDocuments": { + "methods": [ + "listDocuments", + "listDocumentsStream", + "listDocumentsAsync" + ] + }, + "PartitionQuery": { + "methods": [ + "partitionQuery", + "partitionQueryStream", + "partitionQueryAsync" + ] + }, + "ListCollectionIds": { + "methods": [ + "listCollectionIds", + "listCollectionIdsStream", + "listCollectionIdsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FirestoreClient", + "rpcs": { + "GetDocument": { + "methods": [ + "getDocument" + ] + }, + "UpdateDocument": { + "methods": [ + "updateDocument" + ] + }, + "DeleteDocument": { + "methods": [ + "deleteDocument" + ] + }, + "BeginTransaction": { + "methods": [ + "beginTransaction" + ] + }, + "Commit": { + "methods": [ + "commit" + ] + }, + "Rollback": { + "methods": [ + "rollback" + ] + }, + "BatchWrite": { + "methods": [ + "batchWrite" + ] + }, + "CreateDocument": { + "methods": [ + "createDocument" + ] + }, + "ListDocuments": { + "methods": [ + "listDocuments", + "listDocumentsStream", + "listDocumentsAsync" + ] + }, + "PartitionQuery": { + "methods": [ + "partitionQuery", + "partitionQueryStream", + "partitionQueryAsync" + ] + }, + "ListCollectionIds": { + "methods": [ + "listCollectionIds", + "listCollectionIdsStream", + "listCollectionIdsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-firestore-api/src/v1beta1/index.ts b/packages/google-cloud-firestore-api/src/v1beta1/index.ts new file mode 100644 index 000000000000..8c1a2503fd89 --- /dev/null +++ b/packages/google-cloud-firestore-api/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export { FirestoreClient } from './firestore_client'; diff --git a/packages/google-cloud-firestore-api/system-test/fixtures/sample/src/index.js b/packages/google-cloud-firestore-api/system-test/fixtures/sample/src/index.js new file mode 100644 index 000000000000..7eca1f1ddde7 --- /dev/null +++ b/packages/google-cloud-firestore-api/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const admin = require('@google-cloud/firestore-api'); + +function main() { + const firestoreAdminClient = new admin.FirestoreAdminClient(); +} + +main(); diff --git a/packages/google-cloud-firestore-api/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-firestore-api/system-test/fixtures/sample/src/index.ts new file mode 100644 index 000000000000..e8651e095676 --- /dev/null +++ b/packages/google-cloud-firestore-api/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { FirestoreAdminClient } from '@google-cloud/firestore-api'; + +// check that the client class type name can be used +function doStuffWithFirestoreAdminClient(client: FirestoreAdminClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const firestoreAdminClient = new FirestoreAdminClient(); + doStuffWithFirestoreAdminClient(firestoreAdminClient); +} + +main(); diff --git a/packages/google-cloud-firestore-api/system-test/install.ts b/packages/google-cloud-firestore-api/system-test/install.ts new file mode 100644 index 000000000000..ccf167042d2e --- /dev/null +++ b/packages/google-cloud-firestore-api/system-test/install.ts @@ -0,0 +1,51 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, + }; + await packNTest(options); + }); + + it('JavaScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, + }; + await packNTest(options); + }); +}); diff --git a/packages/google-cloud-firestore-api/test/gapic_firestore_admin_v1.ts b/packages/google-cloud-firestore-api/test/gapic_firestore_admin_v1.ts new file mode 100644 index 000000000000..5674eac077b7 --- /dev/null +++ b/packages/google-cloud-firestore-api/test/gapic_firestore_admin_v1.ts @@ -0,0 +1,6597 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as firestoreadminModule from '../src'; + +import { PassThrough } from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.FirestoreAdminClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'firestore.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + firestoreadminModule.v1.FirestoreAdminClient.servicePath; + assert.strictEqual(servicePath, 'firestore.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + firestoreadminModule.v1.FirestoreAdminClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'firestore.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new firestoreadminModule.v1.FirestoreAdminClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new firestoreadminModule.v1.FirestoreAdminClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = firestoreadminModule.v1.FirestoreAdminClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.firestoreAdminStub, undefined); + await client.initialize(); + assert(client.firestoreAdminStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.firestoreAdminStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.firestoreAdminStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getIndex', () => { + it('invokes getIndex without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.Index(), + ); + client.innerApiCalls.getIndex = stubSimpleCall(expectedResponse); + const [response] = await client.getIndex(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIndex without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.Index(), + ); + client.innerApiCalls.getIndex = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIndex( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IIndex | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIndex with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIndex = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIndex(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIndex with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getIndex(request), expectedError); + }); + }); + + describe('deleteIndex', () => { + it('invokes deleteIndex without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteIndex = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIndex(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIndex without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteIndex = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIndex( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIndex with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIndex = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteIndex(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIndex with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteIndex(request), expectedError); + }); + }); + + describe('getField', () => { + it('invokes getField without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetFieldRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetFieldRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.Field(), + ); + client.innerApiCalls.getField = stubSimpleCall(expectedResponse); + const [response] = await client.getField(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getField as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getField as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getField without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetFieldRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetFieldRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.Field(), + ); + client.innerApiCalls.getField = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getField( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IField | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getField as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getField as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getField with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetFieldRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetFieldRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getField = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getField(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getField as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getField as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getField with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetFieldRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetFieldRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getField(request), expectedError); + }); + }); + + describe('getDatabase', () => { + it('invokes getDatabase without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetDatabaseRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.Database(), + ); + client.innerApiCalls.getDatabase = stubSimpleCall(expectedResponse); + const [response] = await client.getDatabase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDatabase without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetDatabaseRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.Database(), + ); + client.innerApiCalls.getDatabase = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDatabase( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IDatabase | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDatabase with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetDatabaseRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDatabase = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDatabase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDatabase with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetDatabaseRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDatabase(request), expectedError); + }); + }); + + describe('listDatabases', () => { + it('invokes listDatabases without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListDatabasesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListDatabasesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.ListDatabasesResponse(), + ); + client.innerApiCalls.listDatabases = stubSimpleCall(expectedResponse); + const [response] = await client.listDatabases(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatabases without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListDatabasesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListDatabasesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.ListDatabasesResponse(), + ); + client.innerApiCalls.listDatabases = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDatabases( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IListDatabasesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatabases with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListDatabasesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListDatabasesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDatabases = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listDatabases(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatabases with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListDatabasesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListDatabasesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listDatabases(request), expectedError); + }); + }); + + describe('createUserCreds', () => { + it('invokes createUserCreds without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateUserCredsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.createUserCreds = stubSimpleCall(expectedResponse); + const [response] = await client.createUserCreds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createUserCreds without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateUserCredsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.createUserCreds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createUserCreds( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IUserCreds | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createUserCreds with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateUserCredsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createUserCreds = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createUserCreds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createUserCreds with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateUserCredsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createUserCreds(request), expectedError); + }); + }); + + describe('getUserCreds', () => { + it('invokes getUserCreds without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.getUserCreds = stubSimpleCall(expectedResponse); + const [response] = await client.getUserCreds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getUserCreds without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.getUserCreds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getUserCreds( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IUserCreds | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getUserCreds with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getUserCreds = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getUserCreds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getUserCreds with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getUserCreds(request), expectedError); + }); + }); + + describe('listUserCreds', () => { + it('invokes listUserCreds without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListUserCredsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.ListUserCredsResponse(), + ); + client.innerApiCalls.listUserCreds = stubSimpleCall(expectedResponse); + const [response] = await client.listUserCreds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUserCreds without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListUserCredsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.ListUserCredsResponse(), + ); + client.innerApiCalls.listUserCreds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUserCreds( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IListUserCredsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUserCreds with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListUserCredsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUserCreds = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listUserCreds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listUserCreds with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListUserCredsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listUserCreds(request), expectedError); + }); + }); + + describe('enableUserCreds', () => { + it('invokes enableUserCreds without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.EnableUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.EnableUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.enableUserCreds = stubSimpleCall(expectedResponse); + const [response] = await client.enableUserCreds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.enableUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes enableUserCreds without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.EnableUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.EnableUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.enableUserCreds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.enableUserCreds( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IUserCreds | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.enableUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes enableUserCreds with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.EnableUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.EnableUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.enableUserCreds = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.enableUserCreds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.enableUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes enableUserCreds with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.EnableUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.EnableUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.enableUserCreds(request), expectedError); + }); + }); + + describe('disableUserCreds', () => { + it('invokes disableUserCreds without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DisableUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DisableUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.disableUserCreds = stubSimpleCall(expectedResponse); + const [response] = await client.disableUserCreds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.disableUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes disableUserCreds without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DisableUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DisableUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.disableUserCreds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.disableUserCreds( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IUserCreds | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.disableUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes disableUserCreds with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DisableUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DisableUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.disableUserCreds = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.disableUserCreds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.disableUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes disableUserCreds with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DisableUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DisableUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.disableUserCreds(request), expectedError); + }); + }); + + describe('resetUserPassword', () => { + it('invokes resetUserPassword without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ResetUserPasswordRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ResetUserPasswordRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.resetUserPassword = stubSimpleCall(expectedResponse); + const [response] = await client.resetUserPassword(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetUserPassword as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetUserPassword as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetUserPassword without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ResetUserPasswordRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ResetUserPasswordRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.UserCreds(), + ); + client.innerApiCalls.resetUserPassword = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetUserPassword( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IUserCreds | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetUserPassword as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetUserPassword as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetUserPassword with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ResetUserPasswordRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ResetUserPasswordRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetUserPassword = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetUserPassword(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetUserPassword as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetUserPassword as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetUserPassword with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ResetUserPasswordRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ResetUserPasswordRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resetUserPassword(request), expectedError); + }); + }); + + describe('deleteUserCreds', () => { + it('invokes deleteUserCreds without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteUserCreds = stubSimpleCall(expectedResponse); + const [response] = await client.deleteUserCreds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteUserCreds without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteUserCreds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteUserCreds( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteUserCreds with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUserCreds = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteUserCreds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteUserCreds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUserCreds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteUserCreds with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteUserCredsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteUserCredsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteUserCreds(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.Backup(), + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.Backup(), + ); + client.innerApiCalls.getBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IBackup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupsResponse(), + ); + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupsResponse(), + ); + client.innerApiCalls.listBackups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IListBackupsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listBackups(request), expectedError); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteBackup(request), expectedError); + }); + }); + + describe('createBackupSchedule', () => { + it('invokes createBackupSchedule without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateBackupScheduleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.BackupSchedule(), + ); + client.innerApiCalls.createBackupSchedule = + stubSimpleCall(expectedResponse); + const [response] = await client.createBackupSchedule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackupSchedule without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateBackupScheduleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.BackupSchedule(), + ); + client.innerApiCalls.createBackupSchedule = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackupSchedule( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IBackupSchedule | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackupSchedule with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateBackupScheduleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackupSchedule = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createBackupSchedule(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackupSchedule with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateBackupScheduleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createBackupSchedule(request), expectedError); + }); + }); + + describe('getBackupSchedule', () => { + it('invokes getBackupSchedule without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetBackupScheduleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.BackupSchedule(), + ); + client.innerApiCalls.getBackupSchedule = stubSimpleCall(expectedResponse); + const [response] = await client.getBackupSchedule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackupSchedule without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetBackupScheduleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.BackupSchedule(), + ); + client.innerApiCalls.getBackupSchedule = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackupSchedule( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IBackupSchedule | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackupSchedule with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetBackupScheduleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackupSchedule = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getBackupSchedule(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackupSchedule with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.GetBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.GetBackupScheduleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getBackupSchedule(request), expectedError); + }); + }); + + describe('listBackupSchedules', () => { + it('invokes listBackupSchedules without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupSchedulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListBackupSchedulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupSchedulesResponse(), + ); + client.innerApiCalls.listBackupSchedules = + stubSimpleCall(expectedResponse); + const [response] = await client.listBackupSchedules(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackupSchedules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackupSchedules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupSchedules without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupSchedulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListBackupSchedulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupSchedulesResponse(), + ); + client.innerApiCalls.listBackupSchedules = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackupSchedules( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IListBackupSchedulesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackupSchedules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackupSchedules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupSchedules with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupSchedulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListBackupSchedulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackupSchedules = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listBackupSchedules(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listBackupSchedules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackupSchedules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupSchedules with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListBackupSchedulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListBackupSchedulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listBackupSchedules(request), expectedError); + }); + }); + + describe('updateBackupSchedule', () => { + it('invokes updateBackupSchedule without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateBackupScheduleRequest(), + ); + request.backupSchedule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateBackupScheduleRequest', + ['backupSchedule', 'name'], + ); + request.backupSchedule.name = defaultValue1; + const expectedHeaderRequestParams = `backup_schedule.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.BackupSchedule(), + ); + client.innerApiCalls.updateBackupSchedule = + stubSimpleCall(expectedResponse); + const [response] = await client.updateBackupSchedule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackupSchedule without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateBackupScheduleRequest(), + ); + request.backupSchedule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateBackupScheduleRequest', + ['backupSchedule', 'name'], + ); + request.backupSchedule.name = defaultValue1; + const expectedHeaderRequestParams = `backup_schedule.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.admin.v1.BackupSchedule(), + ); + client.innerApiCalls.updateBackupSchedule = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackupSchedule( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IBackupSchedule | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackupSchedule with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateBackupScheduleRequest(), + ); + request.backupSchedule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateBackupScheduleRequest', + ['backupSchedule', 'name'], + ); + request.backupSchedule.name = defaultValue1; + const expectedHeaderRequestParams = `backup_schedule.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackupSchedule = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateBackupSchedule(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackupSchedule with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateBackupScheduleRequest(), + ); + request.backupSchedule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateBackupScheduleRequest', + ['backupSchedule', 'name'], + ); + request.backupSchedule.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateBackupSchedule(request), expectedError); + }); + }); + + describe('deleteBackupSchedule', () => { + it('invokes deleteBackupSchedule without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteBackupScheduleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteBackupSchedule = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteBackupSchedule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackupSchedule without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteBackupScheduleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteBackupSchedule = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackupSchedule( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackupSchedule with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteBackupScheduleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackupSchedule = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteBackupSchedule(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackupSchedule with closed client', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteBackupScheduleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteBackupScheduleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteBackupSchedule(request), expectedError); + }); + }); + + describe('createIndex', () => { + it('invokes createIndex without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateIndexRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createIndex = stubLongRunningCall(expectedResponse); + const [operation] = await client.createIndex(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIndex without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateIndexRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createIndex = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIndex( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.firestore.admin.v1.IIndex, + protos.google.firestore.admin.v1.IIndexOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIndex with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateIndexRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIndex = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createIndex(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIndex with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateIndexRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIndex = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createIndex(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateIndexProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateIndexProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateIndexProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkCreateIndexProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateField', () => { + it('invokes updateField without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateFieldRequest(), + ); + request.field ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateFieldRequest', + ['field', 'name'], + ); + request.field.name = defaultValue1; + const expectedHeaderRequestParams = `field.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateField = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateField(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateField as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateField as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateField without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateFieldRequest(), + ); + request.field ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateFieldRequest', + ['field', 'name'], + ); + request.field.name = defaultValue1; + const expectedHeaderRequestParams = `field.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateField = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateField( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.firestore.admin.v1.IField, + protos.google.firestore.admin.v1.IFieldOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateField as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateField as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateField with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateFieldRequest(), + ); + request.field ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateFieldRequest', + ['field', 'name'], + ); + request.field.name = defaultValue1; + const expectedHeaderRequestParams = `field.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateField = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateField(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateField as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateField as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateField with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateFieldRequest(), + ); + request.field ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateFieldRequest', + ['field', 'name'], + ); + request.field.name = defaultValue1; + const expectedHeaderRequestParams = `field.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateField = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateField(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateField as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateField as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFieldProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFieldProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFieldProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUpdateFieldProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('exportDocuments', () => { + it('invokes exportDocuments without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ExportDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ExportDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.exportDocuments = + stubLongRunningCall(expectedResponse); + const [operation] = await client.exportDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportDocuments without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ExportDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ExportDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.exportDocuments = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.firestore.admin.v1.IExportDocumentsResponse, + protos.google.firestore.admin.v1.IExportDocumentsMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportDocuments with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ExportDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ExportDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportDocuments = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.exportDocuments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.exportDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportDocuments with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ExportDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ExportDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.exportDocuments(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.exportDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportDocumentsProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportDocumentsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportDocumentsProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkExportDocumentsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importDocuments', () => { + it('invokes importDocuments without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ImportDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ImportDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.importDocuments = + stubLongRunningCall(expectedResponse); + const [operation] = await client.importDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ImportDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ImportDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.importDocuments = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.firestore.admin.v1.IImportDocumentsMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ImportDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ImportDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.importDocuments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ImportDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ImportDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.importDocuments(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportDocumentsProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportDocumentsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportDocumentsProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkImportDocumentsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('bulkDeleteDocuments', () => { + it('invokes bulkDeleteDocuments without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.BulkDeleteDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.BulkDeleteDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.bulkDeleteDocuments = + stubLongRunningCall(expectedResponse); + const [operation] = await client.bulkDeleteDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.bulkDeleteDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.bulkDeleteDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes bulkDeleteDocuments without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.BulkDeleteDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.BulkDeleteDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.bulkDeleteDocuments = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.bulkDeleteDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.firestore.admin.v1.IBulkDeleteDocumentsResponse, + protos.google.firestore.admin.v1.IBulkDeleteDocumentsMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.bulkDeleteDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.bulkDeleteDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes bulkDeleteDocuments with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.BulkDeleteDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.BulkDeleteDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.bulkDeleteDocuments = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.bulkDeleteDocuments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.bulkDeleteDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.bulkDeleteDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes bulkDeleteDocuments with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.BulkDeleteDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.BulkDeleteDocumentsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.bulkDeleteDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.bulkDeleteDocuments(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.bulkDeleteDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.bulkDeleteDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBulkDeleteDocumentsProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBulkDeleteDocumentsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBulkDeleteDocumentsProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkBulkDeleteDocumentsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createDatabase', () => { + it('invokes createDatabase without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateDatabaseRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDatabase = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createDatabase(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDatabase without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateDatabaseRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDatabase = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDatabase( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICreateDatabaseMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDatabase with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateDatabaseRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDatabase = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createDatabase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDatabase with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CreateDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.CreateDatabaseRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDatabase = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createDatabase(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateDatabaseProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateDatabaseProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateDatabaseProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateDatabaseProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateDatabase', () => { + it('invokes updateDatabase without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateDatabaseRequest(), + ); + request.database ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateDatabaseRequest', + ['database', 'name'], + ); + request.database.name = defaultValue1; + const expectedHeaderRequestParams = `database.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDatabase = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDatabase(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDatabase without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateDatabaseRequest(), + ); + request.database ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateDatabaseRequest', + ['database', 'name'], + ); + request.database.name = defaultValue1; + const expectedHeaderRequestParams = `database.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDatabase = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDatabase( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IUpdateDatabaseMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDatabase with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateDatabaseRequest(), + ); + request.database ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateDatabaseRequest', + ['database', 'name'], + ); + request.database.name = defaultValue1; + const expectedHeaderRequestParams = `database.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDatabase = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateDatabase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDatabase with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.UpdateDatabaseRequest(), + ); + request.database ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.UpdateDatabaseRequest', + ['database', 'name'], + ); + request.database.name = defaultValue1; + const expectedHeaderRequestParams = `database.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDatabase = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateDatabase(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateDatabaseProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateDatabaseProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateDatabaseProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateDatabaseProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteDatabase', () => { + it('invokes deleteDatabase without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteDatabaseRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteDatabase = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDatabase(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDatabase without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteDatabaseRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteDatabase = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDatabase( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IDeleteDatabaseMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDatabase with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteDatabaseRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDatabase = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteDatabase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDatabase with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.DeleteDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.DeleteDatabaseRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDatabase = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteDatabase(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteDatabaseProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteDatabaseProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteDatabaseProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteDatabaseProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('restoreDatabase', () => { + it('invokes restoreDatabase without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.RestoreDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.RestoreDatabaseRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.restoreDatabase = + stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreDatabase(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreDatabase without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.RestoreDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.RestoreDatabaseRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.restoreDatabase = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreDatabase( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.IRestoreDatabaseMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreDatabase with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.RestoreDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.RestoreDatabaseRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreDatabase = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.restoreDatabase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreDatabase with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.RestoreDatabaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.RestoreDatabaseRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreDatabase = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.restoreDatabase(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreDatabaseProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreDatabaseProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreDatabaseProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRestoreDatabaseProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('cloneDatabase', () => { + it('invokes cloneDatabase without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CloneDatabaseRequest(), + ); + request.pitrSnapshot = {}; + // path template: projects/*/databases/{database_id=*}/** + request.pitrSnapshot.database = 'projects/value/databases/value/value'; + const expectedHeaderRequestParams = 'database_id=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cloneDatabase = + stubLongRunningCall(expectedResponse); + const [operation] = await client.cloneDatabase(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cloneDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cloneDatabase without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CloneDatabaseRequest(), + ); + request.pitrSnapshot = {}; + // path template: projects/*/databases/{database_id=*}/** + request.pitrSnapshot.database = 'projects/value/databases/value/value'; + const expectedHeaderRequestParams = 'database_id=value'; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cloneDatabase = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cloneDatabase( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.firestore.admin.v1.IDatabase, + protos.google.firestore.admin.v1.ICloneDatabaseMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cloneDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cloneDatabase with call error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CloneDatabaseRequest(), + ); + request.pitrSnapshot = {}; + // path template: projects/*/databases/{database_id=*}/** + request.pitrSnapshot.database = 'projects/value/databases/value/value'; + const expectedHeaderRequestParams = 'database_id=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.cloneDatabase = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.cloneDatabase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.cloneDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cloneDatabase with LRO error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.CloneDatabaseRequest(), + ); + request.pitrSnapshot = {}; + // path template: projects/*/databases/{database_id=*}/** + request.pitrSnapshot.database = 'projects/value/databases/value/value'; + const expectedHeaderRequestParams = 'database_id=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.cloneDatabase = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.cloneDatabase(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.cloneDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCloneDatabaseProgress without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCloneDatabaseProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCloneDatabaseProgress with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCloneDatabaseProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listIndexes', () => { + it('invokes listIndexes without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + ]; + client.innerApiCalls.listIndexes = stubSimpleCall(expectedResponse); + const [response] = await client.listIndexes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIndexes without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + ]; + client.innerApiCalls.listIndexes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIndexes( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IIndex[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIndexes with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listIndexes = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listIndexes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIndexesStream without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + ]; + client.descriptors.page.listIndexes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listIndexesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.admin.v1.Index[] = []; + stream.on( + 'data', + (response: protos.google.firestore.admin.v1.Index) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listIndexes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIndexes, request), + ); + assert( + (client.descriptors.page.listIndexes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listIndexesStream with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIndexes.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listIndexesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.admin.v1.Index[] = []; + stream.on( + 'data', + (response: protos.google.firestore.admin.v1.Index) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listIndexes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIndexes, request), + ); + assert( + (client.descriptors.page.listIndexes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listIndexes without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + generateSampleMessage(new protos.google.firestore.admin.v1.Index()), + ]; + client.descriptors.page.listIndexes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.firestore.admin.v1.IIndex[] = []; + const iterable = client.listIndexesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listIndexes.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listIndexes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listIndexes with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIndexes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listIndexesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.firestore.admin.v1.IIndex[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listIndexes.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listIndexes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listFields', () => { + it('invokes listFields without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListFieldsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListFieldsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + ]; + client.innerApiCalls.listFields = stubSimpleCall(expectedResponse); + const [response] = await client.listFields(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFields as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFields as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFields without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListFieldsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListFieldsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + ]; + client.innerApiCalls.listFields = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFields( + request, + ( + err?: Error | null, + result?: protos.google.firestore.admin.v1.IField[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFields as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFields as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFields with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListFieldsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListFieldsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFields = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listFields(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listFields as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFields as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFieldsStream without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListFieldsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListFieldsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + ]; + client.descriptors.page.listFields.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFieldsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.admin.v1.Field[] = []; + stream.on( + 'data', + (response: protos.google.firestore.admin.v1.Field) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listFields.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFields, request), + ); + assert( + (client.descriptors.page.listFields.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listFieldsStream with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListFieldsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListFieldsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFields.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listFieldsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.admin.v1.Field[] = []; + stream.on( + 'data', + (response: protos.google.firestore.admin.v1.Field) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFields.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFields, request), + ); + assert( + (client.descriptors.page.listFields.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listFields without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListFieldsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListFieldsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + generateSampleMessage(new protos.google.firestore.admin.v1.Field()), + ]; + client.descriptors.page.listFields.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.firestore.admin.v1.IField[] = []; + const iterable = client.listFieldsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFields.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listFields.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listFields with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.admin.v1.ListFieldsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.admin.v1.ListFieldsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFields.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listFieldsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.firestore.admin.v1.IField[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFields.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listFields.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backup: 'backupValue', + }; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath( + 'projectValue', + 'locationValue', + 'backupValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('backupSchedule', async () => { + const fakePath = '/rendered/path/backupSchedule'; + const expectedParameters = { + project: 'projectValue', + database: 'databaseValue', + backup_schedule: 'backupScheduleValue', + }; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupSchedulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupSchedulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupSchedulePath', () => { + const result = client.backupSchedulePath( + 'projectValue', + 'databaseValue', + 'backupScheduleValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupSchedulePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupScheduleName', () => { + const result = client.matchProjectFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDatabaseFromBackupScheduleName', () => { + const result = client.matchDatabaseFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'databaseValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupScheduleFromBackupScheduleName', () => { + const result = + client.matchBackupScheduleFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'backupScheduleValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('collectionGroup', async () => { + const fakePath = '/rendered/path/collectionGroup'; + const expectedParameters = { + project: 'projectValue', + database: 'databaseValue', + collection: 'collectionValue', + }; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.collectionGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.collectionGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('collectionGroupPath', () => { + const result = client.collectionGroupPath( + 'projectValue', + 'databaseValue', + 'collectionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.collectionGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromCollectionGroupName', () => { + const result = client.matchProjectFromCollectionGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.collectionGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDatabaseFromCollectionGroupName', () => { + const result = client.matchDatabaseFromCollectionGroupName(fakePath); + assert.strictEqual(result, 'databaseValue'); + assert( + (client.pathTemplates.collectionGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCollectionFromCollectionGroupName', () => { + const result = client.matchCollectionFromCollectionGroupName(fakePath); + assert.strictEqual(result, 'collectionValue'); + assert( + (client.pathTemplates.collectionGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('database', async () => { + const fakePath = '/rendered/path/database'; + const expectedParameters = { + project: 'projectValue', + database: 'databaseValue', + }; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.databasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.databasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('databasePath', () => { + const result = client.databasePath('projectValue', 'databaseValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.databasePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDatabaseName', () => { + const result = client.matchProjectFromDatabaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.databasePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDatabaseFromDatabaseName', () => { + const result = client.matchDatabaseFromDatabaseName(fakePath); + assert.strictEqual(result, 'databaseValue'); + assert( + (client.pathTemplates.databasePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('field', async () => { + const fakePath = '/rendered/path/field'; + const expectedParameters = { + project: 'projectValue', + database: 'databaseValue', + collection: 'collectionValue', + field: 'fieldValue', + }; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.fieldPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.fieldPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('fieldPath', () => { + const result = client.fieldPath( + 'projectValue', + 'databaseValue', + 'collectionValue', + 'fieldValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.fieldPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFieldName', () => { + const result = client.matchProjectFromFieldName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.fieldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDatabaseFromFieldName', () => { + const result = client.matchDatabaseFromFieldName(fakePath); + assert.strictEqual(result, 'databaseValue'); + assert( + (client.pathTemplates.fieldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCollectionFromFieldName', () => { + const result = client.matchCollectionFromFieldName(fakePath); + assert.strictEqual(result, 'collectionValue'); + assert( + (client.pathTemplates.fieldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFieldFromFieldName', () => { + const result = client.matchFieldFromFieldName(fakePath); + assert.strictEqual(result, 'fieldValue'); + assert( + (client.pathTemplates.fieldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('index', async () => { + const fakePath = '/rendered/path/index'; + const expectedParameters = { + project: 'projectValue', + database: 'databaseValue', + collection: 'collectionValue', + index: 'indexValue', + }; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexPath', () => { + const result = client.indexPath( + 'projectValue', + 'databaseValue', + 'collectionValue', + 'indexValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromIndexName', () => { + const result = client.matchProjectFromIndexName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDatabaseFromIndexName', () => { + const result = client.matchDatabaseFromIndexName(fakePath); + assert.strictEqual(result, 'databaseValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCollectionFromIndexName', () => { + const result = client.matchCollectionFromIndexName(fakePath); + assert.strictEqual(result, 'collectionValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexFromIndexName', () => { + const result = client.matchIndexFromIndexName(fakePath); + assert.strictEqual(result, 'indexValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('userCreds', async () => { + const fakePath = '/rendered/path/userCreds'; + const expectedParameters = { + project: 'projectValue', + database: 'databaseValue', + user_creds: 'userCredsValue', + }; + const client = new firestoreadminModule.v1.FirestoreAdminClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.userCredsPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.userCredsPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('userCredsPath', () => { + const result = client.userCredsPath( + 'projectValue', + 'databaseValue', + 'userCredsValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.userCredsPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUserCredsName', () => { + const result = client.matchProjectFromUserCredsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.userCredsPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDatabaseFromUserCredsName', () => { + const result = client.matchDatabaseFromUserCredsName(fakePath); + assert.strictEqual(result, 'databaseValue'); + assert( + (client.pathTemplates.userCredsPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUserCredsFromUserCredsName', () => { + const result = client.matchUserCredsFromUserCredsName(fakePath); + assert.strictEqual(result, 'userCredsValue'); + assert( + (client.pathTemplates.userCredsPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-firestore-api/test/gapic_firestore_v1.ts b/packages/google-cloud-firestore-api/test/gapic_firestore_v1.ts new file mode 100644 index 000000000000..4cc9176b9ba5 --- /dev/null +++ b/packages/google-cloud-firestore-api/test/gapic_firestore_v1.ts @@ -0,0 +1,3381 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as firestoreModule from '../src'; + +import { PassThrough } from 'stream'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubServerStreamingCall( + response?: ResponseType, + error?: Error, +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // write something to the stream to trigger transformStub and send the response back to the client + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + return sinon.stub().returns(mockStream); +} + +function stubBidiStreamingCall( + response?: ResponseType, + error?: Error, +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.FirestoreClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new firestoreModule.v1.FirestoreClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'firestore.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new firestoreModule.v1.FirestoreClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = firestoreModule.v1.FirestoreClient.servicePath; + assert.strictEqual(servicePath, 'firestore.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = firestoreModule.v1.FirestoreClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'firestore.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new firestoreModule.v1.FirestoreClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new firestoreModule.v1.FirestoreClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new firestoreModule.v1.FirestoreClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new firestoreModule.v1.FirestoreClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new firestoreModule.v1.FirestoreClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = firestoreModule.v1.FirestoreClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new firestoreModule.v1.FirestoreClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new firestoreModule.v1.FirestoreClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.firestoreStub, undefined); + await client.initialize(); + assert(client.firestoreStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.firestoreStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.firestoreStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getDocument', () => { + it('invokes getDocument without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.GetDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.GetDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.Document(), + ); + client.innerApiCalls.getDocument = stubSimpleCall(expectedResponse); + const [response] = await client.getDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.GetDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.GetDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.Document(), + ); + client.innerApiCalls.getDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDocument( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1.IDocument | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.GetDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.GetDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDocument = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.GetDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.GetDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDocument(request), expectedError); + }); + }); + + describe('updateDocument', () => { + it('invokes updateDocument without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.UpdateDocumentRequest(), + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.UpdateDocumentRequest', + ['document', 'name'], + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.Document(), + ); + client.innerApiCalls.updateDocument = stubSimpleCall(expectedResponse); + const [response] = await client.updateDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.UpdateDocumentRequest(), + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.UpdateDocumentRequest', + ['document', 'name'], + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.Document(), + ); + client.innerApiCalls.updateDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDocument( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1.IDocument | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.UpdateDocumentRequest(), + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.UpdateDocumentRequest', + ['document', 'name'], + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.UpdateDocumentRequest(), + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.UpdateDocumentRequest', + ['document', 'name'], + ); + request.document.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateDocument(request), expectedError); + }); + }); + + describe('deleteDocument', () => { + it('invokes deleteDocument without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.DeleteDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.DeleteDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDocument = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.DeleteDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.DeleteDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDocument( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.DeleteDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.DeleteDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.DeleteDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.DeleteDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteDocument(request), expectedError); + }); + }); + + describe('beginTransaction', () => { + it('invokes beginTransaction without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BeginTransactionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BeginTransactionRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.BeginTransactionResponse(), + ); + client.innerApiCalls.beginTransaction = stubSimpleCall(expectedResponse); + const [response] = await client.beginTransaction(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes beginTransaction without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BeginTransactionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BeginTransactionRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.BeginTransactionResponse(), + ); + client.innerApiCalls.beginTransaction = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.beginTransaction( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1.IBeginTransactionResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes beginTransaction with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BeginTransactionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BeginTransactionRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.beginTransaction = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.beginTransaction(request), expectedError); + const actualRequest = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes beginTransaction with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BeginTransactionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BeginTransactionRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.beginTransaction(request), expectedError); + }); + }); + + describe('commit', () => { + it('invokes commit without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.CommitRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.CommitRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.CommitResponse(), + ); + client.innerApiCalls.commit = stubSimpleCall(expectedResponse); + const [response] = await client.commit(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.commit as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.commit as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes commit without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.CommitRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.CommitRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.CommitResponse(), + ); + client.innerApiCalls.commit = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.commit( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1.ICommitResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.commit as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.commit as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes commit with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.CommitRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.CommitRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.commit = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.commit(request), expectedError); + const actualRequest = (client.innerApiCalls.commit as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.commit as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes commit with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.CommitRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.CommitRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.commit(request), expectedError); + }); + }); + + describe('rollback', () => { + it('invokes rollback without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RollbackRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RollbackRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.rollback = stubSimpleCall(expectedResponse); + const [response] = await client.rollback(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollback without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RollbackRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RollbackRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.rollback = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rollback( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollback with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RollbackRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RollbackRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rollback = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rollback(request), expectedError); + const actualRequest = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollback with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RollbackRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RollbackRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.rollback(request), expectedError); + }); + }); + + describe('batchWrite', () => { + it('invokes batchWrite without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BatchWriteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BatchWriteRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.BatchWriteResponse(), + ); + client.innerApiCalls.batchWrite = stubSimpleCall(expectedResponse); + const [response] = await client.batchWrite(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchWrite without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BatchWriteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BatchWriteRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.BatchWriteResponse(), + ); + client.innerApiCalls.batchWrite = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchWrite( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1.IBatchWriteResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchWrite with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BatchWriteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BatchWriteRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchWrite = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.batchWrite(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchWrite with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BatchWriteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BatchWriteRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.batchWrite(request), expectedError); + }); + }); + + describe('createDocument', () => { + it('invokes createDocument without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.CreateDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.CreateDocumentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.CreateDocumentRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.Document(), + ); + client.innerApiCalls.createDocument = stubSimpleCall(expectedResponse); + const [response] = await client.createDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.CreateDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.CreateDocumentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.CreateDocumentRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.Document(), + ); + client.innerApiCalls.createDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDocument( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1.IDocument | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.CreateDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.CreateDocumentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.CreateDocumentRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.CreateDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.CreateDocumentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.CreateDocumentRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createDocument(request), expectedError); + }); + }); + + describe('batchGetDocuments', () => { + it('invokes batchGetDocuments without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BatchGetDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BatchGetDocumentsRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.BatchGetDocumentsResponse(), + ); + client.innerApiCalls.batchGetDocuments = + stubServerStreamingCall(expectedResponse); + const stream = client.batchGetDocuments(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.BatchGetDocumentsResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetDocuments without error and gaxServerStreamingRetries enabled', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + gaxServerStreamingRetries: true, + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BatchGetDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BatchGetDocumentsRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.BatchGetDocumentsResponse(), + ); + client.innerApiCalls.batchGetDocuments = + stubServerStreamingCall(expectedResponse); + const stream = client.batchGetDocuments(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.BatchGetDocumentsResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetDocuments with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BatchGetDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BatchGetDocumentsRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchGetDocuments = stubServerStreamingCall( + undefined, + expectedError, + ); + const stream = client.batchGetDocuments(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.BatchGetDocumentsResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + const actualRequest = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetDocuments with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.BatchGetDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.BatchGetDocumentsRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + const stream = client.batchGetDocuments(request, { + retryRequestOptions: { noResponseRetries: 0 }, + }); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.BatchGetDocumentsResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + it('should create a client with gaxServerStreamingRetries enabled', () => { + const client = new firestoreModule.v1.FirestoreClient({ + gaxServerStreamingRetries: true, + }); + assert(client); + }); + }); + + describe('runQuery', () => { + it('invokes runQuery without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RunQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RunQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.RunQueryResponse(), + ); + client.innerApiCalls.runQuery = stubServerStreamingCall(expectedResponse); + const stream = client.runQuery(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.RunQueryResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runQuery without error and gaxServerStreamingRetries enabled', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + gaxServerStreamingRetries: true, + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RunQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RunQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.RunQueryResponse(), + ); + client.innerApiCalls.runQuery = stubServerStreamingCall(expectedResponse); + const stream = client.runQuery(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.RunQueryResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runQuery with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RunQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RunQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runQuery = stubServerStreamingCall( + undefined, + expectedError, + ); + const stream = client.runQuery(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.RunQueryResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + const actualRequest = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runQuery with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RunQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RunQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + const stream = client.runQuery(request, { + retryRequestOptions: { noResponseRetries: 0 }, + }); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.RunQueryResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + it('should create a client with gaxServerStreamingRetries enabled', () => { + const client = new firestoreModule.v1.FirestoreClient({ + gaxServerStreamingRetries: true, + }); + assert(client); + }); + }); + + describe('executePipeline', () => { + it('invokes executePipeline without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ExecutePipelineRequest(), + ); + // path template: projects/*/databases/{database_id=*}/** + request.database = 'projects/value/databases/value/value'; + const expectedHeaderRequestParams = 'database_id=value'; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.ExecutePipelineResponse(), + ); + client.innerApiCalls.executePipeline = + stubServerStreamingCall(expectedResponse); + const stream = client.executePipeline(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.ExecutePipelineResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executePipeline as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executePipeline as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executePipeline without error and gaxServerStreamingRetries enabled', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + gaxServerStreamingRetries: true, + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ExecutePipelineRequest(), + ); + // path template: projects/*/databases/{database_id=*}/** + request.database = 'projects/value/databases/value/value'; + const expectedHeaderRequestParams = 'database_id=value'; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.ExecutePipelineResponse(), + ); + client.innerApiCalls.executePipeline = + stubServerStreamingCall(expectedResponse); + const stream = client.executePipeline(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.ExecutePipelineResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executePipeline as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executePipeline as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executePipeline with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ExecutePipelineRequest(), + ); + // path template: projects/*/databases/{database_id=*}/** + request.database = 'projects/value/databases/value/value'; + const expectedHeaderRequestParams = 'database_id=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.executePipeline = stubServerStreamingCall( + undefined, + expectedError, + ); + const stream = client.executePipeline(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.ExecutePipelineResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + const actualRequest = ( + client.innerApiCalls.executePipeline as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executePipeline as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executePipeline with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ExecutePipelineRequest(), + ); + // path template: projects/*/databases/{database_id=*}/** + request.database = 'projects/value/databases/value/value'; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + const stream = client.executePipeline(request, { + retryRequestOptions: { noResponseRetries: 0 }, + }); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.ExecutePipelineResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + it('should create a client with gaxServerStreamingRetries enabled', () => { + const client = new firestoreModule.v1.FirestoreClient({ + gaxServerStreamingRetries: true, + }); + assert(client); + }); + }); + + describe('runAggregationQuery', () => { + it('invokes runAggregationQuery without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RunAggregationQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RunAggregationQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.RunAggregationQueryResponse(), + ); + client.innerApiCalls.runAggregationQuery = + stubServerStreamingCall(expectedResponse); + const stream = client.runAggregationQuery(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.firestore.v1.RunAggregationQueryResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runAggregationQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runAggregationQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAggregationQuery without error and gaxServerStreamingRetries enabled', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + gaxServerStreamingRetries: true, + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RunAggregationQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RunAggregationQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.RunAggregationQueryResponse(), + ); + client.innerApiCalls.runAggregationQuery = + stubServerStreamingCall(expectedResponse); + const stream = client.runAggregationQuery(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.firestore.v1.RunAggregationQueryResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runAggregationQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runAggregationQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAggregationQuery with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RunAggregationQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RunAggregationQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runAggregationQuery = stubServerStreamingCall( + undefined, + expectedError, + ); + const stream = client.runAggregationQuery(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.firestore.v1.RunAggregationQueryResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + const actualRequest = ( + client.innerApiCalls.runAggregationQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runAggregationQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runAggregationQuery with closed client', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.RunAggregationQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.RunAggregationQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + const stream = client.runAggregationQuery(request, { + retryRequestOptions: { noResponseRetries: 0 }, + }); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.firestore.v1.RunAggregationQueryResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + it('should create a client with gaxServerStreamingRetries enabled', () => { + const client = new firestoreModule.v1.FirestoreClient({ + gaxServerStreamingRetries: true, + }); + assert(client); + }); + }); + + describe('write', () => { + it('invokes write without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.WriteRequest(), + ); + + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.WriteResponse(), + ); + client.innerApiCalls.write = stubBidiStreamingCall(expectedResponse); + const stream = client.write(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.WriteResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.write as SinonStub).getCall(0).calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + + it('invokes write with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.WriteRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.write = stubBidiStreamingCall( + undefined, + expectedError, + ); + const stream = client.write(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.WriteResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.write as SinonStub).getCall(0).calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + }); + + describe('listen', () => { + it('invokes listen without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListenRequest(), + ); + + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1.ListenResponse(), + ); + client.innerApiCalls.listen = stubBidiStreamingCall(expectedResponse); + const stream = client.listen(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.ListenResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listen as SinonStub).getCall(0).calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + + it('invokes listen with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListenRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listen = stubBidiStreamingCall( + undefined, + expectedError, + ); + const stream = client.listen(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1.ListenResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.listen as SinonStub).getCall(0).calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + }); + + describe('listDocuments', () => { + it('invokes listDocuments without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1.Document()), + generateSampleMessage(new protos.google.firestore.v1.Document()), + generateSampleMessage(new protos.google.firestore.v1.Document()), + ]; + client.innerApiCalls.listDocuments = stubSimpleCall(expectedResponse); + const [response] = await client.listDocuments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocuments without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1.Document()), + generateSampleMessage(new protos.google.firestore.v1.Document()), + generateSampleMessage(new protos.google.firestore.v1.Document()), + ]; + client.innerApiCalls.listDocuments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDocuments( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1.IDocument[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocuments with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDocuments = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listDocuments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocumentsStream without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1.Document()), + generateSampleMessage(new protos.google.firestore.v1.Document()), + generateSampleMessage(new protos.google.firestore.v1.Document()), + ]; + client.descriptors.page.listDocuments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.v1.Document[] = []; + stream.on('data', (response: protos.google.firestore.v1.Document) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDocuments, request), + ); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listDocumentsStream with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.v1.Document[] = []; + stream.on('data', (response: protos.google.firestore.v1.Document) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDocuments, request), + ); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listDocuments without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1.Document()), + generateSampleMessage(new protos.google.firestore.v1.Document()), + generateSampleMessage(new protos.google.firestore.v1.Document()), + ]; + client.descriptors.page.listDocuments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.firestore.v1.IDocument[] = []; + const iterable = client.listDocumentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDocuments.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listDocuments with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDocumentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.firestore.v1.IDocument[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDocuments.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('partitionQuery', () => { + it('invokes partitionQuery without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + ]; + client.innerApiCalls.partitionQuery = stubSimpleCall(expectedResponse); + const [response] = await client.partitionQuery(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes partitionQuery without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + ]; + client.innerApiCalls.partitionQuery = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.partitionQuery( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1.ICursor[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes partitionQuery with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.partitionQuery = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.partitionQuery(request), expectedError); + const actualRequest = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes partitionQueryStream without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + ]; + client.descriptors.page.partitionQuery.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.partitionQueryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.v1.Cursor[] = []; + stream.on('data', (response: protos.google.firestore.v1.Cursor) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.partitionQuery.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.partitionQuery, request), + ); + assert( + (client.descriptors.page.partitionQuery.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes partitionQueryStream with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.partitionQuery.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.partitionQueryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.v1.Cursor[] = []; + stream.on('data', (response: protos.google.firestore.v1.Cursor) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.partitionQuery.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.partitionQuery, request), + ); + assert( + (client.descriptors.page.partitionQuery.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with partitionQuery without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1.Cursor()), + ]; + client.descriptors.page.partitionQuery.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.firestore.v1.ICursor[] = []; + const iterable = client.partitionQueryAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.partitionQuery.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with partitionQuery with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.partitionQuery.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.partitionQueryAsync(request); + await assert.rejects(async () => { + const responses: protos.google.firestore.v1.ICursor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.partitionQuery.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listCollectionIds', () => { + it('invokes listCollectionIds without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.listCollectionIds = stubSimpleCall(expectedResponse); + const [response] = await client.listCollectionIds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCollectionIds without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.listCollectionIds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCollectionIds( + request, + (err?: Error | null, result?: string[] | null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCollectionIds with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCollectionIds = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listCollectionIds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCollectionIdsStream without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.listCollectionIds.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCollectionIdsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCollectionIds.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCollectionIds, request), + ); + assert( + (client.descriptors.page.listCollectionIds.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listCollectionIdsStream with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCollectionIds.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCollectionIdsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCollectionIds.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCollectionIds, request), + ); + assert( + (client.descriptors.page.listCollectionIds.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listCollectionIds without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.listCollectionIds.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: string[] = []; + const iterable = client.listCollectionIdsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCollectionIds.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listCollectionIds with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCollectionIds.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCollectionIdsAsync(request); + await assert.rejects(async () => { + const responses: string[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCollectionIds.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new firestoreModule.v1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); +}); diff --git a/packages/google-cloud-firestore-api/test/gapic_firestore_v1beta1.ts b/packages/google-cloud-firestore-api/test/gapic_firestore_v1beta1.ts new file mode 100644 index 000000000000..9e83a32efcf4 --- /dev/null +++ b/packages/google-cloud-firestore-api/test/gapic_firestore_v1beta1.ts @@ -0,0 +1,2857 @@ +// Copyright 2026 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as firestoreModule from '../src'; + +import { PassThrough } from 'stream'; + +import { protobuf } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubServerStreamingCall( + response?: ResponseType, + error?: Error, +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // write something to the stream to trigger transformStub and send the response back to the client + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + return sinon.stub().returns(mockStream); +} + +function stubBidiStreamingCall( + response?: ResponseType, + error?: Error, +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.FirestoreClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new firestoreModule.v1beta1.FirestoreClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'firestore.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new firestoreModule.v1beta1.FirestoreClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = firestoreModule.v1beta1.FirestoreClient.servicePath; + assert.strictEqual(servicePath, 'firestore.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = firestoreModule.v1beta1.FirestoreClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'firestore.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new firestoreModule.v1beta1.FirestoreClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new firestoreModule.v1beta1.FirestoreClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'firestore.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new firestoreModule.v1beta1.FirestoreClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = firestoreModule.v1beta1.FirestoreClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new firestoreModule.v1beta1.FirestoreClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.firestoreStub, undefined); + await client.initialize(); + assert(client.firestoreStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.firestoreStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.firestoreStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getDocument', () => { + it('invokes getDocument without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.GetDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.GetDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.Document(), + ); + client.innerApiCalls.getDocument = stubSimpleCall(expectedResponse); + const [response] = await client.getDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.GetDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.GetDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.Document(), + ); + client.innerApiCalls.getDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDocument( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1beta1.IDocument | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.GetDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.GetDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDocument = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.GetDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.GetDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDocument(request), expectedError); + }); + }); + + describe('updateDocument', () => { + it('invokes updateDocument without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.UpdateDocumentRequest(), + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.UpdateDocumentRequest', + ['document', 'name'], + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.Document(), + ); + client.innerApiCalls.updateDocument = stubSimpleCall(expectedResponse); + const [response] = await client.updateDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.UpdateDocumentRequest(), + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.UpdateDocumentRequest', + ['document', 'name'], + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.Document(), + ); + client.innerApiCalls.updateDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDocument( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1beta1.IDocument | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.UpdateDocumentRequest(), + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.UpdateDocumentRequest', + ['document', 'name'], + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.UpdateDocumentRequest(), + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.UpdateDocumentRequest', + ['document', 'name'], + ); + request.document.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateDocument(request), expectedError); + }); + }); + + describe('deleteDocument', () => { + it('invokes deleteDocument without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.DeleteDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.DeleteDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDocument = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.DeleteDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.DeleteDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDocument( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.DeleteDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.DeleteDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.DeleteDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.DeleteDocumentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteDocument(request), expectedError); + }); + }); + + describe('beginTransaction', () => { + it('invokes beginTransaction without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BeginTransactionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BeginTransactionRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.BeginTransactionResponse(), + ); + client.innerApiCalls.beginTransaction = stubSimpleCall(expectedResponse); + const [response] = await client.beginTransaction(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes beginTransaction without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BeginTransactionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BeginTransactionRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.BeginTransactionResponse(), + ); + client.innerApiCalls.beginTransaction = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.beginTransaction( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1beta1.IBeginTransactionResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes beginTransaction with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BeginTransactionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BeginTransactionRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.beginTransaction = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.beginTransaction(request), expectedError); + const actualRequest = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.beginTransaction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes beginTransaction with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BeginTransactionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BeginTransactionRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.beginTransaction(request), expectedError); + }); + }); + + describe('commit', () => { + it('invokes commit without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.CommitRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.CommitRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.CommitResponse(), + ); + client.innerApiCalls.commit = stubSimpleCall(expectedResponse); + const [response] = await client.commit(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.commit as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.commit as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes commit without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.CommitRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.CommitRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.CommitResponse(), + ); + client.innerApiCalls.commit = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.commit( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1beta1.ICommitResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.commit as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.commit as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes commit with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.CommitRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.CommitRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.commit = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.commit(request), expectedError); + const actualRequest = (client.innerApiCalls.commit as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.commit as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes commit with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.CommitRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.CommitRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.commit(request), expectedError); + }); + }); + + describe('rollback', () => { + it('invokes rollback without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.RollbackRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.RollbackRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.rollback = stubSimpleCall(expectedResponse); + const [response] = await client.rollback(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollback without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.RollbackRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.RollbackRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.rollback = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rollback( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollback with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.RollbackRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.RollbackRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rollback = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rollback(request), expectedError); + const actualRequest = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollback as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollback with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.RollbackRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.RollbackRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.rollback(request), expectedError); + }); + }); + + describe('batchWrite', () => { + it('invokes batchWrite without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchWriteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BatchWriteRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchWriteResponse(), + ); + client.innerApiCalls.batchWrite = stubSimpleCall(expectedResponse); + const [response] = await client.batchWrite(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchWrite without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchWriteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BatchWriteRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchWriteResponse(), + ); + client.innerApiCalls.batchWrite = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchWrite( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1beta1.IBatchWriteResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchWrite with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchWriteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BatchWriteRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchWrite = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.batchWrite(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchWrite with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchWriteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BatchWriteRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.batchWrite(request), expectedError); + }); + }); + + describe('createDocument', () => { + it('invokes createDocument without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.CreateDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.CreateDocumentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.CreateDocumentRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.Document(), + ); + client.innerApiCalls.createDocument = stubSimpleCall(expectedResponse); + const [response] = await client.createDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.CreateDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.CreateDocumentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.CreateDocumentRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.Document(), + ); + client.innerApiCalls.createDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDocument( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1beta1.IDocument | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.CreateDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.CreateDocumentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.CreateDocumentRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.CreateDocumentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.CreateDocumentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.CreateDocumentRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createDocument(request), expectedError); + }); + }); + + describe('batchGetDocuments', () => { + it('invokes batchGetDocuments without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchGetDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BatchGetDocumentsRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchGetDocumentsResponse(), + ); + client.innerApiCalls.batchGetDocuments = + stubServerStreamingCall(expectedResponse); + const stream = client.batchGetDocuments(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.firestore.v1beta1.BatchGetDocumentsResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetDocuments without error and gaxServerStreamingRetries enabled', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + gaxServerStreamingRetries: true, + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchGetDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BatchGetDocumentsRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchGetDocumentsResponse(), + ); + client.innerApiCalls.batchGetDocuments = + stubServerStreamingCall(expectedResponse); + const stream = client.batchGetDocuments(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.firestore.v1beta1.BatchGetDocumentsResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetDocuments with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchGetDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BatchGetDocumentsRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchGetDocuments = stubServerStreamingCall( + undefined, + expectedError, + ); + const stream = client.batchGetDocuments(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.firestore.v1beta1.BatchGetDocumentsResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + const actualRequest = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchGetDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetDocuments with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.BatchGetDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.BatchGetDocumentsRequest', + ['database'], + ); + request.database = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + const stream = client.batchGetDocuments(request, { + retryRequestOptions: { noResponseRetries: 0 }, + }); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.firestore.v1beta1.BatchGetDocumentsResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + it('should create a client with gaxServerStreamingRetries enabled', () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + gaxServerStreamingRetries: true, + }); + assert(client); + }); + }); + + describe('runQuery', () => { + it('invokes runQuery without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.RunQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.RunQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.RunQueryResponse(), + ); + client.innerApiCalls.runQuery = stubServerStreamingCall(expectedResponse); + const stream = client.runQuery(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.RunQueryResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runQuery without error and gaxServerStreamingRetries enabled', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + gaxServerStreamingRetries: true, + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.RunQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.RunQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.RunQueryResponse(), + ); + client.innerApiCalls.runQuery = stubServerStreamingCall(expectedResponse); + const stream = client.runQuery(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.RunQueryResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runQuery with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.RunQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.RunQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runQuery = stubServerStreamingCall( + undefined, + expectedError, + ); + const stream = client.runQuery(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.RunQueryResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + const actualRequest = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runQuery with closed client', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.RunQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.RunQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + const stream = client.runQuery(request, { + retryRequestOptions: { noResponseRetries: 0 }, + }); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.RunQueryResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + it('should create a client with gaxServerStreamingRetries enabled', () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + gaxServerStreamingRetries: true, + }); + assert(client); + }); + }); + + describe('write', () => { + it('invokes write without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.WriteRequest(), + ); + + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.WriteResponse(), + ); + client.innerApiCalls.write = stubBidiStreamingCall(expectedResponse); + const stream = client.write(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.WriteResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.write as SinonStub).getCall(0).calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + + it('invokes write with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.WriteRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.write = stubBidiStreamingCall( + undefined, + expectedError, + ); + const stream = client.write(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.WriteResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.write as SinonStub).getCall(0).calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + }); + + describe('listen', () => { + it('invokes listen without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListenRequest(), + ); + + const expectedResponse = generateSampleMessage( + new protos.google.firestore.v1beta1.ListenResponse(), + ); + client.innerApiCalls.listen = stubBidiStreamingCall(expectedResponse); + const stream = client.listen(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.ListenResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listen as SinonStub).getCall(0).calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + + it('invokes listen with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListenRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listen = stubBidiStreamingCall( + undefined, + expectedError, + ); + const stream = client.listen(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.ListenResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.listen as SinonStub).getCall(0).calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + }); + + describe('listDocuments', () => { + it('invokes listDocuments without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + ]; + client.innerApiCalls.listDocuments = stubSimpleCall(expectedResponse); + const [response] = await client.listDocuments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocuments without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + ]; + client.innerApiCalls.listDocuments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDocuments( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1beta1.IDocument[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocuments with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDocuments = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listDocuments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocumentsStream without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + ]; + client.descriptors.page.listDocuments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.v1beta1.Document[] = []; + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.Document) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDocuments, request), + ); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listDocumentsStream with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.v1beta1.Document[] = []; + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.Document) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDocuments, request), + ); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listDocuments without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + generateSampleMessage(new protos.google.firestore.v1beta1.Document()), + ]; + client.descriptors.page.listDocuments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.firestore.v1beta1.IDocument[] = []; + const iterable = client.listDocumentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDocuments.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listDocuments with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListDocumentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListDocumentsRequest', + ['collectionId'], + ); + request.collectionId = defaultValue2; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDocumentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.firestore.v1beta1.IDocument[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDocuments.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('partitionQuery', () => { + it('invokes partitionQuery without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + ]; + client.innerApiCalls.partitionQuery = stubSimpleCall(expectedResponse); + const [response] = await client.partitionQuery(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes partitionQuery without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + ]; + client.innerApiCalls.partitionQuery = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.partitionQuery( + request, + ( + err?: Error | null, + result?: protos.google.firestore.v1beta1.ICursor[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes partitionQuery with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.partitionQuery = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.partitionQuery(request), expectedError); + const actualRequest = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.partitionQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes partitionQueryStream without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + ]; + client.descriptors.page.partitionQuery.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.partitionQueryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.v1beta1.Cursor[] = []; + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.Cursor) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.partitionQuery.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.partitionQuery, request), + ); + assert( + (client.descriptors.page.partitionQuery.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes partitionQueryStream with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.partitionQuery.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.partitionQueryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.firestore.v1beta1.Cursor[] = []; + stream.on( + 'data', + (response: protos.google.firestore.v1beta1.Cursor) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.partitionQuery.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.partitionQuery, request), + ); + assert( + (client.descriptors.page.partitionQuery.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with partitionQuery without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + generateSampleMessage(new protos.google.firestore.v1beta1.Cursor()), + ]; + client.descriptors.page.partitionQuery.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.firestore.v1beta1.ICursor[] = []; + const iterable = client.partitionQueryAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.partitionQuery.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with partitionQuery with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.PartitionQueryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.PartitionQueryRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.partitionQuery.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.partitionQueryAsync(request); + await assert.rejects(async () => { + const responses: protos.google.firestore.v1beta1.ICursor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.partitionQuery.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listCollectionIds', () => { + it('invokes listCollectionIds without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.listCollectionIds = stubSimpleCall(expectedResponse); + const [response] = await client.listCollectionIds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCollectionIds without error using callback', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.listCollectionIds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCollectionIds( + request, + (err?: Error | null, result?: string[] | null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCollectionIds with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCollectionIds = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listCollectionIds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCollectionIds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCollectionIdsStream without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.listCollectionIds.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCollectionIdsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCollectionIds.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCollectionIds, request), + ); + assert( + (client.descriptors.page.listCollectionIds.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listCollectionIdsStream with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCollectionIds.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCollectionIdsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCollectionIds.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCollectionIds, request), + ); + assert( + (client.descriptors.page.listCollectionIds.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listCollectionIds without error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.listCollectionIds.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: string[] = []; + const iterable = client.listCollectionIdsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCollectionIds.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listCollectionIds with error', async () => { + const client = new firestoreModule.v1beta1.FirestoreClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.firestore.v1beta1.ListCollectionIdsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.firestore.v1beta1.ListCollectionIdsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCollectionIds.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCollectionIdsAsync(request); + await assert.rejects(async () => { + const responses: string[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCollectionIds.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); +}); diff --git a/packages/google-cloud-firestore-api/tsconfig.json b/packages/google-cloud-firestore-api/tsconfig.json new file mode 100644 index 000000000000..ca73e7bfc824 --- /dev/null +++ b/packages/google-cloud-firestore-api/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2023", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts", + "src/**/*.json", + "samples/**/*.json", + "protos/protos.json" + ] +} diff --git a/packages/google-cloud-firestore-api/webpack.config.js b/packages/google-cloud-firestore-api/webpack.config.js new file mode 100644 index 000000000000..6eb32a37ad45 --- /dev/null +++ b/packages/google-cloud-firestore-api/webpack.config.js @@ -0,0 +1,64 @@ +// 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 +// +// https://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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'FirestoreAdmin', + filename: './firestore-admin.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +};